erikbrinkman / d3-dag

Layout algorithms for visualizing directed acyclic graphs
https://erikbrinkman.github.io/d3-dag/
MIT License
1.45k stars 87 forks source link

coordVert throws error #31

Closed luxzeitlos closed 4 years ago

luxzeitlos commented 4 years ago

I get

Error: matrix D in quadratic function is not positive definite!
erikbrinkman commented 4 years ago

This is indeed a bug. Likely the set of equations I picked for the "vert" layout is not actually consistent. Can you post either the graph that caused it, or more preferably a minimum throwing example?

luxzeitlos commented 4 years ago

I think it happens as soon I pass two totally independent nodes. So this is the minimal example I could find that throws:

const hierarchy = dagHierarchy();
let b = { id: '2', children: [] };
let a = { id: '1', children: [] };
const dag = hierarchy(a, b);

const sug = sugiyama();
sug.coord(coordVert());
sug(dag)
erikbrinkman commented 4 years ago

Yeah, that makes sense. Unfortunately support for unconnected DAGs is only half there. If you need to use coordVert, you should manually break them up.

The only real appropriate fix is to break them up into connected dags, run coordVert, then paste them back together. I'll keep this post open as a reminder to do that, but in the meantime, just break the dag appart manually.

erikbrinkman commented 4 years ago

This is ultimately a duplicate of #43 which I think better captures the intent. I'm actively working on this, so hopefully this will be resolved soon.

erikbrinkman commented 4 years ago

Duplicate of #43