networkx - add features from graph code example
Example: networkx - add features from graph
df = pd.DataFrame(index=G.nodes()) # Use nodes as index
df['node_name'] = pd.Series(nx.get_node_attributes(G, 'name')) # Add attribute
df['clustering'] = pd.Series(nx.clustering(G)) # Calculate lcc
df['degree'] = pd.Series(G.degree()) # Calculate degree