Python Forum
Convert np Array A to networkx G - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Convert np Array A to networkx G (/thread-40285.html)



Convert np Array A to networkx G - IanAnderson - Jul-05-2023

Hi,

I am trying to convert the np array A to networkx G. I have the code "G = nx.from_numpy_array(A)" but I don't know if I need to do anything else to convert array A.

Thanks,
Ian


RE: Convert np Array A to networkx G - Gribouillis - Jul-05-2023

(Jul-05-2023, 02:34 AM)IanAnderson Wrote: I have the code "G = nx.from_numpy_array(A)"
That's what the documentation is for. It tells you that the numpy array is interpreted as an adjacency matrix.


RE: Convert np Array A to networkx G - IanAnderson - Jul-05-2023

Ok, thank you