[Top][All Lists]

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

[igraph] Inconsistency problems with large 19 million edges graph (prope

From: Stefano Scerra
Subject: [igraph] Inconsistency problems with large 19 million edges graph (proper email)
Date: Sun, 5 Apr 2015 19:17:52 +0200

(Sorry for accidentally double posting)
I'm having a really strange problem with the library and I was hoping to get some advice.

After loading a large 19 million edges graph, the library returns an inconsistent edge list.
More precisely, nonexistent edges appear in the graph's edge sequence.

I try to load the graph in two different ways, by using Graph.Read_Ncol, and by manually reading the edgelist and then using Graph.TupleList. In both cases, iterating on the graph's edge sequence (the es attribute) yields inconsistent results: for instance, the nonexisting edge 10->11 is returned.

I'm using igraph 0.7.1-4 on Python 3.4.3 64 bit on Windows 7 SP1 64 bit
Link to the graph: https://drive.google.com/file/d/0B0afrBfsijreOS1BZkVfdE10TlE/view?usp=sharing

Here's the code:
from igraph import Graph
import csv
import timeit

def create_graph(file_graph):
# load graph using Graph.Read_Ncol
with open(file_graph, "r") as in_file:
g = Graph.Read_Ncol(in_file, weights=False, directed=True)
return g

def create_graph2(file_graph):
# load graph using Graph.TupleList
edges = []
with open(file_graph, "r") as in_file:
reader = csv.reader(in_file, delimiter=" ")
i = 0
for row in reader:
if row:
edges.append([int(row[0]), int(row[1])])
i += 1
if i % 100000 == 0: print(i)
return Graph.TupleList(edges=edges, directed=True)

def generate_weighted_graph(input, output):
g = create_graph2(input)
print("ecount:", g.ecount(), "vcount:", g.vcount())
with open(output, "w") as output_file:
writer = csv.writer(output_file, delimiter=" ")
for e in g.es:
i, j = e.source, e.target
writer.writerow([i, j])

if __name__ == "__main__":
generate_weighted_graph("C:/datasets/network", "C:/datasets/network_weighted")

Could this possibly be a bug?
Any help would be appreciated, thank you!

reply via email to

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