[graph-tool-tickets] [graph-tool] Ticket #106: Faster adding of vertices

graph-tool webmaster at skewed.de
Wed Jul 11 15:43:33 UTC 2012


#106: Faster adding of vertices
new enhancement
---------------------------------------------------------------------
Reporter: oleguer.sagarra at gmail.com
Owner: Ula
Priority: normal
Milestone: (None)
---------------------------------------------------------------------
A manner to add vertices from an adj_list should be added to increase performance, since the for loop needed to add multiple vertices at a time using the python interface is slow.

An idea could be to generate a dot file and then upload it. I did that using networkx (generating a xml file) but there is not much gain in the vertex adding issue...

import graph_tool.all as gt

import networkx as nx

def nx_2_gt(g):

    """ Adds vertices in a faster way using gt """

    q=nx.DiGraph()

    q.add_nodes_from(g.nodes_iter())

    q.add_edges_from(g.edges_iter())

    nx.write_graphml(q,'./dummy.xml')

    g=gt.load_graph('./dummy.xml')

    os.remove('./dummy.xml')




--
Ticket URL: <URL:http://graph-tool.skewed.de/ticket/106>
graph-tool <URL:http://graph-tool.skewed.de/>
An efficient python module for graph analysis and manipulation.


More information about the graph-tool-tickets mailing list