summaryrefslogtreecommitdiff
path: root/networkx/convert_matrix.py
diff options
context:
space:
mode:
authorDan Schult <dschult@colgate.edu>2019-10-10 10:40:26 -0400
committerJarrod Millman <jarrod.millman@gmail.com>2019-10-12 09:26:31 -0700
commita3a896b6568443bae692bc7e907a07df5939068a (patch)
tree948d50bcc1415456391e4beff662b582b4255587 /networkx/convert_matrix.py
parentcff8cfdd398d17c80ac21b2515414d7b4c9c200b (diff)
downloadnetworkx-a3a896b6568443bae692bc7e907a07df5939068a.tar.gz
Changes to convert_matrix and others that depend on np.matrix
Diffstat (limited to 'networkx/convert_matrix.py')
-rw-r--r--networkx/convert_matrix.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/networkx/convert_matrix.py b/networkx/convert_matrix.py
index 5398e1dd..16f986f0 100644
--- a/networkx/convert_matrix.py
+++ b/networkx/convert_matrix.py
@@ -424,10 +424,10 @@ def to_numpy_matrix(G, nodelist=None, dtype=None, order=None,
>>> G = nx.Graph([(1, 1)])
>>> A = nx.to_numpy_matrix(G)
>>> A
- array([[1.]])
+ matrix([[1.]])
>>> A[np.diag_indices_from(A)] *= 2
>>> A
- array([[2.]])
+ matrix([[2.]])
Examples
--------
@@ -441,7 +441,7 @@ def to_numpy_matrix(G, nodelist=None, dtype=None, order=None,
>>> G.add_edge(2, 2)
1
>>> nx.to_numpy_matrix(G, nodelist=[0, 1, 2])
- array([[0., 2., 0.],
+ matrix([[0., 2., 0.],
[1., 0., 0.],
[0., 0., 4.]])
@@ -451,9 +451,8 @@ def to_numpy_matrix(G, nodelist=None, dtype=None, order=None,
A = to_numpy_array(G, nodelist=nodelist, dtype=dtype, order=order,
multigraph_weight=multigraph_weight, weight=weight,
nonedge=nonedge)
- return A
-# M = np.asmatrix(A, dtype=dtype)
-# return M
+ M = np.asmatrix(A, dtype=dtype)
+ return M
def from_numpy_matrix(A, parallel_edges=False, create_using=None):