Unable to draw an edge from a child to parent in compound graph
See original GitHub issueHi all,
I am currently using Dagre for one of my data visualisation project, it is a compound graph which requires a node to contain a nested node, I’m unable to draw edges from child nodes to parent nodes, I get the following error:
Uncaught TypeError: Cannot set property ‘rank’ of undefined.
Please also see the below code:
g.setNode('a', {label: 'A'});
g.setNode('b', {label: 'B'});
g.setNode('c', {label: 'C'});
g.setNode('d', {label: 'D'});
g.setNode('top_group', {label: 'Top Group', clusterLabelPos: 'bottom', style: 'fill: #ffd47f'});
g.setNode('bottom_group', {label: 'Group', clusterLabelPos: 'top', style: 'fill: #d3d7e8'});
// Set the parents to define which nodes belong to which cluster
g.setParent('a', 'top_group');
g.setParent('b', 'bottom_group');
g.setParent('c', 'bottom_group');
g.setParent('d', 'bottom_group');
// Draw edges
g.setEdge('a', 'b');
g.setEdge('b', 'c');
g.setEdge('b', 'd');
// Set edge from child to parent
g.setEdge('a', 'bottom_group'); // THIS LINE CAUSES THE ABOVE ERROR
The way how we create a parent is the same as how we create a child node, so the library should allow us to draw an edge from a child node to a parent node.
Please see the following JSFIDDLE: http://jsfiddle.net/thenylify/Lbjm54ob/8/
Can someone please advice?
This is really urgent so can someone please help.
Much appreciated, Thanks, Michael
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:11
Top GitHub Comments
This error is thrown whenever
a
orb
ing.setEdge(a, b)
is a group node.I used d3-graphviz library.