cytoscape js遍历节点的选择

时间:2019-05-28 14:36:09

标签: javascript cytoscape.js

如何根据选择器遍历cytoscape js网络中的节点?

我知道我可以使用

cy.filter(".myselector")

返回一个复杂的对象,如:

0: ua {0: ua, length: 1, _private: Object, instanceString: function, spawn: function, spawnSelf: function, …}

1: ua {0: ua, length: 1, _private: Object, instanceString: function, spawn: function, spawnSelf: function, …}

2: ua {0: ua, length: 1, _private: Object, instanceString: function, spawn: function, spawnSelf: function, …}

_private: {cy: Wa, map: Map}

length: 3

1 个答案:

答案 0 :(得分:1)

这是我开发的用于基于选择器遍历图的方法(并获得感兴趣的元素,在我的情况下为节点的名称)

NB注意如何检索名称,即 _private.data.name

-std