Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (12.7k points)
To Visualize a succession of nodes associated with edges encoded in python.

Searching for a python library to visualize such chart information.

Either a library written in python or python ties is alright

1 Answer

0 votes
by (26.4k points)

According to me, Graphviz will be the best option.

Graphviz is the premiere graph rendering/layout library; it's mature, stable, open-source, and free of charge. It is not a dedicated flowchart or diagramming package, but its core use case--i.e., efficient and aesthetic rendering of objects comprised of nodes and edges, obviously subsumes flowchart drawing--particularly because its api allows the user to set various constraints on the layout to encourage rendering in the various formats--eg, you can require all nodes of the same level (same number of parents from the root) to be rendered in a single center-aligned row.

Graphviz is not a python library (it's written in C); however there are high quality python bindings available.

The python-Graphviz library I am most familar with is pygraphviz, which is excellent.

Look at the below code, which is used to create a small "flowchart".

digraph {

  node [    fill=cornflowerblue,

            fontcolor=white,

            shape=diamond,

            style=filled];

  Step1 [   color=darkgoldenrod2,

            fontcolor=navy,

            label=start,

            shape=box];

  Step2;

  Step3a [  style=filled,

            fillcolor=grey80,

            color=grey80,

            shape=circle,

            fontcolor=navy];

  Step1  -> Step2;

  Step1  -> Step2a;

  Step2a -> Step3a;

  Step3;

  Step3a -> Step3;

  Step3a -> Step2b;

  Step2  -> Step2b;

  Step2b -> Step3;

  End [ shape=rectangle,

        color=darkgoldenrod2,

        fontcolor=navy];

  Step3  -> End [label=193];

}

Are you pretty much interested to learn python in detail? Come and join the python training course to gain more knowledge.

Watch this video tutorial for more information.

Browse Categories

...