networkx 3.7#

We’re happy to announce the release of networkx 3.7!

Highlights#

  • The isomorphism checking suite of tools has been upgraded. The VF2++ functions now provide subgraph isomorphism and subgraph monomorphism checking (#8506).

  • Leiden based community detection algorithms are now supported via leiden_communities and leiden_partitions. This provides an alternative, often improved, community detection algorithm compared to the Louvain functions (#8509).

  • The pygraphviz library is now provided via pip with wheels that include the GraphViz binaries. This should make the NetworkX interface to pygraphviz easier to use for graph layout and rendering (#8694).

API Changes#

  • Expire random lobster dep (#8499).

  • API: Expire deprecations of could-be isomorphism aliases (#8498).

  • Proposal to deprecate bfs_predecessors (#8494).

  • Change maximal_independent_set to return set instead of list (#8564).

  • Add centroid as alias to barycenter (#8622).

  • API: Deprecate p2g module (#8855).

Enhancements#

  • Adding the Tree Optimization in Floyd Warshall (#8361).

  • Kruskal MST early break for efficiency (#8296).

  • create new generator that returns a random k-lift of a d-regular graph (#8045).

  • Floyd Warshall: Adding support for weight parameter as a callable (#8386).

  • [ENH] Flow algorithms: Add support for callable capacity parameter (#8406).

  • fix: add suggestions from #8021 and #8029 to is_aperiodic (#8148).

  • Improve chordal code readability by removing helper function (#8479).

  • FEAT: Added basic random walk utilities #8378 (#8383).

  • Implement Constant-Potts Model (for use with Leiden community detection) (#8507).

  • The isomorphism checking suite of tools has been upgraded. The VF2++ functions now provide subgraph isomorphism and subgraph monomorphism checking (#8506).

  • Adding optional sp arg to closeness_centrality (#8424).

  • perf: replace built-in sum() with np.sum() in pagerank and katz (#8561).

  • ENH: Add format parameter to adjacency_matrix (#8545).

  • Proposal: Add density to nx.describe defaults (#8569).

  • Add utility to extract faces from PlanarEmbedding (#8512).

  • Improving views exceptions (#8588).

  • Optimize _build_paths_from_predecessors stack logic for 30-40% speedup (#8460).

  • EHN: Add nonedge argument to from_numpy_array and complete the roundtrip (#8552).

  • State-of-the-art implementation of Tarjan’s algorithm (#8615).

  • Add description and keywords support to GEXF reader/writer (#8629).

  • DOC: more barycenter and centroid equivalence (#8630).

  • ENH: Add Barber’s bipartite modularity quality function (#8618).

  • Leiden based community detection algorithms are now supported via leiden_communities and leiden_partitions. This provides an alternative, often improved, community detection algorithm compared to the Louvain functions (#8509).

  • ENH: Add Shen’s overlapping modularity quality function (#8647).

  • ENH: leiden test and doc_string improvements (#8656).

  • Add butterflies() to bipartite cluster module (#8591).

  • Avoid O(E) lookup in nx.display -issue8639 (#8663).

  • Add HITS algorithm benchmark to benchmark suite (#8625).

  • Add DAG antichain width (#8654).

  • escape tuple labels in generate_gml (#8755).

  • Speed up the residual flow reset in edmonds_karp and simplify the minimum_cut partition (#8756).

  • Avoid building the flow dict in maximum_flow_value (#8754).

  • ENH: add n_samples parameter to rich_club_coefficient for multi-sample averaging (#8721).

  • Simplifying _build_paths_from_predecessors - 10% faster (#8844).

  • {label=Highlight} The isomorphism checking suite of tools has been upgraded. The ISMAGS symmetry aware isomorphism and subgraph isomorphism checking tools now support directed and multigraph Graphs. And, now in addition to support for (induced) subgraph isomorphisms, they support (non-induced subgraph) monomorphism (#8838).

  • ENH: adding magnetic_laplacian_matrix (#8562).

  • ENH: Speed up connectivity checks in random_reference and lattice_reference (#8893).

  • [BUG][PERF] Fix ISMAGS directed matching and monomorphism overhead (#8900).

  • Add: Shrikhande graph (#8884).

Bug Fixes#

  • Bug: Floyd Warshall: resolved self positive loop bug introduced in #8386 (#8425).

  • Bugfix for spring layouts with empty list of fixed nodes (#8446).

  • Fixed diameter/radius error for null graphs (#8454).

  • Floyd warshall: raises error if negative cycle is found (#8440).

  • BUG: fix ISMAGS self-loops error (#8519).

  • Fix cost function in min_weighted_dominating_set (#8531).

  • Fix sparse heuristic not applied to diagonal blocks in stochastic_block_model (#8557).

  • BUG: fix SpanningTreeIterator AttributeError when using next() directly (#8584).

  • Fix all_node_cuts: correct Even-Tarjan reduction for Kanevsky’s algorithm (#8586).

  • fix multigraph isomorphism tests and fix support in ISMAGS and in VF2pp (#8616).

  • BUG: Make argmap._lazy_compile thread-safe (#8659).

  • reject out-of-range bytes in graph6/sparse6 decoders (#8692).

  • Fix: bug with mean degree part of geometric_soft_configuration_model (#8726).

  • Fix k_components losing or truncating k-components (#8734).

  • Fix ISMAGS ignoring matches when graph has extra node/edge colors (gh-8738) (#8800).

  • BUG: reverse the map returned by vf2pp functions (#8813).

  • BUG: Fix node connectivity and node cuts for digraphs (#8837).

  • BUG: Use power iteration as the default HITS implementation (#8620).

  • BUG: group betweenness gives incorrect values for undirected connected graph (#8879).

  • BUG: Group betweenness centrality counts paths incorrectly for directed but not strongly connected (#8880).

  • BUG: Group betweenness skips adjustments if any sigma is zero (#8881).

  • BUG: Handle KeyErrors in directed not strongly-connected group_betweenness_centrality (#8882).

  • BUG: correct normalization of group betweenness centrality when endpoints is true (#8883).

  • [BUG][PERF] Fix ISMAGS directed matching and monomorphism overhead (#8900).

  • BUG: Fix vf2 handling of isomorphism_iter with isolated subgraph nodes (#8895).

  • fix: handle empty candidate sets in ISMAGS.largest_common_subgraph (#8890).

  • BUG: Hold the graph weakly in cached edge and degree views (#8892).

Documentation#

  • Improving FP recommendations (#8381).

  • DOC: add Reporting Views reference page and include in toctree (#8379).

  • Betweenness documentation definitions should match default behavior (#8380).

  • docs: clarify chordal_cycle_graph degree for multigraph vs simple graph (#8396).

  • DOC: dedup graph setup in fp tutorial cells (#8391).

  • Clarify decorator usage in backend implementations (#8384).

  • DOC: Warn that env vars must be set before importing networkx (#8385).

  • Update PGF/TikZ link (#8415).

  • Consolidate reportviews documentation (#8394).

  • Document betweenness normalizations correctly (#8401).

  • DOC: Add nx-guides cross-link to plot_lca example (#8407).

  • DOC: Update link to football data (#8419).

  • Clarify that bfs_predecessors() does not actually search through predecessors (#8445).

  • Add example to filter multiedges in edge_subgraph docstring (#8409).

  • Doc: Add nx_pydot to DOT file documentation (#8433).

  • Adopt scikit-learn’s agentic AI policy (#8468).

  • Clarify a note on graph ordering in graph_atlas_g docstring (#8475).

  • DOC: Update import convention for bipartite docstring examples (#8477).

  • DOC: Use dict(G.degree) in examples (#8490).

  • Fix typo: thrid-party to third-party in tutorial (#8502).

  • Fix: minor typo in docstring (#8532).

  • DOC: Add docstring examples to random_walk (#8535).

  • DOC: first step to add football.zip to examples directory (#8537).

  • DOC: Add football example using url to our own examples github folder (#8538).

  • DOC: Remove Good First Issue references from docs (#8551).

  • DOC: Add note about from_scipy_sparse_array treating zeros as explicit zeros (#8553).

  • Update maximal_independent_set docstring (#8555).

  • Add examples to degree_histogram docstring (#8571).

  • Gallery: Fix and update basic_properties example (#8568).

  • Added example for SpanningTreeIterator to find min spanning trees (#8556).

  • Gallery: Update basic read/write example (#8570).

  • Gallery: split simple graph example into two separate ones (#8567).

  • Fix broken links in quotient_graph docstring and other minor doc warnings (#8598).

  • Gallery: Improve plot_dag example (#8600).

  • Gallery: Improve plot_degree_sequence example (#8601).

  • Enhance has_cycle docstring with usage examples (#8583).

  • DOC: Remove redundant sphinx links (#8607).

  • DOC: clarify lazy exception behavior in topological_sort generator (#8606).

  • Fixed incorrect description of modularity formula for directed graphs (#8609).

  • DOC: clarify remaining readwrite generator docstrings (#8619).

  • DOC: Add note about connectionstyle effectiveness (#8623).

  • DOC: more barycenter and centroid equivalence (#8630).

  • DOC: Add xref to nx-guides to gallery overview (#8650).

  • DOC: Add conference information to visualization in football example (#8655).

  • leiden: fix “wen” + duplicate “the the” in q_add comment (#8662).

  • Fix star graph node count in dual_barabasi_albert_graph comment (#8665).

  • DOC: update to roadmap (#8684).

  • DOC: Clarify degree_centrality behavior for directed graphs (#8674).

  • DOC: Fixups for Leiden docstrings (#8701).

  • DOC: Update install guide (#8725).

  • Louvain updates to docs and code readability (#8722).

  • DOC: Add Hiveplotlib to Drawing Docs and External Examples Gallery (#8714).

  • Clarify attribute behavior in relabel_nodes when multiple nodes map to the same target (#8704).

  • MAINT: update code of conduct form link to match NumFOCUS link (#8729).

  • Warn when PageRank convergence check is ineffective (#8735).

  • DOC: fix lattice_reference niter default (5, not 1) (#8744).

  • Fix typos in comments and docstrings (#8750).

  • DOC: Add example of floating point handling for maximum_flow capacity (#8761).

  • DOC: minor tweaks to biconnected docstring examples (#8765).

  • BUG: fix bfs_successors yielding empty tuple for zero-successor source (#8799).

  • DOC: clarify method=’unweighted’ behavior in all_shortest_paths helpers (#8817).

  • Fix docstring parameters that are not in the signature (#8819).

  • Raise NetworkXError on unknown attribute class in GEXF reader (#8818).

  • DOC: add example of immediate post-dominators (#8824).

  • Fix four docstring parameter names that do not match the signature (#8822).

  • DOC: Add details about steiner tree approxmation for disconnected graphs (#8850).

  • DOC: Fix broken link in leiden_partitions (#8852).

  • DOC: Fixup communicability (#8851).

  • DOC: document bfs_layout raises (#8868).

  • Add and correct ISMAGS method docs (#8856).

  • DOC: Fix write graphml docstring examples (#8873).

  • DOC: Fix edgelist docstring examples (#8876).

  • DOC: Fix TeX docstring examples (#8874).

  • DOC: Fixing adjlist docstring examples (#8875).

  • DOC: Fix gexf docstring examples (#8877).

  • DOC: Fixing bipartite.write_edgelist docstring examples (#8872).

  • DOC: Fix pajek docstring examples (#8888).

  • DOC: Update bipartite.read_edgelist docstring examples (#8887).

  • DOC: Fix multiadjlist docstring examples (#8886).

  • DOC: Fix gml docstring examples (#8894).

  • [BUG][PERF] Fix ISMAGS directed matching and monomorphism overhead (#8900).

  • DOC: Fix Parameters indentation in generate_gexf (#8897).

  • Expose *Matcher classes to get them into the objects inventory (#8903).

Maintenance#

  • Relaxes check for undirected edge node ordering when backends are used for networkx tests (#8376).

  • Revert “pin python 3.14 to be version 3.14.0 until dataclasses are fixed (#8365)” (#8382).

  • MAINT: Single implementation for different returns (#8392).

  • CI: Build docs in parallel (#8344).

  • BENCH: Add minimum spanning tree to benchmarks (#8403).

  • fix: circular_ladder_graph edge cases for n < 2 (#8399).

  • Fix/refactor dag root to leaf (#8437).

  • fix: preserve string positions in to_agraph conversion (Fixes #8203) (#8397).

  • BUG: forceatlas2 layout with nonarray complete initial positions (#8451).

  • Add benchmarks for is_chordal (#8462).

  • Explicitly install nx after deps (#8469).

  • Minor improvements to chordal_graph_treewidth (#8470).

  • DOC: Eliminate sphinx build warnings (#8474).

  • CI: Bump dispatch workflow python version (#8480).

  • Update minimum dependencies (SPEC 0) and drop python 3.11 (#8482).

  • Remove _hits_scipy code that has been deprecated (#8483).

  • DOC: footnote -> hyperlink (#8493).

  • Linting exceptions (#8496).

  • BUGFIX: spring energy and ARF layouts with zero iterations (#8486).

  • Expire random lobster dep (#8499).

  • MAINT: Reuse could_be_isomorphic in fast_/faster_ variants (#8497).

  • API: Expire deprecations of could-be isomorphism aliases (#8498).

  • MAINT: Bump linters (#8513).

  • CI: Use pixi for CI platform/OS independent tasks (#8508).

  • CI: Explicitly add pip as a dep while resolving doc env (#8522).

  • Minor random_walks test refactor (#8524).

  • Refactor random walk implementation (#8525).

  • Minor update to zip examples (#8544).

  • TST: Dedup and refactor closeness centrality tests (#8548).

  • MAINT: clarify error when RandomState is used with random API (#8558).

  • MAINT: remove unused functions and imports (#8572).

  • MAINT: Minor readability tweaks to pagerank (#8582).

  • Raise ValueError in write_gexf for mixed typed attributes (#8549).

  • BUG: Handle small graphs in information_centrality (#7475).

  • CI: fix benchmark PR workflow checkout (#8633).

  • Followup that fixes import order (#8634).

  • MAINT: remove unused imports and dead helpers (#8627).

  • MAINT: Handle insufficient degree Pearson samples (#8628).

  • Optimize VF2 GMState frontier update by removing full core scan (#8649).

  • MAINT: Avoid subgraph views in strategy_connected_sequential (#8643).

  • Cleanup butterflies tests (#8664).

  • Remove unused dsum variable from havel_hakimi_graph (#8678).

  • CI: networkx default deps were leaking into the pixi default env (#8683).

  • DOC/CI: Update github label requirements for user experience (#8689).

  • CI: Redo benchmarks to use pixi around asv (#8688).

  • MAINT: Fix ci permissions (#8690).

  • MAINT: Minor touchups to lexicographical_toplogical_sort (#8695).

  • MAINT: Rm MANIFEST.in (#8700).

  • CI: Add image comparison tests to pre-release workflows (#8699).

  • MAINT: Avoid subgraph views in is_forest (#8642).

  • TST, MAINT: explict graphviz check for test_pydot (#8702).

  • CI: Fix circleci artifact redirector permissions (#8707).

  • write xsd:boolean true/false for dynamic gexf attvalues (#8709).

  • escape quotes and backslashes in pajek make_qstr (#8693).

  • Louvain updates to docs and code readability (#8722).

  • Align boruvka_mst_edges keys default with kruskal/prim and fix docstring typo (#8728).

  • TST: Test maintenance for test_clique.py (#8214).

  • Optimize Leiden data handling (#8715).

  • MAINT: Avoid Louvain infinite loops (#8757).

  • MAINT: avoid timeouts on circleci (#8758).

  • MAINT: bump copyright year before release (#8766).

  • BENCH: Add clustering to algorithm benchmarks (#8764).

  • CI: Add back –doctest-modules flag to base tests (#8696).

  • Prune nested components in k_components reconstruction and add tests the private helpers (#8753).

  • Fix reverse to preserve all attributes in dispatch conversions (#8807).

  • Clear the dispatch cache in remove_{node,edge}_attributes (#8806).

  • Fix “accidentally quadratic” use of list as queue in full_rary_tree (#8808).

  • MAINT: allow isomorphism match helpers to be lists or not (#8803).

  • fix: correct typo in test variable name (#8809).

  • Allow spectral_layout to handle dim>=len(G). Added dim tests (#8801).

  • META: Add agents.md (#8843).

  • MNT: Use linalg.eigh to compute HITS eigenvalues (#8859).

  • TST: parameterizing with iterables is deprecated in pytest (#8858).

  • TST: Cleanup & modernize the minimum cuts test suite (#8864).

  • MAINT: Refactor communicability tests (#8869).

  • ENH: Use linear algebra to compute communicability (#8870).

  • MNT: Raise warnings to errors while running pytest (#8860).

  • MAINT: sparse.eye is deprecated, use eye_array (#8901).

  • BUG: Fix _hits_numpy inf/NaN when eigh returns negated eigenvector (#8899).

  • Fix typo while dispatching vf2pp (#8904).

  • Support for Py3.15 (#8896).

  • Update minimum dependencies (SPEC 0) (#8916).

Other#

  • TST: Common tests for all isomorphism algorithms (#8412).

  • TST: Add test cases for len(G) != 3 (#8675).

  • TST: shorten leiden tests (#8687).

  • TST: Update pytest-mpl baselines for matplotlib v3.11 (#8698).

  • Adding regression test for duplicate shortest-paths (#8840).

Contributors#

72 authors added to this release (alphabetically):

36 reviewers added to this release (alphabetically):

_These lists are automatically generated, and may not be complete or may contain duplicates._