iVis-at-Bilkent / cytoscape.js-fcose

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

Overlapping compound nodes #48

Open gverger opened 3 years ago

gverger commented 3 years ago

Hello, thanks for the work, it is very nice to have a good looking layout algorithm for our graphs 👍

Problem

I have a problem with compound nodes. When there are few of them, or few edges, fcose seems to behave correctly. However there are 2 cases where I see problems and I would like to know if it is a bug in the algorithm, or if it is not supposed to be handled:

I am working with graphs where we group nodes into compound nodes, and only inner components have edges.

For the first case, here is a video of the demo at https://ivis-at-bilkent.github.io/cytoscape.js-fcose/demo/demo-constraint.html where I upload a graph:

https://user-images.githubusercontent.com/6671307/127189337-f80f18c9-a664-486c-af0d-0f72107a00ca.mov

First I launch fcose, which seems to perform well. And then I lock the node L and run fcose: here the layout is strange: unrelated compound nodes overlap, nodes are ordered diagonally etc..

For the second case, even when not locking one node, the algorithm seems to not take compound nodes into account at all. Here is the result I get.

Capture d’écran 2021-07-27 à 18 17 46

Expectation

I would expect the compound nodes to not overlap at all.

Files

Both graphs (in json format) are available here: graphs.zip

hasanbalci commented 3 years ago

@gverger Thanks for noticing us about the problems.

For the second case, handling compound overlaps in that graph is a hard issue since each compound is densely connected to each other. Compound nodes try to repel each other, but those dense edge connections doesn't allow that and try to keep nodes very close to each other. In other words, it is expected behavior for such graphs. We may think of further improvements for these kinds of graphs in the future.

For the first case, however, I would also expect a better result, since it's a relatively simple graph and there is only one constraint. I will further investigate this issue and check whether there is a bug or not.

adrianbj commented 2 years ago

Not sure if it helps at all, but I have noticed more issues with overlapping with the latest release. I have returned to an older version (from June 4) and it's significantly better - there is still some overlapping, but much less. Let me know if there is anything else I can provide that might help.

yaxue1123 commented 2 years ago

@adrianbj May I ask the exact older version number with less overlapping? Thanks a lot!

adrianbj commented 2 years ago

@yaxue1123 - sorry, not sure exactly, but I noted above June 4 so presumably it's the version after June 2 in this list: https://github.com/iVis-at-Bilkent/cytoscape.js-fcose/commits/master

kaushikosu commented 1 year ago

I am seeing compound nodes overlapping with other compound nodes and leaf nodes. Version: 2.1.0

image