question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to draw an edge from a child to parent in compound graph

See original GitHub issue

Hi 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:open
  • Created 5 years ago
  • Reactions:4
  • Comments:11

github_iconTop GitHub Comments

4reactions
hastebrotcommented, Mar 28, 2018

This error is thrown whenever a or b in g.setEdge(a, b) is a group node.

1reaction
Polad10commented, Mar 30, 2020

I used d3-graphviz library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dagre.js compound node edge - JSFiddle - Code Playground
This example shows how clusters can be applied to a rendered graph. ... 'bottom_group'); // TRYING TO DRAW AN EDGE FROM CHILD TO...
Read more >
A Layout Algorithm for Undirected Compound Graphs ⋆
Key words: Information visualization, graph drawing, force-directed graph layout, compound graphs, bioinformatics.
Read more >
fCoSE: A Fast Compound Graph Layout Algorithm with ...
It is eminent that a child node is drawn within its parent compound node's ... where edge directions enforce a hierarchy, generally failing...
Read more >
A layout algorithm for undirected compound graphsq - Bilkent
Graph drawing. Force-directed graph layout. Compound graphs. Bioinformatics. a b s t r a c t. We present an algorithm for the layout...
Read more >
In what direction should Graph relationships point?
When building out a graph with vertices and edges, and each edge is ... is this really a graph or a tree? parent-child...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found