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

elkjs, external layout algorithms? #92

Closed tunesmith closed 1 year ago

tunesmith commented 2 years ago

Hi, I'm not sure if this question makes sense for this type of project, but do you have plans to plug in external layout algorithms like kieler/elkjs? I've previously moved from a dagre-d3 project to a cytoscape.js project that uses elk, and now I'm investigating libraries again.

I'm under the impression elk is an advancement compared to sugiyama, but truth be told, I am not sure I noticed much of a clear difference between the two algorithms in the graphs I'm animating. So I was just curious - since both sprotty and cytoscape pull in external algorithms I wondered if that was a goal for you too.

erikbrinkman commented 2 years ago

Sorry for the delay in responding this. I've been busy with lots of other things.

I think I'm a little confused by what you're asking in terms of plugging in external layout algorithms. All this library does is create a layout, e.g. assign nodes and edges control points. I don't see a huge point in supporting other layouts in the library given that it's only purpose is to takes nodes and edges and assign points to them.

That's not to say that it's not configurable:

  1. There are actually three layout types in the library. Two topological layouts, and sugiyama.
  2. Sugiyama is based off of the original sugiyama paper, but it's probably more genuine to call it a layered algorithm like elk seems to use.
    • This layout algorithm itself is customizable. Each step in the process supports its own callback, so you could swap any piece out
    • Currently d3-dag has no support for ports, although I'm working on something potentially similar.
    • Also, elk seems to allow groups and variable "height" nodes. These are two long standing issues with d3-dag that I might be able to address soon, but currently aren't supported.
    • In terms of the straight lines with jumps that elk seems to prefer, that should be configurable with default settings, but different thresholds on the simplex coordinate assignment step, and manually treating the control points a bit differently.

However, maybe I misunderstood what you were asking?