summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Barnowski <rossbar@berkeley.edu>2021-06-23 00:48:30 +0300
committerGitHub <noreply@github.com>2021-06-22 17:48:30 -0400
commit196194b7e04d3e7fe8d7d11a8f929c437274f6e4 (patch)
tree326e4b4890c2e33116ee7db1263fd6681b4b3e41
parent61688295e63cec163e0c17cfa29383822f00cf19 (diff)
downloadnetworkx-196194b7e04d3e7fe8d7d11a8f929c437274f6e4.tar.gz
Deprecate numeric_mixing_matrix. (#4923)
* Deprecate numeric_mixing_matrix. * Add deprecation to release notes.
-rw-r--r--doc/developer/deprecations.rst1
-rw-r--r--doc/release/release_dev.rst2
-rw-r--r--networkx/algorithms/assortativity/mixing.py12
-rw-r--r--networkx/conftest.py3
4 files changed, 18 insertions, 0 deletions
diff --git a/doc/developer/deprecations.rst b/doc/developer/deprecations.rst
index 1749ab41..c222f620 100644
--- a/doc/developer/deprecations.rst
+++ b/doc/developer/deprecations.rst
@@ -88,3 +88,4 @@ Version 3.0
* Remove ``testing``.
* In ``linalg/graphmatrix.py`` remove ``adj_matrix``.
* In ``algorithms/similarity.py`` replace ``simrank_similarity`` with ``simrank_similarity_numpy``.
+* In ``algorithms/assortativity/mixing.py`` remove ``numeric_mixing_matrix``.
diff --git a/doc/release/release_dev.rst b/doc/release/release_dev.rst
index 13db1dd2..07db238b 100644
--- a/doc/release/release_dev.rst
+++ b/doc/release/release_dev.rst
@@ -252,6 +252,8 @@ Deprecations
Deprecate ``adj_matrix``.
- [`#4841 <https://github.com/networkx/networkx/pull/4841>`_]
Deprecate ``simrank_similarity_numpy``.
+- [`#4923 <https://github.com/networkx/networkx/pull/4923>`_]
+ Deprecate ``numeric_mixing_matrix``.
Contributors
------------
diff --git a/networkx/algorithms/assortativity/mixing.py b/networkx/algorithms/assortativity/mixing.py
index 3048c80b..3a234d33 100644
--- a/networkx/algorithms/assortativity/mixing.py
+++ b/networkx/algorithms/assortativity/mixing.py
@@ -212,6 +212,11 @@ def degree_mixing_matrix(
def numeric_mixing_matrix(G, attribute, nodes=None, normalized=True, mapping=None):
"""Returns numeric mixing matrix for attribute.
+ .. deprecated:: 2.6
+
+ numeric_mixing_matrix is deprecated and will be removed in 3.0.
+ Use `attribute_mixing_matrix` instead.
+
Parameters
----------
G : graph
@@ -244,6 +249,13 @@ def numeric_mixing_matrix(G, attribute, nodes=None, normalized=True, mapping=Non
m: numpy array
Counts, or joint, probability of occurrence of node attribute pairs.
"""
+ import warnings
+
+ msg = (
+ "numeric_mixing_matrix is deprecated and will be removed in v3.0.\n"
+ "Use `attribute_mixing_matrix` instead."
+ )
+ warnings.warn(msg, DeprecationWarning, stacklevel=2)
return attribute_mixing_matrix(
G, attribute, nodes=nodes, normalized=normalized, mapping=mapping
)
diff --git a/networkx/conftest.py b/networkx/conftest.py
index 434ff746..68dd1dda 100644
--- a/networkx/conftest.py
+++ b/networkx/conftest.py
@@ -41,6 +41,9 @@ def pytest_collection_modifyitems(config, items):
@pytest.fixture(autouse=True)
def set_warnings():
warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="numeric_mixing_matrix"
+ )
+ warnings.filterwarnings(
"ignore", category=DeprecationWarning, message=r"Ordered.* is deprecated"
)
warnings.filterwarnings(