Return the graph adjacency matrix as a NumPy recarray.
Parameters : | G : graph
nodelist : list, optional
dtype : NumPy data-type, optional
order : {‘C’, ‘F’}, optional
|
---|---|
Returns : | M : NumPy recarray
|
Notes
When does not contain every node in , the matrix is built from the subgraph of that is induced by the nodes in .
Examples
>>> G = nx.Graph()
>>> G.add_edge(1,2,weight=7.0,cost=5)
>>> A=nx.to_numpy_recarray(G,dtype=[('weight',float),('cost',int)])
>>> print(A.weight)
[[ 0. 7.]
[ 7. 0.]]
>>> print(A.cost)
[[0 5]
[5 0]]