doc/release/release_2.7.rst
.. _networkx_2.7:
Release date: 28 February 2022
Supports Python 3.8, 3.9, and 3.10
NetworkX is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.
For more information, please visit our website <https://networkx.org/>_
and our :ref:gallery of examples <examples_gallery>.
Please send comments and questions to the networkx-discuss mailing list <http://groups.google.com/group/networkx-discuss>_.
This release is the result of 7 months of work with over 166 pull requests by 33 contributors. Highlights include:
.. warning::
Hash values observed in outputs of
~networkx.algorithms.graph_hashing.weisfeiler_lehman_graph_hash
have changed in version 2.7 due to bug fixes. See gh-4946_ for details.
This means that comparing hashes of the same graph computed with different
versions of NetworkX (i.e. before and after version 2.7)
could wrongly fail an isomorphism test (isomorphic graphs always have matching
Weisfeiler-Lehman hashes). Users are advised to recalculate any stored graph
hashes they may have on upgrading.
.. _gh-4946: https://github.com/networkx/networkx/pull/4946#issuecomment-914623654
~networkx.algorithms.approximation.traveling_salesman.asadpour_atsp.~networkx.algorithms.community.louvain.louvain_communities and
~networkx.algorithms.community.louvain.louvain_partitionsnumpy.matrix class, and added a
FutureWarning to all functions that return a numpy.matrix instance.
The numpy.matrix class will be replaced with 2D numpy.ndarray instances
in NetworkX 3.0.scipy.sparse array interface. This includes
~networkx.convert_matrix.to_scipy_sparse_array and
~networkx.convert_matrix.from_scipy_sparse_array. In NetworkX 3.0,
sparse arrays will replace sparse matrices as the primary interface to
scipy.sparse. New code should use to_scipy_sparse_array and
from_scipy_sparse_array instead of their matrix counterparts.
In addition, many functions that currently return sparse matrices now raise
a FutureWarning to indicate that they will return sparse arrays instead in
NetworkX 3.0.~networkx.convert_matrix.to_numpy_array.
This adds support for generic attributes, such as adjacency matrices with
complex weights. This also adds support for generic reduction functions in
handling multigraph weights, such as mean or median. Finally, this
also includes support for structured dtypes, which enables the creation of
multi-attribute adjacency matrices and replaces the less generic
to_numpy_recarray.greedy_modularity_communities.We added the work from four Google Summer of Code projects:
Louvain community detection algorithm_
@z3y50n <https://github.com/z3y50n/>__GSoC 2021: Community Detection Algorithms <https://github.com/networkx/archive/blob/main/proposals-gsoc/GSoC-2021-Community-Detection-Algorithms.pdf>__Asadpour algorithm for directed travelling salesman problem_
@mjschwenne <https://github.com/mjschwenne/>__GSoC 2021: Asadpour algorithm <https://github.com/networkx/archive/blob/main/proposals-gsoc/GSoC-2021-Asadpour-Asymmetric-Traveling%20Salesman-Problem.pdf>__Pedagogical notebook: Directed acyclic graphs and topological sort_
@vdshk <https://github.com/vdshk>__Pedagogical notebooks: Graph assortativity_ & Network flow analysis and Dinitz algorithm_
@harshal-dupare <https://github.com/harshal-dupare/>__.. _Louvain community detection algorithm: https://github.com/networkx/networkx/pull/4929
.. _Asadpour algorithm for directed travelling salesman problem: https://github.com/networkx/networkx/pull/4740
.. _Directed acyclic graphs and topological sort: https://github.com/networkx/nx-guides/pull/44
.. _Graph assortativity: https://github.com/networkx/nx-guides/pull/42
.. _Network flow analysis and Dinitz algorithm: https://github.com/networkx/nx-guides/pull/46
#4740 <https://github.com/networkx/networkx/pull/4740>_]
Add the Asadpour algorithm for solving the asymmetric traveling salesman
problem.#4897 <https://github.com/networkx/networkx/pull/4897>_]
Improve the validation and performance of nx.is_matching,
nx.is_maximal_matching and nx.is_perfect_matching.#4924 <https://github.com/networkx/networkx/pull/4924>_]
Fix handling of disconnected graphs when computing
nx.common_neighbor_centrality.#4929 <https://github.com/networkx/networkx/pull/4929>_]
Add Louvain community detection.#4946 <https://github.com/networkx/networkx/pull/4946>_]
Add Weisfeiler-Lehman hashing subgraph hashing.#4950 <https://github.com/networkx/networkx/pull/4950>_]
Add an n_communities parameter to greedy_modularity_communities to
terminate the search when the desired number of communities is found.#4965 <https://github.com/networkx/networkx/pull/4965>] and
[#4996 <https://github.com/networkx/networkx/pull/4996>]
Fix handling of relabeled nodes in greedy_modularity_communities.#4976 <https://github.com/networkx/networkx/pull/4976>_]
Add betweenness centrality for multigraphs.#4999 <https://github.com/networkx/networkx/pull/4999>_]
Fix degree_assortativity_coefficient for directed graphs.#5007 <https://github.com/networkx/networkx/pull/5007>_]
Add support for directed graphs and multigraphs to greedy_modularity_communities.#5017 <https://github.com/networkx/networkx/pull/5017>_]
Improve implementation and documentation of descendants and ancestors#5019 <https://github.com/networkx/networkx/pull/5019>_]
Improve documentation and testing for directed acyclic graph module.#5029 <https://github.com/networkx/networkx/pull/5029>_]
Improve documentation and testing of descendants_at_distance.#5032 <https://github.com/networkx/networkx/pull/5032>_]
Improve performance of complement_edges.#5045 <https://github.com/networkx/networkx/pull/5045>_]
Add geometric_edges to the nx namespace.#5051 <https://github.com/networkx/networkx/pull/5051>_]
Add support for comment characters for reading data with read_edgelist.#5052 <https://github.com/networkx/networkx/pull/5052>_]
Improve performance and add support for undirected graphs and multigraphs to
transitive_closure.#5058 <https://github.com/networkx/networkx/pull/5058>_]
Improve exception handling for writing data in GraphML format.#5065 <https://github.com/networkx/networkx/pull/5065>_]
Improve support for floating point weights and resolution values in
greedy_modularity_communities.#5077 <https://github.com/networkx/networkx/pull/5077>_]
Fix edge probability in fast_gnp_random_graph for directed graphs.#5086 <https://github.com/networkx/networkx/pull/5086>_]
Fix defect in lowest_common_ancestors.#5089 <https://github.com/networkx/networkx/pull/5089>_]
Add find_negative_cycle for finding negative cycles in weighted graphs.#5099 <https://github.com/networkx/networkx/pull/5099>_]
Improve documentation and testing of binary operators.#5104 <https://github.com/networkx/networkx/pull/5104>_]
Add support for self-loop edges and improve performance of vertex_cover.#5121 <https://github.com/networkx/networkx/pull/5121>_]
Improve performance of *_all binary operators.#5131 <https://github.com/networkx/networkx/pull/5131>_]
Allow edge_style to be a list of styles when drawing edges for DiGraphs.#5139 <https://github.com/networkx/networkx/pull/5139>_]
Add support for the scipy.sparse array interface.#5144 <https://github.com/networkx/networkx/pull/5144>_]
Improve readability of node_classification functions.#5145 <https://github.com/networkx/networkx/pull/5145>_]
Adopt math.hypot which was added in Python 3.8.#5153 <https://github.com/networkx/networkx/pull/5153>_]
Fix multipartite_layout for graphs with non-numeric nodes.#5154 <https://github.com/networkx/networkx/pull/5154>_]
Allow arrowsize to be a list of arrow sizes for drawing edges.#5172 <https://github.com/networkx/networkx/pull/5172>_]
Add a nodes keyword argument to find_cliques to add support for
finding maximal cliques containing only a set of nodes.#5197 <https://github.com/networkx/networkx/pull/5197>_]
Improve resistance_distance with advanced indexing.#5216 <https://github.com/networkx/networkx/pull/5216>_]
Make omega() closer to the published algorithm. The value changes slightly.
The niter parameter default changes from 1->5 in lattice_reference()
and from 100->5 in omega.#5217 <https://github.com/networkx/networkx/pull/5217>_]
Improve performance and readability of betweenness_centrality.#5232 <https://github.com/networkx/networkx/pull/5232>_]
Add support for None edge weights to bidirectional Dijkstra algorithm.#5247 <https://github.com/networkx/networkx/pull/5247>_]
Improve performance of asynchronous label propagation algorithm for
community detection, asyn_lpa_communities.#5250 <https://github.com/networkx/networkx/pull/5250>_]
Add generic dtype support to to_numpy_array.#5285 <https://github.com/networkx/networkx/pull/5285>_]
Improve karate_club_graph by updating to the weighted version from the original
publication.#5287 <https://github.com/networkx/networkx/pull/5287>_]
Improve input validation for json_graph.#5288 <https://github.com/networkx/networkx/pull/5288>_]
Improve performance of strongly_connected_components.#5324 <https://github.com/networkx/networkx/pull/5324>_]
Add support for structured dtypes to to_numpy_array.#5336 <https://github.com/networkx/networkx/pull/5336>_]
Add support for the numpy.random.Generator interface for random number
generation.~networkx.drawing.layout.rescale_layout_dict are now numpy.ndarray objects
instead of tuples. This makes the return type of rescale_layout_dict
consistent with that of all of the other layout functions.FutureWarning has been added to google_matrix to indicate that the
return type will change from a numpy.matrix object to a numpy.ndarray
in NetworkX 3.0.FutureWarning has been added to attr_matrix to indicate that the
return type will change from a numpy.matrix object to a numpy.ndarray
object in NetworkX 3.0.is_*_matching functions now raise exceptions for nodes not in G in
any edge.#5055 <https://github.com/networkx/networkx/pull/5055>_]
Deprecate the random_state alias in favor of np_random_state#5114 <https://github.com/networkx/networkx/pull/5114>_]
Deprecate the name kwarg from union as it isn't used.#5143 <https://github.com/networkx/networkx/pull/5143>_]
Deprecate euclidean in favor of math.dist.#5166 <https://github.com/networkx/networkx/pull/5166>_]
Deprecate the hmn and lgc modules in node_classification.#5262 <https://github.com/networkx/networkx/pull/5262>_]
Deprecate to_scipy_sparse_matrix and from_scipy_sparse_matrix in
favor of to_scipy_sparse_array and from_scipy_sparse_array, respectively.#5283 <https://github.com/networkx/networkx/pull/5283>_]
Deprecate make_small_graph and make_small_undirected_graph from the
networkx.generators.small module.#5330 <https://github.com/networkx/networkx/pull/5330>_]
Deprecate to_numpy_recarray in favor of to_numpy_array with a
structured dtype.#5341 <https://github.com/networkx/networkx/pull/5341>_]
Deprecate redundant info.A total of 166 changes have been committed.
comments=None in read/parse edgelist (#5051)random_state decorator (#5055)geometric_edges and add it to main namespace (#5045)trophic_levels documentation (#5087)transitive_closure (#5052)hmn and lgc modules from the node_classification package (#5166)google_matrix (#5219)np.matrix cleanups (#5218)close fn with math.isclose. (#5224)to_numpy_array with advanced indexing (#5250)O(|E|+|V|) time complexity instead of O(|V|^3). (#5288)__all__ but not in docs for NX2.7 (#5289)attr_matrix to notify users of return type change (#5300)make_small_graph and make_small_undirected_graph (#5283)draw_<layout> docstrings with usage examples (#5264)numpy.random.Generator (#5336)to_numpy_array (#5324)to_numpy_recarray (#5330)