GraphvizAnim is a tool to create simple animated graph visualizations; it is just a proof of concept, aimed mainly at teaching purposes. It is based on Graphviz for the graph rendering part and on ImageMagick for the animated gif generation.
A graph animation is just a sequence of steps, a step is in turn one or
more actions such as: add, hilight, label, unlabel or remove a
node, and add, hilight, or remove an edge. Animations can be built
by invoking suitable methods of a gvanim.Animation
object (in a Python
program), or by parsing a simple text file (that, in turn, can be generated by
a program in any language).
The examples folder contains few instances of such approaches.
After installing the package with python setup.py install
, or using
pip install https://github.com/mapio/GraphvizAnim/archive/0.2-alpha.zip
you can generate an animated depth first visit (in a 3-regular random graph of 6 nodes) by running
python examples/dfv.py
or you can generate the simple animation described in simple.txt as
python -m gvanim examples/simple.txt simple
You can generate an Erdős–Rényi graph (with 10 nodes and edge probability 1/10) by running
cd examples
gcc -o er er.c
./er | python -m gvanim er
Finally, you can obain an interactive visualization with Jupyter by running
cd examples
jupyter notebook simple.ipynb
and running all the cells in order.
The binder service lets you run Jupyter notebooks starting from GitHub repositories. Using such service, you can see the simple.ipynb example actually running on-line.
Any help will be appreciated. Things to do to make this more usable are:
- add
setup.py
, - add tests,
- add other actions (such as labeling of nodes and edges),
- document the Python code,
- add option parsing to
__main__.py
, - integrate this with PyGraphviz,
- integrate this with Jupyter,
- add more relevant examples.