I am trying to get a graph looking similar to this with Graphviz:
But using this code:
from graphviz import Digraph
G = Digraph()
G.node_attr = {
"shape": "rectangle",
"width": "2",
"height": "2"
}
G.node("A")
G.node("B")
x = "0.5"
G.node("B1", width=x, height=x)
G.node("B2", width=x, height=x)
G.node("B3", width=x, height=x)
G.node("C")
G.edge("A", "B")
G.edge("B", "C")
G.edge("A", "B1")
G.edge("B1", "B2")
G.edge("B1", "B3")
I end up with this:
I want B1, B2 and B3 to be in the same "vertical level" as B. I am sure this can be achieved with subgraphs, but I cannot figure out how to do it.


