Graphius is a python library for creating and visualizing graphs. It has algorithms for finding shortest paths, minimum spanning trees, and more. You can visualize the graphs and algorithms step by step. You can use graphius with Jupyter notebooks or as a standalone application.
For examples see the examples notebook.
pip install graphius
If you want to use the visualization features you need to install
graphviz
. See graphviz.org/download for installation instructions.
from graphius import Graph
adjacency_list = {
's': [('t', 10), ('y', 5)],
't': [('x', 1), ('y', 2)],
'x': [('z', 4)],
'y': [('t', 3), ('x', 9), ('z', 2)],
'z': [('s', 7), ('x', 6)]
}
g = Graph(adjacency_list, weighted=True, directed=True)
g.dijkstra('s', visualized=True, gif_path='dijkstra.gif')
dijsktra.gif:
This project is licensed under the MIT License - see the LICENSE file for details