igraph-help
[Top][All Lists]
Advanced

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

[igraph] Efficiently selecting a node in python igraph


From: Tim Althoff
Subject: [igraph] Efficiently selecting a node in python igraph
Date: Fri, 9 May 2014 17:28:28 -0700

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

reply via email to

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