读取.adjlist文件
test.adjlist
a b c #a-b a-c
d e #d-e
读取
import networkx as nx
import matplotlib.pyplot as plt
G = nx.read_adjlist(‘test.adjlist’)
nx.draw(G)
plt.show()
mulitiline-adjlist
a 3 #a-b a-c a-f
b
c
f
d 1 #d-e
e
g1=nx.read_multiline_adjlist(‘test.adjlist’)
nx.draw(g1)
plt.show()
edge list
a b 3 #node-node weight
a c 4
c d 5
e f 6
g = nx.read_weighted_edgelist(‘test.edgelist’)#edges with weighted