dagre
dagre copied to clipboard
Why do these edges cause errors?
Very apologies if this has been asked before somewhere. I did look for a similar issue.
I'm trying to understand how dagre works behind the scenes, the math and formulation and that, in the hopes that I might understand why the following graph(s) fail:
// Set the nodes
g.setNode('a', {
label: 'A'
});
g.setNode('b', {
label: 'B'
});
g.setNode('c', {
label: 'C'
});
g.setNode('d', {
label: 'D'
});
// Set the parents
g.setParent('b', 'a');
g.setParent('c', 'b');
// These edges cause errors:
//g.setEdge('a', 'b');
//g.setEdge('a', 'c');
//g.setEdge('a', 'd');
//g.setEdge('b', 'c');
//g.setEdge('a', 'a');
//g.setEdge('b', 'b');
// These edges don't cause errors
//g.setEdge('c', 'd');
//g.setEdge('d', 'c');
//g.setEdge('c', 'c');
//g.setEdge('d', 'd');
Here is a jsfiddle to demonstrate, just uncomment an edge that causes an error.
Any insights anyone has to offer would be appreciated. I'm interested in learning how dagre works from theory up if I have to to solve this. And if I do solve it I would happily contribute the fix.
Thanks!