xflr6 / graphviz

Simple Python interface for Graphviz
https://graphviz.readthedocs.io
MIT License
1.65k stars 213 forks source link

Connecting to subgraphs only works using fdp engine #147

Closed NAThompson closed 3 years ago

NAThompson commented 3 years ago

Beginning with the fdp cluster example, we see that we can attach edges to subgraphs. In the example, this figure is produced:

Screen Shot 2021-11-10 at 12 59 02

However, the same code with the default engine, i.e., replacing

g = graphviz.Graph('G', filename='fdpclust.gv', engine='fdp')

with

g = graphviz.Graph('G', filename='fdpclust.gv')

produces a completely different graph:

Screen Shot 2021-11-10 at 12 57 57

Should an error be thrown in this case?

xflr6 commented 3 years ago

From the upstream source of the example, I think yes: cluster-to-cluster edges seem to be specific to the fdp engine:

The fdp layout program supports edges between nodes and clusters and cluster-to-cluster.

From https://graphviz.org/docs/attrs/compound/ I understand that dot supports related node-to-node edges that 'end early' on a cluster with compound=true.

Should an error be thrown in this case?

You might want to ask about this upstream, e.g. in https://forum.graphviz.org (mildly related upstream issue), closing.