'how to convert random generated graph into csv?

G=nx.from_pandas_edgelist(kg_df[kg_df['edge']=="Great for"], "source", "target", edge_attr=True, create_using=nx.MultiDiGraph())

plt.figure(figsize=(16,16)) pos = nx.spring_layout(G, k = 0.5) # k regulates the distance between nodes nx.draw(G, with_labels=True, node_color='skyblue', node_size=150, edge_cmap=plt.cm.Blues, pos = pos) plt.show()



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source