A module for modeling non-backtracking random walks on graphs and computing kemeny's constant.
Project description
NBRW
[Paper] | [Documentation] | [PyPI]
Non-backtracking random walks (NBRW). A nonbacktracking random walk is a random walk on a graph in which the walker is restricted from visiting the previous node.
This repository's main focus is to create the NBRW package, which contains the following files:
-
NBRW.py: An NBRW class dedicated to storing relevant attributes such as Kemeny's constant, mean first passage times, the fundamental matrix, stationary vector, etc. -
extra_graphs.py: Includes several functions that create graph families as SageMath Graph objects. These graph families have been important to our research and are not built-in in SageMath.
This work was primarily motivated by research conducted alongside Adam Knudson, Mark Kempton, and Jane Breen. This code has been incredibly useful for modeling these walks and for exploring theoretical results through numerical experimentation.
Much of this code relies on SageMath, which has many built-in functions for graph theory.
Instructions
You must have SageMath installed; refer to the SageMath installation guide on how to do this. From my experience, it can be very cumbersome to get Sage to import in my IDE, so I was in the habit of developing either in either the Jupyter notebook or terminal environment that SageMath opens upon launching.
You can then install this package with via
pip install NBRW
Refer to the NBRW PyPI page for any version changes.
Sample Usage
from nbrw import NBRW
from sage.all import *
g = graphs.PetersenGraph()
G = NBRW(g)
from nbrw import extra_graphs as exg
N = exg.necklace(5) # necklace graph with 5 beads
C = exg.cycle_barbell(k=2, a=5, b=6) # cycle barbell with 2-path, 5-cycle and a 6-cycle
P = exg.pinwheel([3, 4, 5]) # pinwheel graph with 3 spokes of 3-, 4-, and 5- cycles
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nbrw-0.1.7.tar.gz.
File metadata
- Download URL: nbrw-0.1.7.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
954e1c9ad3d4b6edd13927e8683475436377c9e186801d65d44ccc3ebcaf4255
|
|
| MD5 |
89341b49628d5723fcd77f88b9cc2bc0
|
|
| BLAKE2b-256 |
b35912f2cdbaac39b5cb95de8bb4d9a6d6a8422efb607995420676390d28a199
|
File details
Details for the file nbrw-0.1.7-py3-none-any.whl.
File metadata
- Download URL: nbrw-0.1.7-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c344cd0a9b6579a7f065f39c440432dec1426ecbd2cdaf95bb732b154756bf6
|
|
| MD5 |
ecda3a45b212e53d48a60138595a00f2
|
|
| BLAKE2b-256 |
b582f0478f753e9ca4ef88983fcd2b3e8ff21ca91de4d581c39d7fd7f1bd9b7b
|