📜  将 networkx 图转换为数据框 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:36.325000             🧑  作者: Mango

代码示例1
# Get G egdes to dataframe
edge_df = nx.to_pandas_edgelist(G) 

# Transform networkx nodes to dataframe
nodelist = list(G.nodes(data=True)) # From G to list
node_df = pd.DataFrame(nodelist, columns=['vertex', 'name_attribute']) # From list to DF