viz-js icon indicating copy to clipboard operation
viz-js copied to clipboard

unflatten support

Open dudarboh opened this issue 7 months ago • 2 comments

Graphviz has this feature for dealing with very long/wide graphs called unflatten https://www.graphviz.org/pdf/unflatten.1.pdf

Is it possible to call it somehow through the viz-js?

dudarboh avatar May 08 '25 11:05 dudarboh

Not possible currently. This sounds like an interesting feature, so I'll keep it in mind for a future version. Thank you for the suggestion.

mdaines avatar May 08 '25 19:05 mdaines

@dudarboh at the risk of stating the obvious, note that while it may not currently be feasible to invoke unflatten as a preprocessor directly within viz-js, FWIW there are some graph-local parameters and constructs that may (with varying degrees of manual intervention) help you achieve similar results.

The ratio attribute should in theory offer one way to influence this, but doesn't seem to work as well as one might hope in all cases. Alternatively, if it is practical to do some manual "tweaking" of the specific graph or class of graphs that you're rendering, there's always the "brute-force" option of using some combination of rank=same, constraint=false, grouping, hidden edges, etc. to influence the layout.

Neither of those are a great general-purpose solution (maybe as demonstrated by the ongoing existence of unflatten in the first place), but I thought I'd mention it just in case it's helpful to you or someone else that comes across this issue.

rodw avatar May 17 '25 21:05 rodw