Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to replace names of graph nodes with items from a list knowing that I have multiple lists for multiple graphs. So the nodes will change i.e. the list.

What I have tried:

Python
import matplotlib.pyplot as plt
   import networkx as nx
   G = nx.from_numpy_array(x)
   #G.add_nodes_from(new_list)

   nx.draw(G,node_size=500,arrowsize=200,node_color='green', edge_color='red',font_size=10, with_labels=True)
   plt.show()
   print("number of edges is:",G.number_of_edges())
   print("number of nodes is:",G.number_of_nodes())
Posted
Updated 26-Apr-22 9:05am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900