dagre-py

Thin python wrapper around dagre-d3


Keywords
dagre-d3
License
MIT
Install
pip install dagre-py==0.1.6

Documentation

dagre-py

https://img.shields.io/travis/com/Vernacular-ai/dagre-py/master.svg?style=flat-square https://img.shields.io/pypi/v/dagre-py.svg?style=flat-square

Thin python wrapper around dagre-d3 for building quick dags with tooltips and a few other niceties. It’s not really generically usable right now, but you can try something like:

from dagre_py.core import plot

plot({
    "nodes": [
        {"label": "A"},
        {"label": "B", "description": "This is an output node"}
    ],
    "edges": [{"source": "A", "target": "B", "label": "edge1"},
              {"source": "A", "target": "B", "label": "edge2"}]
})

With the following effect:

./screens/multi-edges.png

It’s also possible to use an id field coupled with a label to disambiguate nodes that you want to have the same label. Where source and target fields in edges use node id instead of node label. For example:

from dagre_py.core import plot

plot({
    "nodes": [
        {"label": "A", "id": "A"},
        {"label": "A", "id": "B", "description": "This is an output node"}
    ],
    "edges": [{"source": "A", "target": "B"}]
})

With the following effect:

./screens/duplicate-labels.png

For more description of the data that goes in, check the docstring of dagre_py.core.plot function.