igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] efficiency


From: zhengjun chen
Subject: Re: [igraph] efficiency
Date: Mon, 30 Nov 2009 08:54:47 -0500

Yeah, I first put all edge into a list (link information is stored in a .txt file, read the file to add edges into a list), then call add_edges() to add edges in a batch.
As I said before, it is slow because list operation in python is very slow when the list becomes large.

On Mon, Nov 30, 2009 at 7:53 AM, Tamas Nepusz <address@hidden> wrote:
> 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.

--
Tamas



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



--
Thanks
zhengjun

Graduate research assistant
Dept of Computer Science and Engineering
Lehigh University

reply via email to

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