tortal tortal - 1 month ago 7
Python Question

How can I connect graphviz nodes that are in records with pygraphviz?

I am working with pygraphviz to interface with dot/graphviz. I am creating records through labels but I am wondering how to connect ports that are in the records rather than record nodes themselves.

In dot it would look something like this:

a00 [shape = "record" label="{{RecordThing1}|{<1>A|<2>B|<3>C|<4>D|<5>E|<6>F}}"];
a01 [shape = "record" label="{{RecordThing2}|{<1>A|<2>B|<3>C|<4>D|<5>E|<6>F}}"];
a00:1 -> a01:1

Answer

I found a solution: The headport and tailport attributes of edges can be used. e.g.

agraph.add_node('a00', 'a01', tailport=1, headport=1)

Read more at: http://www.graphviz.org/content/attrs#aheadport