Skip to content

Instantly share code, notes, and snippets.

@SheatNoisette
Last active November 23, 2019 17:26
Show Gist options
  • Save SheatNoisette/82e379963f109676ea363e28c1ab6b60 to your computer and use it in GitHub Desktop.
Save SheatNoisette/82e379963f109676ea363e28c1ab6b60 to your computer and use it in GitHub Desktop.
Generate and export graph from dot file using Graphviz
"""
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