cytoscape / ipycytoscape

A Cytoscape Jupyter widget
https://ipycytoscape.readthedocs.io/en/master/
BSD 3-Clause "New" or "Revised" License
264 stars 62 forks source link

Is it possible to set the concentric variable in ipycytoscape? #257

Closed micw42 closed 3 years ago

micw42 commented 3 years ago

In the concentric layout of cytoscape.js, it is possible to put a node in a certain "layer" of the circle through the concentric variable of the layout:

concentric: function( node ){ 
      return node.data("rank");
  }

Here is the cytoscape.js documentation about this

Is there a similar function to this in ipycytoscape? Thank you so much!

ianhi commented 3 years ago

Hi @micw42 good question! I think you're looking for the code in this example: https://github.com/QuantStack/ipycytoscape/blob/master/examples/Concentric%20example.ipynb

The important step is: cytoscapeobj.set_layout(name='concentric')

Hope that works for you!

micw42 commented 3 years ago

Hi @ianhi Thank you for answering my question! Sorry I wasn't being very clear before. I've already donecytoscapeobj.set_layout(name='concentric') I was wondering if there were a way to control which concentric layer a node ends up in? For example, here is the graph I made:

image

Would it be possible to make the red node on the left be in the center? Cytoscape.js allows you to set a function that determines which layer a node is in, so I wonder if this is also possible in ipycytoscape? Thank you so much for your help; I really appreciate it :)

marimeireles commented 3 years ago

Hey @micw42, thanks for opening the issue. I think the reason why you can't do this is the same as: https://github.com/QuantStack/ipycytoscape/issues/238? What do you think? If it is, we can close this issue and keep the discussion centralized in there. For now we don't have a fix! But feel free to add your thoughts and questions there. I can't work on it at the moment but would gladly review a PR if you wanna try it! :) Cheers.

micw42 commented 3 years ago

Hey @marimeireles Yeah, I think it's the same; sorry I didn't see it earlier! Thank you :)

marimeireles commented 3 years ago

No probs! :)