[Top][All Lists]

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

Re: [igraph] efficiency

From: Tamas Nepusz
Subject: Re: [igraph] efficiency
Date: Mon, 30 Nov 2009 12:53:04 +0000

> Hmmmm, I think the reason why Igraph python is slow is list operation in 
> python.
> When using Igraph python, I put the edge information (it is stored in a .txt 
> file) into a list, then call add_edges() function to add edges in the list to 
> graph. If the graph grows large (i.e. more than 100,000 edges)
> It becomes very slow to add these edges into graph. 
> If you have a better way to add edges into graph, and thus to reduce the 
> time, please tell me.
The add_edges() operation in igraph is O(|V|+|E|), where |V| is the number of 
vertices and |E| is the number of edges in the new, extended graph. This means 
that if you add edges one by one to an igraph graph, it will be much slower 
than adding them once in a batch. This applies to the C core and all the higher 
level interfaces as well. If you add all your edges at once with a single call 
to add_edges(), you are doing it pretty much as fast as possible. However, if 
you are adding edges one by one, consider rewriting your loading routine to 
call add_edges() less frequently.


reply via email to

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