plotly / dash-cytoscape

Interactive network visualization in Python and Dash, powered by Cytoscape.js
https://dash.plot.ly/cytoscape
MIT License
608 stars 120 forks source link

Feature Request/Question: yFiles Hierarchic layout #105

Open manihamidi opened 4 years ago

manihamidi commented 4 years ago

First off, thanks for this awesome repo. Was wondering what the best way is to use a yFiles layout in dash-cyto. In particular, I find their hierarchic layout really useful but can't seem to find anything that comes close among the builtins or the "external layouts".

I'm open to any hacks that you would suggest/endorse perhaps using cytoscape's API or py2cytoscape that would facilitate this in the meantime?

Are there any guidelines for how to go about implementing a custom "external layout" somewhere?

Thanks again!

xhluca commented 4 years ago

Hi @manihamidi! yFiles hierarchical layout looks pretty neat! I think there's two ways to approach this:

  1. Write the logic in Javascript, then create a script called yFilesHierachical.js in src/lib. Then, import it in extra_index.js. For an example, see cola.js.
  2. Create a function in Python that can algorithmically generate the coordinate of each node based on nodes/edges specifications. For an example, see usage-phylogeny, and focus on this snippet:

https://github.com/plotly/dash-cytoscape/blob/b18fd799de48a05db8ef704d6024684b9e627771/demos/usage-phylogeny.py#L80-L85