iVis-at-Bilkent / cytoscape.js-fcose

fCoSE: a fast Compound Spring Embedder
MIT License
134 stars 25 forks source link

relativePlacementConstraint with no specified gap #37

Closed josephrocca closed 3 years ago

josephrocca commented 3 years ago

It would be handy (for my use-case, at least) to be able to specify a relative placement constraint without requiring a specific gap:

let relativePlacementConstraint = [{left: 'n1', right: 'n2'}];

For context, I have a graph that looks like this:

image

where the four lower nodes need to be displayed in a specific left-to-right order (based on their node id). So I'm using a relative placement constraint to do that. But I'd like to allow those lower nodes to "spread out" so that when the graph has more nodes and "levels", it doesn't look like this:

image

I need those nodes in the lowest layer to be ordered, and so currently it seems like my best option is to try to develop a rough heuristic for choosing the gap size, but it doesn't seem like that will work well.

I'm not sure if this "unspecified gap" feature would be possible with the current algorithm that underlies this plugin, but I thought I'd drop an issue here in case, at the very least, it's useful to see a use-case where the current options are insufficient. Thanks!

josephrocca commented 3 years ago

Oh! Haha, I just tried removing the gap property and it seems to work! I'll submit a pull request to the readme so that this is documented.