Hello, Simply use g.es[g.get_eid(source.index, target.index)]; g.es.find() does a linear scan of all the edges, while g.get_eid() uses a faster lookup.
Best, T. On Thu, Jul 14, 2016 at 8:57 PM, Jack Zellweger <[email protected]> wrote: > Hello all, > > The Problem: > I am having trouble with program execution speed on a Python implementation > of igraph. I import a complete weighted graph of 4268 nodes, and 9105778 > edges into a variable g. My program executes quickly and efficiently, but > get stopped up when the function g.es.find() is executed. > > Code Snippet: > Here's an example of the bottleneck... > > source = g.vs.find(name='1234') > > target = g.vs.find(name='3456') > > # This function call takes ~2 seconds > > neighborEdge = g.es.find(_source=source.index, _target=target.index) > > > This last line of code alone takes about 2 seconds, where as all the other > lines of code execute in an instant. > > The Question: > Is there a faster way identify and set an edge between two nodes equal to > the variable neighborEdge? This implementation takes too long with this huge > graph I'm handling. Any help is greatly appreciated. Thanks so much for your > time. > > Best, > Jack Zellweger > LIGO Research > Kenyon College > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help > _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
