AlrasheedA / st-link-analysis

A custom Streamlit component for link analysis, built with Cytoscape.js and Streamlit.
https://pypi.org/project/st-link-analysis/
MIT License
54 stars 6 forks source link

Selected layout changes when using node expansion feature #29

Open TkacheO opened 2 months ago

TkacheO commented 2 months ago

Describe the bug When using the node expansion feature the user defined layout is reverted to a default preset layout (I think it is the "cose" layout from cytoscape).

To Reproduce Steps to reproduce the behavior:

  1. Go to the demo app, section node_actions: https://st-link-analysis-demo.onrender.com/node_actions
  2. Selection "gird" layout in dropdown menu under "Try with different layouts"
  3. Remove node(s). Layout is still "gird"
  4. Double click a node to expand. Layout of the graph is not "gird" anymore but is reverted to the default layout settings.

Expected behavior I would have expected that the layout would stay as specified by the user, e.g., "gird" , after expanding nodes. I can understand that maybe the initial position of the nodes in the specified layout may change after expansion but the general layout structure would stay the same, e.g., grid.

Screenshots Initial grid layout: image

Same layout setting after node removal. Layout is still grid: image

Same layout setting after node exanpsion. Layout is not gird anymore: image

Additional context I am not sure if it is intended that the gird layout changes after expasion or not. However, for larger graphs it is a bit confusing that the layout jumps, e.g., from grid to cose. Which makes analysing the graphs harder. Thank you for adding the fucntionality that enables node expansion and removal. I think its great and have been looking for something similar.

dariodata commented 2 months ago

I've also experience the same issue. When choosing any other layout, it reverts back to the default layout after expanding a node.

Thank you for this component!