networkx create graph from dataframe
import networkx as nx
G = nx.from_pandas_edgelist(df, 'node_1', 'node_2')
print(G.number_of_nodes())
print(G.number_of_edges())
Are there any code examples left?
New code examples in category Python
import networkx as nx
G = nx.from_pandas_edgelist(df, 'node_1', 'node_2')
print(G.number_of_nodes())
print(G.number_of_edges())