0

It appears that compound nodes don't obey layouts if they have connections between other parents, but children do not have connections. Best way to show is to modify their DAGRE example:

http://jsbin.com/gist/e52c2fbc0b09edd6ec46?html,output

by replacing their data with this:

elements: {
nodes: [
{"data":{"id":"SimpleTest"}},
{"data":{"id":"child1","parent":"SimpleTest"}},
{"data":{"id":"child2","parent":"SimpleTest"}},
{"data":{"id":"subParent1"}},
{"data":{"id":"terminal0_socket","parent":"subParent1"}},
{"data":{"id":"subParent2"}},                          
{"data":{"id":"terminal1_socket","parent":"subParent2"}},
{"data":{"id":"terminal0"}},
{"data":{"id":"terminal1"}}
],
edges: [
{"data":{"source":"SimpleTest","target":"subParent1"}},
{"data":{"source":"SimpleTest","target":"subParent2"}},
{"data":{"source":"terminal0_socket","target":"terminal0"}},
{"data":{"source":"terminal1_socket","target":"terminal1"}}
]
},

The links from the children to unparented nodes are honored by the layout, but the links between SimpleTest and the two sub-parents are not.

I've tried running the layout on just the parents by assigning classes and passing layout() the sub-Graph and then just running grid on the remaining nodes, but that doesn't appear to work either.

Is there an example somewhere of how to handle this case? It appears in the two examples on their website (unless I'm mistaken) they're manually setting position for parents.

The only workaround I can see is to add dummy links between children to get the layout to run, and then filter them from the graph / hide them afterwards, but I feel like there's a way to do this I'm not seeing...

Thanks!

1 Answers1

0

Compound graphs are not standard graphs, and so only layouts that explicitly state compound support can be expected to handle special compound cases. Dagre is an external library and has no concept of compounds.

maxkfranz
  • 11,896
  • 1
  • 27
  • 36