Cytoscape.js - selector for edges attached to the selected node

I want to set the color of all the edges attached to the selected node, so that every time the user selects the node, any edges that the node is either a source or a target object will have a different color. What would this selector look like for this, or is it impossible?

+4
source share
1 answer

You can not just use the selector, because you need a small round schedule in addition to the initial filter, for example cy.$('node:selected').neighborhood('edge'); that is, for the selected nodes get all the connected edges

Or cy.$('node:selected').connectedEdges()

+5
source

Source: https://habr.com/ru/post/1569352/


All Articles