This repo contains a work-in-progress Python module for approximating the modulus for graphs introduced by Albin, Poggi-Corradini, and their colleagues.
Our code relies on the following modules:
numpy
for ...python-igraph
for constructing and manipulating mathematical graphscvxpy
for solving convex optimization problems
See the file installation-notes.txt
for more detail.
It is structured as a python module and can be installed on a shell as follows:
pip3 install ./pmodpy/
The main functions can be called as follows:
from pmodpy import modsubfamily
from pmodpy import modspans
from pmodpy import modwalks
If you would like to use the example graphs, include the following line:
from pmodpy.examplegraphs import examplegraphs
Then, one of the examples can be called as follow:
House=examplegraphs.House()
where House is the name of one of the example graphs.
If you want to compute the 2-modulus of walks from node 0 to node 1 on House graph with verbose option, then we do:
modwalks.modulus_walks_density(House, 0, 1, p=2, eps=2e-36, verbose=0)
##This graph is giving a different modulus as reported from the Shakeri paper.
Shakeri_1d =examplegraphs.Shakeri_1d()
This is a limited adaptation of methods developed by the NODE Group at Kansas State University. Original work is licensed under the GNU Public License version 2.