Skip to content

Instantly share code, notes, and snippets.

@hyakuhei
Created December 18, 2021 15:23
Show Gist options
  • Save hyakuhei/33f48cf48cc15062631634433ac7454b to your computer and use it in GitHub Desktop.
Save hyakuhei/33f48cf48cc15062631634433ac7454b to your computer and use it in GitHub Desktop.
Script to show nesting issue in GvGen
import subprocess
from gvgen import *
graph = GvGen()
# Everything in our graph should be within this
mainContainer = graph.newItem("Main Container")
# a2 nests under a1 which nests under mainContainer
a1 = graph.newItem("a1", mainContainer)
a2 = graph.newItem("a2", a1)
a3 = graph.newItem("a3", a2)
b1 = graph.newItem("b1", mainContainer)
b2 = graph.newItem("b2", b1)
b3 = graph.newItem("b3", b2)
with open("test.dot", "w") as f:
graph.dot(f)
_ = subprocess.run(["dot", "-s100", "-Tpng", "test.dot", f"-otest.png"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment