[Top][All Lists]

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

Re: [igraph] python: Graph.add_edges too slow

From: Gábor Csárdi
Subject: Re: [igraph] python: Graph.add_edges too slow
Date: Mon, 29 Jun 2009 14:38:10 +0200


add_edges takes the same time, irrespectively of the number of edges
you add. More precisely the time complexity is O(|V|+|E|), where (V,E)
is the new, extended graph. So the solution is to add all edges at the
same time, in one go.


On Mon, Jun 29, 2009 at 2:31 PM, Davide Setti<address@hidden> wrote:
> Hi all,
> i'm trying to create a network with python-igraph. While the import
> functions (like pajek or dot) are very fast, the creation "from
> scratch" of the network is really slow. By profiling my code with the
> cProfile module i see the bottleneck is the add_edges function. I
> think the problem is the size of the network. You can find a simple
> test code here:
> http://github.com/vad/network-libraries-test/blob/2d4fff545655d1abb3622dc15478b3df0d607841/igraph-add-edge.py
> This takes 17m on my core2duo, while the import of a 130k nodes/400k
> edges .dot only takes a few seconds.
> I think there should be a solution, because of the fast import
> functions. Maybe these functions can disable some checks?
> (i'm using a trunk version of 2 weeks ago)
> Regards.
> --
> Davide Setti
> blog: http://blog.flatlandia.eu
> home: http://www.flatlandia.eu
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

Gabor Csardi <address@hidden>     UNIL DGM

reply via email to

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