Cytoscape.js-附加到选定节点的边的选择器 [英] Cytoscape.js - selector for edges attached to selected node

查看:412
本文介绍了Cytoscape.js-附加到选定节点的边的选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置连接到选定节点的所有边缘的颜色,以便每次用户选择一个节点时,该节点作为源或目标的任何边缘都将具有不同的颜色。选择器会是什么样子,还是不可能?

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?

推荐答案

您不能只使用选择器,因为除了初始过滤器之外,您还需要进行少量的图形遍历,例如: cy。$('node:selected')。neighborhood('edge');即对于选定的节点,获取所有连接的边缘

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

cy。$('node:selected')。connectedEdges()

这篇关于Cytoscape.js-附加到选定节点的边的选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆