[graph-tool] Computation cost of creating a graph

Giuseppe Profiti gamma2 at users.sourceforge.net
Fri Mar 21 17:03:33 CET 2014

if your primary concern is about speed/code efficiency, I strongly suggest
you to use profilers, either the ones listed in
http://docs.python.org/2/library/profile.html or something else. I
personally like kernprof, you can find out more here


2014-03-21 16:49 GMT+01:00 Hang Mang <gucko.gucko at googlemail.com>:

> Sorry for asking too much questions today about efficiency but it seems
> today is not my lucky day. I'm trying to build a graph by reading from a
> text file. The graph is 1034 vertices with 53498 edges. Creating this graph
> takes 6 seconds, so I was wondering if it truly takes that time or
> something is inefficient in my way of creating the graph. I have a text
> file that contains the edges in the format: vertex_label_x vertex_label_y.
> What I'm doing basically is maintaining a dictionary that maps from
> vertices labels in the text file to graph-tool vertices indices. When I
> read the file, I check if a label is in the dictionary, if so I retrieve
> its index from the dictionary. Otherwise I create a new vertex and store
> its index by the corresponding label in the dictionary. Then I create the
> edge using the indices of the source and target. I was wondering if my way
> is the wrong way to do that.
> This is my code: http://pastie.org/private/n9j7geizaosafmlimujca
> Many thanks in advance!
> Best.
> _______________________________________________
> graph-tool mailing list
> graph-tool at skewed.de
> http://lists.skewed.de/mailman/listinfo/graph-tool
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.skewed.de/pipermail/graph-tool/attachments/20140321/e59ecb37/attachment.htm>

More information about the graph-tool mailing list