Last active
November 23, 2019 17:26
-
-
Save SheatNoisette/82e379963f109676ea363e28c1ab6b60 to your computer and use it in GitHub Desktop.
Generate and export graph from dot file using Graphviz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Render Graphviz dot file example | |
Ubuntu and Debian: sudo apt-get install graphviz && pip3 install graphviz | |
""" | |
from graphviz import Source | |
input_graph = """ | |
graph { | |
0 [label = "ape"] | |
1 [label = "apt"] | |
2 [label = "yay"] | |
1 -- 0 | |
0 -- 2 | |
} | |
""" | |
Out = Source(input_graph) | |
Out.render(filename="graph", format="png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment