Search code examples
vis.jsvis.js-network

How do I get all edge ids from a cluster


I have a cluster of nodes, and when I select the cluster, I want to extract all the node ids and the edge ids. However, it seems to me that while network.getNodesInCluster retrieves all the nodes, there's no equivalent for edges. I've tried using network.getBaseEdges but it only returns the edge ids from the original edge connected to the cluster. It does not return edges between nodes that are in the cluster.

So, if I have a bunch of nodes in a cluster, and the nodes inside the cluster have edges connecting them together - how do I get a list of all the edges inside the cluster?


Solution

  • One solution is to use network.getNodesInCluster, loop them over and use network.getConnectedEdges to get all connected edges. Make sure to deduct duplicates.