cytoscape / cytoscape.js-dagre

The Dagre layout for DAGs and trees for Cytoscape.js
MIT License
245 stars 82 forks source link

Add missing options in dagre layout #83

Closed ethan-keller closed 2 years ago

ethan-keller commented 2 years ago

Dear,

It would be great if you could add the missing dagre options such as e.g., 'align'. They are quite useful and I believe it would make cytoscape.js-dagre more "complete".

I guess you would just need to explicitely specify the options in the layout.js file.

These are the options that are given on dagre's (deprecated) repo wiki:

Object Attribute Default Description
graph rankdir TB Direction for rank nodes. Can be TB, BT, LR, or RL, where T = top, B = bottom, L = left, and R = right.
graph align undefined Alignment for rank nodes. Can be UL, UR, DL, or DR, where U = up, D = down, L = left, and R = right.
graph nodesep 50 Number of pixels that separate nodes horizontally in the layout.
graph edgesep 10 Number of pixels that separate edges horizontally in the layout.
graph ranksep 50 Number of pixels between each rank in the layout.
graph marginx 0 Number of pixels to use as a margin around the left and right of the graph.
graph marginy 0 Number of pixels to use as a margin around the top and bottom of the graph.
graph acyclicer undefined If set to greedy, uses a greedy heuristic for finding a feedback arc set for a graph. A feedback arc set is a set of edges that can be removed to make a graph acyclic.
graph ranker network-simplex Type of algorithm to assigns a rank to each node in the input graph. Possible values: network-simplex, tight-tree or longest-path

Thank you and happy holidays! Ethan

maxkfranz commented 2 years ago

Which options in particular are you interested in? It looks like these are (mostly?) already supported.

ethan-keller commented 2 years ago

Yes most of them are supported. But for example 'align' and 'acyclicer' (which you can find in the table I added to my first issue comment) are not. I would like to have the 'align' attribute in order to specify the alignment of the rank nodes.

maxkfranz commented 2 years ago

Great, so we've narrowed it down to align and acyclicer. Since you have graphs where you'd like to use these options, you're in a great position to test out the addition of those options.

I think you're right that it should just be a matter of passing the options along, so you're welcome to put up a quick PR for your proposed additions