igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Efficiently selecting a node in python igraph


From: Gábor Csárdi
Subject: Re: [igraph] Efficiently selecting a node in python igraph
Date: Fri, 9 May 2014 20:41:46 -0400

Hi,

igraph is optimized for static graphs, so it is (much) better to add all the edges at the same time, if you can do that.

Gabor





On Fri, May 9, 2014 at 8:28 PM, Tim Althoff <address@hidden> wrote:
Hi,

what is the proper way to efficiently select a node in python igraph?

I want to do something like:
- find node object based on keyword attribute
- add new node to graph (add_vertex) [since this returns none I need to "find" the new node obj]
- add edge between both nodes

Currently this is very slow. Any tips?

%timeit g.vs.find(paper_id_eq=paper_id)
%timeit g.add_edge(paper_id_node, new_node)
# G has 20k nodes and 100k edges
10 loops, best of 3: 450 ms per loop
10 loops, best of 3: 84.1 ms per loop


Thanks,
Tim

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help



reply via email to

[Prev in Thread] Current Thread [Next in Thread]