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
Release files for NBRW 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nbrw-0.1.7.tar.gz | 21.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nbrw-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.5 kB
Release files / nbrw-0.1.7.tar.gz
| Download URL | nbrw-0.1.7.tar.gz |
|---|---|
| Size | 21.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
954e1c9ad3d4b6edd13927e8683475436377c9e186801d65d44ccc3ebcaf4255
|
|
BLAKE2b-256 checksum How to use checksums |
b35912f2cdbaac39b5cb95de8bb4d9a6d6a8422efb607995420676390d28a199
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.8
|
Release files / nbrw-0.1.7-py3-none-any.whl
| Download URL | nbrw-0.1.7-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c344cd0a9b6579a7f065f39c440432dec1426ecbd2cdaf95bb732b154756bf6
|
|
BLAKE2b-256 checksum How to use checksums |
b582f0478f753e9ca4ef88983fcd2b3e8ff21ca91de4d581c39d7fd7f1bd9b7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.8
|