diff options
-rw-r--r-- | INSTALL.rst | 6 | ||||
-rw-r--r-- | networkx/algorithms/bipartite/matrix.py | 2 | ||||
-rw-r--r-- | networkx/convert_matrix.py | 28 | ||||
-rw-r--r-- | networkx/linalg/bethehessianmatrix.py | 2 | ||||
-rw-r--r-- | networkx/linalg/graphmatrix.py | 4 | ||||
-rw-r--r-- | networkx/linalg/laplacianmatrix.py | 4 | ||||
-rw-r--r-- | networkx/linalg/modularitymatrix.py | 4 | ||||
-rw-r--r-- | networkx/linalg/spectrum.py | 6 |
8 files changed, 28 insertions, 28 deletions
diff --git a/INSTALL.rst b/INSTALL.rst index 197edace..6f946396 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -89,9 +89,9 @@ The following optional packages provide additional functionality. See the files in the ``requirements/`` directory for information about specific version requirements. -- `NumPy <http://www.numpy.org/>`_ provides matrix representation of - graphs and is used in some graph algorithms for high-performance matrix - computations. +- `NumPy <http://www.numpy.org/>`_ provides array-based dense + matrix representations of graphs and high-performance array math and linear + algebra which is used in some graph algorithms. - `SciPy <http://scipy.org/>`_ provides sparse matrix representation of graphs and many numerical scientific tools. - `pandas <http://pandas.pydata.org/>`_ provides a DataFrame, which diff --git a/networkx/algorithms/bipartite/matrix.py b/networkx/algorithms/bipartite/matrix.py index b99410e3..5261a911 100644 --- a/networkx/algorithms/bipartite/matrix.py +++ b/networkx/algorithms/bipartite/matrix.py @@ -140,7 +140,7 @@ def from_biadjacency_matrix(A, create_using=None, edge_attribute="weight"): See Also -------- biadjacency_matrix - from_numpy_matrix + from_numpy_array References ---------- diff --git a/networkx/convert_matrix.py b/networkx/convert_matrix.py index 13567e87..e2e717a5 100644 --- a/networkx/convert_matrix.py +++ b/networkx/convert_matrix.py @@ -1,4 +1,5 @@ -"""Functions to convert NetworkX graphs to and from numpy/scipy matrices. +"""Functions to convert NetworkX graphs to and from common data containers +like numpy arrays, scipy sparse matrices, and pandas DataFrames. The preferred way of converting data to a NetworkX graph is through the graph constructor. The constructor calls the to_networkx_graph() function @@ -6,7 +7,7 @@ which attempts to guess the input type and convert it automatically. Examples -------- -Create a 10 node random graph from a numpy matrix +Create a 10 node random graph from a numpy array >>> import numpy as np >>> a = np.random.randint(0, 2, size=(10, 10)) @@ -164,10 +165,10 @@ def from_pandas_adjacency(df, create_using=None): For directed graphs, explicitly mention create_using=nx.DiGraph, and entry i,j of df corresponds to an edge from i to j. - If the numpy matrix has a single data type for each matrix entry it - will be converted to an appropriate Python data type. + If `df` has a single data type for each entry it will be converted to an + appropriate Python data type. - If the numpy matrix has a user-specified compound data type the names + If `df` has a user-specified compound data type the names of the data fields will be used as attribute keys in the resulting NetworkX graph. @@ -703,7 +704,7 @@ def to_numpy_recarray(G, nodelist=None, dtype=None, order=None): Parameters ---------- G : graph - The NetworkX graph used to construct the NumPy matrix. + The NetworkX graph used to construct the NumPy recarray. nodelist : list, optional The rows and columns are ordered according to the nodes in `nodelist`. @@ -726,8 +727,9 @@ def to_numpy_recarray(G, nodelist=None, dtype=None, order=None): Notes ----- - When `nodelist` does not contain every node in `G`, the matrix is built - from the subgraph of `G` that is induced by the nodes in `nodelist`. + When `nodelist` does not contain every node in `G`, the adjacency + matrix is built from the subgraph of `G` that is induced by the nodes in + `nodelist`. Examples -------- @@ -775,7 +777,7 @@ def to_scipy_sparse_matrix(G, nodelist=None, dtype=None, weight="weight", format Parameters ---------- G : graph - The NetworkX graph used to construct the NumPy matrix. + The NetworkX graph used to construct the sparse matrix. nodelist : list, optional The rows and columns are ordered according to the nodes in `nodelist`. @@ -809,11 +811,9 @@ def to_scipy_sparse_matrix(G, nodelist=None, dtype=None, weight="weight", format For multiple edges the matrix values are the sums of the edge weights. - When `nodelist` does not contain every node in `G`, the matrix is built - from the subgraph of `G` that is induced by the nodes in `nodelist`. - - Uses coo_matrix format. To convert to other formats specify the - format= keyword. + When `nodelist` does not contain every node in `G`, the adjacency matrix + is built from the subgraph of `G` that is induced by the nodes in + `nodelist`. The convention used for self-loop edges in graphs is to assign the diagonal matrix entry value to the weight attribute of the edge diff --git a/networkx/linalg/bethehessianmatrix.py b/networkx/linalg/bethehessianmatrix.py index ea999c9b..5b9fe1b0 100644 --- a/networkx/linalg/bethehessianmatrix.py +++ b/networkx/linalg/bethehessianmatrix.py @@ -49,7 +49,7 @@ def bethe_hessian_matrix(G, r=None, nodelist=None): See Also -------- bethe_hessian_spectrum - to_numpy_matrix + to_numpy_array adjacency_matrix laplacian_matrix diff --git a/networkx/linalg/graphmatrix.py b/networkx/linalg/graphmatrix.py index c1a83e99..4de243f9 100644 --- a/networkx/linalg/graphmatrix.py +++ b/networkx/linalg/graphmatrix.py @@ -126,7 +126,7 @@ def adjacency_matrix(G, nodelist=None, weight="weight"): sparse matrix. For MultiGraph/MultiDiGraph with parallel edges the weights are summed. - See to_numpy_matrix for other options. + See `to_numpy_array` for other options. The convention used for self-loop edges in graphs is to assign the diagonal matrix entry value to the edge weight attribute @@ -145,7 +145,7 @@ def adjacency_matrix(G, nodelist=None, weight="weight"): See Also -------- - to_numpy_matrix + to_numpy_array to_scipy_sparse_matrix to_dict_of_dicts adjacency_spectrum diff --git a/networkx/linalg/laplacianmatrix.py b/networkx/linalg/laplacianmatrix.py index c1342131..ea5e029f 100644 --- a/networkx/linalg/laplacianmatrix.py +++ b/networkx/linalg/laplacianmatrix.py @@ -42,7 +42,7 @@ def laplacian_matrix(G, nodelist=None, weight="weight"): See Also -------- - to_numpy_matrix + to_numpy_array normalized_laplacian_matrix laplacian_spectrum """ @@ -91,7 +91,7 @@ def normalized_laplacian_matrix(G, nodelist=None, weight="weight"): Notes ----- For MultiGraph/MultiDiGraph, the edges weights are summed. - See to_numpy_matrix for other options. + See to_numpy_array for other options. If the Graph contains selfloops, D is defined as diag(sum(A,1)), where A is the adjacency matrix [2]_. diff --git a/networkx/linalg/modularitymatrix.py b/networkx/linalg/modularitymatrix.py index e2b8f905..8e8b7e28 100644 --- a/networkx/linalg/modularitymatrix.py +++ b/networkx/linalg/modularitymatrix.py @@ -52,7 +52,7 @@ def modularity_matrix(G, nodelist=None, weight=None): See Also -------- - to_numpy_matrix + to_numpy_array modularity_spectrum adjacency_matrix directed_modularity_matrix @@ -126,7 +126,7 @@ def directed_modularity_matrix(G, nodelist=None, weight=None): See Also -------- - to_numpy_matrix + to_numpy_array modularity_spectrum adjacency_matrix modularity_matrix diff --git a/networkx/linalg/spectrum.py b/networkx/linalg/spectrum.py index 8612e5f4..2855b045 100644 --- a/networkx/linalg/spectrum.py +++ b/networkx/linalg/spectrum.py @@ -32,7 +32,7 @@ def laplacian_spectrum(G, weight="weight"): Notes ----- For MultiGraph/MultiDiGraph, the edges weights are summed. - See to_numpy_matrix for other options. + See to_numpy_array for other options. See Also -------- @@ -63,7 +63,7 @@ def normalized_laplacian_spectrum(G, weight="weight"): Notes ----- For MultiGraph/MultiDiGraph, the edges weights are summed. - See to_numpy_matrix for other options. + See to_numpy_array for other options. See Also -------- @@ -94,7 +94,7 @@ def adjacency_spectrum(G, weight="weight"): Notes ----- For MultiGraph/MultiDiGraph, the edges weights are summed. - See to_numpy_matrix for other options. + See to_numpy_array for other options. See Also -------- |