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_communitiesandleiden_partitions. This provides an alternative, often improved, community detection algorithm compared to the Louvain functions (#8509).The pygraphviz library is now provided via
pipwith 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#
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.describedefaults (#8569).Add utility to extract faces from PlanarEmbedding (#8512).
Improving views exceptions (#8588).
Optimize
_build_paths_from_predecessorsstack 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
barycenterandcentroidequivalence (#8630).ENH: Add Barber’s bipartite modularity quality function (#8618).
Leiden based community detection algorithms are now supported via
leiden_communitiesandleiden_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_karpand simplify theminimum_cutpartition (#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_subgraphdocstring (#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_histogramdocstring (#8571).Gallery: Fix and update
basic_propertiesexample (#8568).Added example for
SpanningTreeIteratorto 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
barycenterandcentroidequivalence (#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_edgelistdocstring 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_isomorphicinfast_/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_gexffor 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
clusteringto algorithm benchmarks (#8764).CI: Add back –doctest-modules flag to base tests (#8696).
Prune nested components in
k_componentsreconstruction and add tests the private helpers (#8753).Fix
reverseto 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#
Contributors#
72 authors added to this release (alphabetically):
Alain Kadar (@AlainKadar)
Alejandro Candioti (@amcandio)
Aman Jha (@AmanJha016)
Anton Karpov (@karpovantonme)
Berqia Mouad (@BerqiaMouad)
Buha Deep maheshbhai (@DeepBuha06)
Caiwen (@caiwen666)
Charlie Tonneslan (@c-tonneslan)
Chintan (@ChinTn)
Cursor Agent (@cursoragent)
Dan Schult (@dschult)
DESHWAL ADITYA JITENDER (@Aditya-Deshwal23)
Dipak Chaudhari (@dchaudhari7177)
Dresden (@DresdenGman)
edvatar (@toroleapinc)
Erik Welch (@eriknw)
Fabio Zanini (@iosonofabio)
Fei Pan (@fei0319)
Fridayworks (@worksbyfriday)
Gary Koplik (@gjkoplik)
Gilles Peiffer (@Peiffap)
Gitank Chandrakar (@Gitank444)
Hannah Chartier (@geekish)
Ishwer Kumar (@roboGOD)
Jarrod Millman (@jarrodmillman)
Jiya Gupta (@Jiya873)
Jordi Torrents (@jtorrents)
Joris (@jorisfu)
Jose Pinilla (@joseppinilla)
Karmanya Gupta (@KarmanyaGupta1421)
Mag (@magnuls)
Maninder Dhanauta (@Maninder-sd)
Marcus Fedarko (@fedarko)
max (@maxtaran2010)
mehmet turac (@mturac)
Melcion (@mcbosch)
Mingyi Kang (@jerrykcode)
Mridul Seth (@MridulS)
Muhammad Mujtaba (@mmujtaba0085)
Neel Mishra (@NeelMishra)
oha (@duriantaco)
Ori Press (@oripress)
Parafee41 (@koriyoshi2041)
Pierre Amedodji (@pamedodji)
Prajjwal Nijhara (@pnijhara)
Ravichandar nayakar (@Ravichandranayakar)
Rick Ratzel (@rlratzel)
Robert Jankowski (@robertjankowski)
Ross Barnowski (@rossbar)
Samarth D N (@TheGreatApollyon)
Samay Mehar (@samay2504)
Sebastiano Vigna (@vigna)
Shamik Basu (@ShamikOfficial)
Siddhant (@siddhants4-png)
Sreekant Baheti (@Sreekant13)
Swarit Kumar (@Swaritz)
Syed Abdul Khaliq (@abdul-khaliq-khalid)
Vanitas (@VanitasCodes)
Varand Arakelian (@VarandArakelian)
yeseo (@yeseoLee)
Yorgos Vasilantonakis (@toastmt)
36 reviewers added to this release (alphabetically):
Aditi Juneja (@Schefflera-Arboricola)
Alejandro Candioti (@amcandio)
Buha Deep maheshbhai (@DeepBuha06)
Chintan (@ChinTn)
Dan Schult (@dschult)
DESHWAL ADITYA JITENDER (@Aditya-Deshwal23)
Erik Welch (@eriknw)
Fabio Zanini (@iosonofabio)
Fridayworks (@worksbyfriday)
Gilles Peiffer (@Peiffap)
Ishwer Kumar (@roboGOD)
Jarrod Millman (@jarrodmillman)
Jiya Gupta (@Jiya873)
Jordi Torrents (@jtorrents)
Kelly Boothby (@boothby)
M Bussonnier (@Carreau)
Maninder Dhanauta (@Maninder-sd)
Melcion (@mcbosch)
Mridul Seth (@MridulS)
Muhammad Mujtaba (@mmujtaba0085)
Neel Mishra (@NeelMishra)
Peter C Kroon (@pckroon)
Pierre Amedodji (@pamedodji)
Rick Ratzel (@rlratzel)
Ross Barnowski (@rossbar)
Sebastiano Vigna (@vigna)
Syed Abdul Khaliq (@abdul-khaliq-khalid)
Vanitas (@VanitasCodes)
Varand Arakelian (@VarandArakelian)
_These lists are automatically generated, and may not be complete or may contain duplicates._