import networkx as nx
import igraph as ig
# networkx转igraph
g = nx.karate_club_graph()
d = nx.to_pandas_edgelist(g).values
g = ig.Graph(d)#igraph转networkx
t =[str(e[0])+" "+str(e[1])for e in g.get_edgelist()]
f = nx.parse_adjlist(t)print(f.nodes)
networkx与igraph之间转换import networkx as nximport igraph as ig# networkx转igraph g = nx.karate_club_graph()d = nx.to_pandas_edgelist(g).valuesg = ig.Graph(d)#igraph转networkxt = [str(e[0])+" "+str(e[1]) for e in g.get_edgelist()]f = nx.parse_adjlist(t)