[graph-tool] Load graph from csv
kenanhuremovic at gmail.com
Sat Jun 27 18:08:22 CEST 2015
I'm loading directed weighted graph from csv file into graph-tool graph
graph. The organization of the input csv file is:
Where the fist two entries of a line identify source and target of an edge
and the third number is the weight of the edge.
Currently I'm using:
g = gt.Graph()
e_weight = g.new_edge_property("float")
f_network = open(in_file_directory+ '/'+network_input, 'r')
reader_network = csv.reader(f_network, delimiter=delimiter)
for edge in reader_network:
e = g.add_edge(int(edge), int(edge))
e_weight[e] = float(edge)
However it takes quite long to load the data (I have network of 10 millions
of nodes). I have tried to make it faster by using g.add_edge_list, but this
works only for unweighted graphs. Any suggestion how to make it faster?
View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Load-graph-from-csv-tp4026193.html
Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
More information about the graph-tool