Hi,
I'm loading directed weighted graph from csv file into graph-tool graph
graph. The organization of the input csv file is:
1,2,300
2,4,432
3,89,1.24
...
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:
import csv
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[0]), int(edge[1]))
e_weight[e] = float(edge[2])
f_network.close()
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.
_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool