dagre-es icon indicating copy to clipboard operation
dagre-es copied to clipboard

Why do these graphs cause errors?

Open randolchance opened this issue 1 year ago • 2 comments

Very apologies if this has been asked before somewhere. I did look for a similar issue.

I'm trying to figure out why some seemingly basic edges cause errors.

// 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.

There is a package called dagre-cluster-fix on npm, but it did not seem to solve anything. I thought I'd better reach out to the community before I got too deep in trying to discern what dagre-cluster-fix might be doing to try to solve the errors, if indeed that is the error it is designed to solve; the npm page is pretty useless for explaining its function/purpose so I don't yet know.

Any guidance, advice, dagre-related theory, deeper documentation, is very much appreciated! If this is acknowledged as an issue, if it were desirable, I'd be willing to learn the theory behind dagre to try to contribute and solve this issue.

Thanks for your time!

randolchance avatar Aug 28 '23 17:08 randolchance