Edge List输入格式
test.edgesa b b c b d c d
g = networkx.read_edgelist("test.edges")
print g.edges()
结果:
[('a', 'b'), ('c', 'b'), ('c', 'd'), ('b', 'd')]
test_adj.txta b b c d c d
邻接表形式
g = networkx.read_adjlist("test_adj.txt")
print edges()
结果:
[('a', 'b'), ('c', 'b'), ('c', 'd'), ('b', 'd')]