I want to set the color of all edges that are attached to a selected node, so that each time a user selects a node any edges that the node is either a source or target of will be a different color. What would the selector look like for this, or is it not possible?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can't just use a selector, because you need a small graph traversal in addition to the initial filter, e.g.: cy.$('node:selected').neighborhood('edge')
; i.e. for selected nodes get all connected edges
Or cy.$('node:selected').connectedEdges()