Cytoscape.js - selector for edges attached to selected node

社会主义新天地 提交于 2019-12-10 13:46:29

问题


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()



来源:https://stackoverflow.com/questions/27696950/cytoscape-js-selector-for-edges-attached-to-selected-node

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!