Skip to content

hwelch-fle/pygraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

101 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pygraph

A wrapper for rustworkx that allows you to build visjs graphs using Python

Getting Started

PyPi package coming soon

git clone https://github.com/hwelch-fle/pygraph.git
cd pygraph
pip install .

Usage

More detailed Usage coming soon

>>> from pygraph import Network, set
>>> nx = Network(range(10))
>>> nx.add_edges_from((i,j) if i in range(10) for j in range(10))
>>> nx
Network(N=|10|, E=|100|)
>>> 10 in nx
False
>>> 9 in nx
True
>>> (0,0) in nx
True
>>> nx[0]
Node(0, options=['label'])
>>> nx[0].data['label']
"0"
>>> nx[0].data['label'] = 'Node Zero'
>>> nx[0]
"0"
>>> nx[0].data['label']
"Node Zero"
>>> nx.get_data()
{
    'nodes': "[{'id': 0, 'label': 'Node Zero', ...}, ...], 
    'edges': "[{'from': 0, to: 0, ...}, ...]",
    'options': "{'physics': {'enabled': true}, ....}"
}
# Use this to populate HTML Jinja Template with packaged visjs

Templates

Coming Soon (Currently ships with piyvisjs templates, but any jinja2 template that uses visjs will work)

Repo Graph (see Interactive Graph Here)

Generated Graph

About

A re-write of pyvisjs that adds more functionality and uses a `rustworkx` backend

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors