Given an edge, i'm trying to find what nodes are affected by it

36 views Asked by At

I'm working on writing a network graph visualization with Sigma and Graphology. I'm adding some filtering logic and following the examples found here: https://codesandbox.io/p/sandbox/github/jacomyal/sigma.js/tree/main/examples/use-reducers?file=/index.ts

I've implemented the edgeReducer, basically unaltered, from the example code. I've dropped a debugger; statement in the edge reducer and for the life of me, I'm trying to figure out an efficient way of identifying what nodes a given edge connects. My ultimate goal is to hide edges who's nodes are hidden.

When I get to the debugger line, the edge reducer lamda is called with 'edge' and 'data' are populated thusly: edge: geid_57_0 data: {}

I kind of assumed there'd be a getter for an edge given it's key - which I assume is the 'edge' param (geid_57_0) but after reading the docs, I can't find a way to get an edge from the graph by that key? is there a mis-match between sigma's keys and graph's keys for edges? I have a isNodeVisible method so I my (maybe wrong?) approach was to get the edge and check to see if source or target were both visible...

Graph has 10k nodes and 30k edges, so if there's a better way of doing this, I'm all ears...

0

There are 0 answers