Getting List Of Edges In Cytoscape.js When Clicking On A Node
I'm trying to create a cytoscape.js graph in which clicking on a node will change the color of any edges connecting to the node. I've been able to locate individual components but
Solution 1:
You don't need to return the edges from the event handler, you can just do the coloring immediately in the event handler, something like this:
cy.on("tap", "node", (evt) => {
evt.cyTarget.connectedEdges().animate({
style: {lineColor: "red"}
})
})
Solution 2:
Use nodes.connectedEdges()
to get the edges connected to a node : http://js.cytoscape.org/#nodes.connectedEdges
Post a Comment for "Getting List Of Edges In Cytoscape.js When Clicking On A Node"