From 8984d9a81e3f84965c9b49ff59e065018d511663 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 23 Jan 2024 13:22:07 -0500 Subject: [PATCH] Prepare 0.14.0 release (#1065) * Prepare 0.14.0 release This commit prepares the 0.14.0 release. It moves the release notes for the release into a separate directory and adds a prelude to the release notes. This should be the last commit to merge for the 0.14.0 release and after it merges that commit will be what is should be tagged as the 0.14.0 release. As part of this there are few small changes other changes being made. The release notes are update to have consistent formatting and wording, a missing universal function for `all_shortest_paths` is added, missing doc toctree entries are added, and the ahash version in the lock file is downgraded to 0.8.6 as 0.8.7 has an undocumented MSRV on Rust 1.72 when building for aarch64 CPU architectures which is incompatible with rustworkx's documented MSRV. * Move new release notes * New release note fixes --- Cargo.lock | 76 +++++++++---------- Cargo.toml | 2 +- .../api/algorithm_functions/coloring.rst | 1 + .../connectivity_and_cycles.rst | 3 + .../algorithm_functions/dag_algorithms.rst | 3 +- .../algorithm_functions/shortest_paths.rst | 2 + docs/source/api/exceptions.rst | 2 + docs/source/api/pydigraph_api_functions.rst | 1 + docs/source/api/pygraph_api_functions.rst | 1 + .../add-albert-graph-5a7d393e1fe18e9d.yaml | 0 ...d-all-shortest-paths-52506ad9c5156726.yaml | 11 +++ .../add-bipartite-9df3898a156e799c.yaml | 2 +- ...-articulation-points-18b24dea2e909082.yaml | 0 ...ear_edges-for-graphs-041b166aa541639c.yaml | 9 +++ ...ints-method-to-graph-d58dc98719c4db39.yaml | 0 .../add-filter-98d00f306b5689ee.yaml | 0 .../add-fw-successor-80c09cb300c137f0.yaml | 0 ...ph-greedy-edge-color-7ef35785e5768419.yaml | 10 ++- ...sra-gries-edge-color-e55a27de2b667db1.yaml | 4 +- .../add-isolates-edc5da3a3d8fb4fd.yaml | 0 ...ode-subgraph-pygraph-44f40c01b783bb50.yaml | 4 - ...ological-generations-b0c48a3466d60ae7.yaml | 0 .../bump-msrv-3208e6f55270305d.yaml | 0 .../drop-python-3.7-c71f8b6559beaf86.yaml | 0 ...edge-color-bipartite-70d52fc23c49ab4f.yaml | 9 ++- ...and-adjacency-matrix-11e56c1f49b8e4e5.yaml | 0 ...fix-all-simple-paths-03f4534438d1068d.yaml | 0 ...-gnp-random-directed-41f2a436c49b9064.yaml | 0 .../fully-typed-0fbab79a7206d7e3.yaml | 0 ...apping-token_swapper-55d5b045b0b55345.yaml | 0 .../{ => 0.14}/has_path-1addf94c4d29d455.yaml | 0 .../numpy-2-pin-11bc3a379fb29bf7.yaml | 0 .../platform-updates-e9b296144e633c95.yaml | 0 .../0.14/prepare-0.14-4a655a08ce38533f.yaml | 14 ++++ ...r-graph-greedy-color-b6c1af2826914adf.yaml | 0 ...retworkx-deprecation-848bc6b41f2368cf.yaml | 0 .../s390x-tier-4-1701a0f044759cd1.yaml | 0 ...transitive-reduction-6db2b80351c15887.yaml | 0 ...d-all-shortest-paths-52506ad9c5156726.yaml | 6 -- ...ear_edges-for-graphs-041b166aa541639c.yaml | 10 --- rustworkx/__init__.py | 38 ++++++++++ rustworkx/__init__.pyi | 8 ++ 42 files changed, 143 insertions(+), 73 deletions(-) rename releasenotes/notes/{ => 0.14}/add-albert-graph-5a7d393e1fe18e9d.yaml (100%) create mode 100644 releasenotes/notes/0.14/add-all-shortest-paths-52506ad9c5156726.yaml rename releasenotes/notes/{ => 0.14}/add-bipartite-9df3898a156e799c.yaml (91%) rename releasenotes/notes/{ => 0.14}/add-bridges-and-upgrade-articulation-points-18b24dea2e909082.yaml (100%) create mode 100644 releasenotes/notes/0.14/add-clear-and-clear_edges-for-graphs-041b166aa541639c.yaml rename releasenotes/notes/{ => 0.14}/add-edge_indices_from_endpoints-method-to-graph-d58dc98719c4db39.yaml (100%) rename releasenotes/notes/{ => 0.14}/add-filter-98d00f306b5689ee.yaml (100%) rename releasenotes/notes/{ => 0.14}/add-fw-successor-80c09cb300c137f0.yaml (100%) rename releasenotes/notes/{ => 0.14}/add-graph-greedy-edge-color-7ef35785e5768419.yaml (72%) rename releasenotes/notes/{ => 0.14}/add-graph-misra-gries-edge-color-e55a27de2b667db1.yaml (71%) rename releasenotes/notes/{ => 0.14}/add-isolates-edc5da3a3d8fb4fd.yaml (100%) rename releasenotes/notes/{ => 0.14}/add-substitute-node-subgraph-pygraph-44f40c01b783bb50.yaml (79%) rename releasenotes/notes/{ => 0.14}/add-topological-generations-b0c48a3466d60ae7.yaml (100%) rename releasenotes/notes/{ => 0.14}/bump-msrv-3208e6f55270305d.yaml (100%) rename releasenotes/notes/{ => 0.14}/drop-python-3.7-c71f8b6559beaf86.yaml (100%) rename releasenotes/notes/{ => 0.14}/edge-color-bipartite-70d52fc23c49ab4f.yaml (81%) rename releasenotes/notes/{ => 0.14}/expand-adjacency-matrix-11e56c1f49b8e4e5.yaml (100%) rename releasenotes/notes/{ => 0.14}/fix-all-simple-paths-03f4534438d1068d.yaml (100%) rename releasenotes/notes/{ => 0.14}/fix-gnp-random-directed-41f2a436c49b9064.yaml (100%) rename releasenotes/notes/{ => 0.14}/fully-typed-0fbab79a7206d7e3.yaml (100%) rename releasenotes/notes/{ => 0.14}/handle-invalid-mapping-token_swapper-55d5b045b0b55345.yaml (100%) rename releasenotes/notes/{ => 0.14}/has_path-1addf94c4d29d455.yaml (100%) rename releasenotes/notes/{ => 0.14}/numpy-2-pin-11bc3a379fb29bf7.yaml (100%) rename releasenotes/notes/{ => 0.14}/platform-updates-e9b296144e633c95.yaml (100%) create mode 100644 releasenotes/notes/0.14/prepare-0.14-4a655a08ce38533f.yaml rename releasenotes/notes/{ => 0.14}/presets-for-graph-greedy-color-b6c1af2826914adf.yaml (100%) rename releasenotes/notes/{ => 0.14}/retworkx-deprecation-848bc6b41f2368cf.yaml (100%) rename releasenotes/notes/{ => 0.14}/s390x-tier-4-1701a0f044759cd1.yaml (100%) rename releasenotes/notes/{ => 0.14}/transitive-reduction-6db2b80351c15887.yaml (100%) delete mode 100644 releasenotes/notes/add-all-shortest-paths-52506ad9c5156726.yaml delete mode 100644 releasenotes/notes/add-clear-and-clear_edges-for-graphs-041b166aa541639c.yaml diff --git a/Cargo.lock b/Cargo.lock index 95d151ced..45e870a59 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "getrandom", @@ -61,36 +61,28 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "either" @@ -112,9 +104,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -146,9 +138,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "indexmap" @@ -197,15 +189,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libm" @@ -235,9 +227,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memoffset" @@ -363,9 +355,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "parking_lot" @@ -418,9 +410,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.74" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -644,9 +636,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "scopeguard" @@ -687,9 +679,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "sprs" @@ -708,9 +700,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.46" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -719,9 +711,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.12" +version = "0.12.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" +checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" [[package]] name = "unicode-ident" @@ -806,18 +798,18 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "zerocopy" -version = "0.7.31" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.31" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index af785845f..c5bc86d93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ repository = "https://github.com/Qiskit/rustworkx" license = "Apache-2.0" [workspace.dependencies] -ahash = "0.8.7" +ahash = "0.8.6" fixedbitset = "0.4.2" hashbrown = { version = ">=0.13, <0.15", features = ["rayon"] } indexmap = { version = ">=1.9, <3", features = ["rayon"] } diff --git a/docs/source/api/algorithm_functions/coloring.rst b/docs/source/api/algorithm_functions/coloring.rst index 5bfb66084..c1b7c5b68 100644 --- a/docs/source/api/algorithm_functions/coloring.rst +++ b/docs/source/api/algorithm_functions/coloring.rst @@ -10,3 +10,4 @@ Coloring rustworkx.graph_bipartite_edge_color rustworkx.graph_greedy_edge_color rustworkx.graph_misra_gries_edge_color + rustworkx.two_color diff --git a/docs/source/api/algorithm_functions/connectivity_and_cycles.rst b/docs/source/api/algorithm_functions/connectivity_and_cycles.rst index 4978bcaf1..9743dc2c2 100644 --- a/docs/source/api/algorithm_functions/connectivity_and_cycles.rst +++ b/docs/source/api/algorithm_functions/connectivity_and_cycles.rst @@ -25,3 +25,6 @@ Connectivity and Cycles rustworkx.all_pairs_all_simple_paths rustworkx.stoer_wagner_min_cut rustworkx.longest_simple_path + rustworkx.is_bipartite + rustworkx.isolates + rustworkx.has_path diff --git a/docs/source/api/algorithm_functions/dag_algorithms.rst b/docs/source/api/algorithm_functions/dag_algorithms.rst index d0b7fa71a..e3830ac90 100644 --- a/docs/source/api/algorithm_functions/dag_algorithms.rst +++ b/docs/source/api/algorithm_functions/dag_algorithms.rst @@ -12,4 +12,5 @@ DAG Algorithms rustworkx.dag_weighted_longest_path_length rustworkx.is_directed_acyclic_graph rustworkx.layers - rustworkx.transitive_reduction \ No newline at end of file + rustworkx.transitive_reduction + rustworkx.topological_generations diff --git a/docs/source/api/algorithm_functions/shortest_paths.rst b/docs/source/api/algorithm_functions/shortest_paths.rst index a2727eac5..89ca306b7 100644 --- a/docs/source/api/algorithm_functions/shortest_paths.rst +++ b/docs/source/api/algorithm_functions/shortest_paths.rst @@ -24,3 +24,5 @@ Shortest Paths rustworkx.k_shortest_path_lengths rustworkx.num_shortest_paths_unweighted rustworkx.unweighted_average_shortest_path_length + rustworkx.all_shortest_paths + rustworkx.digraph_all_shortest_paths diff --git a/docs/source/api/exceptions.rst b/docs/source/api/exceptions.rst index 05d4ea32b..70a995761 100644 --- a/docs/source/api/exceptions.rst +++ b/docs/source/api/exceptions.rst @@ -15,3 +15,5 @@ Exceptions rustworkx.visit.StopSearch rustworkx.visit.PruneSearch rustworkx.JSONSerializationError + rustworkx.InvalidMapping + rustworkx.GraphNotBipartite diff --git a/docs/source/api/pydigraph_api_functions.rst b/docs/source/api/pydigraph_api_functions.rst index 933c76b38..78153e9a3 100644 --- a/docs/source/api/pydigraph_api_functions.rst +++ b/docs/source/api/pydigraph_api_functions.rst @@ -31,6 +31,7 @@ the functions from the explicitly typed based on the data type. rustworkx.digraph_all_pairs_bellman_ford_shortest_paths rustworkx.digraph_all_pairs_bellman_ford_path_lengths rustworkx.digraph_k_shortest_path_lengths + rustworkx.digraph_all_shortest_paths rustworkx.digraph_dfs_edges rustworkx.digraph_dfs_search rustworkx.digraph_find_cycle diff --git a/docs/source/api/pygraph_api_functions.rst b/docs/source/api/pygraph_api_functions.rst index bc40f824e..44bfdf283 100644 --- a/docs/source/api/pygraph_api_functions.rst +++ b/docs/source/api/pygraph_api_functions.rst @@ -31,6 +31,7 @@ typed API based on the data type. rustworkx.graph_bellman_ford_shortest_path_lengths rustworkx.graph_all_pairs_bellman_ford_shortest_paths rustworkx.graph_all_pairs_bellman_ford_path_lengths + rustworkx.graph_all_shortest_paths rustworkx.graph_dfs_edges rustworkx.graph_dfs_search rustworkx.graph_transitivity diff --git a/releasenotes/notes/add-albert-graph-5a7d393e1fe18e9d.yaml b/releasenotes/notes/0.14/add-albert-graph-5a7d393e1fe18e9d.yaml similarity index 100% rename from releasenotes/notes/add-albert-graph-5a7d393e1fe18e9d.yaml rename to releasenotes/notes/0.14/add-albert-graph-5a7d393e1fe18e9d.yaml diff --git a/releasenotes/notes/0.14/add-all-shortest-paths-52506ad9c5156726.yaml b/releasenotes/notes/0.14/add-all-shortest-paths-52506ad9c5156726.yaml new file mode 100644 index 000000000..092e24d47 --- /dev/null +++ b/releasenotes/notes/0.14/add-all-shortest-paths-52506ad9c5156726.yaml @@ -0,0 +1,11 @@ +--- +features: + - | + Added a new function :func:`.all_shortest_paths` (and the graph type specific + variants: :func:`~rustworkx.graph_all_shortest_paths` and + :func:`~rustworkx.digraph_all_shortest_paths`) that finds every + simple shortest path two nodes in a graph. + - | + Added a new function to the ``rustworkx-core`` module + ``rustworkx_core::shortest_path`` module ``all_shortest_path()`` which is + used to find every simple shortest path in a graph. diff --git a/releasenotes/notes/add-bipartite-9df3898a156e799c.yaml b/releasenotes/notes/0.14/add-bipartite-9df3898a156e799c.yaml similarity index 91% rename from releasenotes/notes/add-bipartite-9df3898a156e799c.yaml rename to releasenotes/notes/0.14/add-bipartite-9df3898a156e799c.yaml index dba6c7ed3..5c7e894e0 100644 --- a/releasenotes/notes/add-bipartite-9df3898a156e799c.yaml +++ b/releasenotes/notes/0.14/add-bipartite-9df3898a156e799c.yaml @@ -16,7 +16,7 @@ features: graph = rx.generators.heavy_square_graph(5) colors = rx.two_color(graph) - mpl_draw(graph, node_color=list(colors.values())) + mpl_draw(graph, node_color=[colors[i] for i in range(len(graph))]) - | Added a new function, :func:`~.is_bipartite` to determine whether a given graph object is bipartite or not. diff --git a/releasenotes/notes/add-bridges-and-upgrade-articulation-points-18b24dea2e909082.yaml b/releasenotes/notes/0.14/add-bridges-and-upgrade-articulation-points-18b24dea2e909082.yaml similarity index 100% rename from releasenotes/notes/add-bridges-and-upgrade-articulation-points-18b24dea2e909082.yaml rename to releasenotes/notes/0.14/add-bridges-and-upgrade-articulation-points-18b24dea2e909082.yaml diff --git a/releasenotes/notes/0.14/add-clear-and-clear_edges-for-graphs-041b166aa541639c.yaml b/releasenotes/notes/0.14/add-clear-and-clear_edges-for-graphs-041b166aa541639c.yaml new file mode 100644 index 000000000..1d2bdfed6 --- /dev/null +++ b/releasenotes/notes/0.14/add-clear-and-clear_edges-for-graphs-041b166aa541639c.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + Added a new function, :func:`~.PyDiGraph.clear` that clears all nodes and + edges from a :class:`.PyGraph` or :class:`.PyDiGraph`. + - | + Added a new function, :func:`~.PyDiGraph.clear_edges` that clears all edges + for :class:`.PyGraph` or :class:`rustworkx.PyDiGraph` without + modifying nodes. diff --git a/releasenotes/notes/add-edge_indices_from_endpoints-method-to-graph-d58dc98719c4db39.yaml b/releasenotes/notes/0.14/add-edge_indices_from_endpoints-method-to-graph-d58dc98719c4db39.yaml similarity index 100% rename from releasenotes/notes/add-edge_indices_from_endpoints-method-to-graph-d58dc98719c4db39.yaml rename to releasenotes/notes/0.14/add-edge_indices_from_endpoints-method-to-graph-d58dc98719c4db39.yaml diff --git a/releasenotes/notes/add-filter-98d00f306b5689ee.yaml b/releasenotes/notes/0.14/add-filter-98d00f306b5689ee.yaml similarity index 100% rename from releasenotes/notes/add-filter-98d00f306b5689ee.yaml rename to releasenotes/notes/0.14/add-filter-98d00f306b5689ee.yaml diff --git a/releasenotes/notes/add-fw-successor-80c09cb300c137f0.yaml b/releasenotes/notes/0.14/add-fw-successor-80c09cb300c137f0.yaml similarity index 100% rename from releasenotes/notes/add-fw-successor-80c09cb300c137f0.yaml rename to releasenotes/notes/0.14/add-fw-successor-80c09cb300c137f0.yaml diff --git a/releasenotes/notes/add-graph-greedy-edge-color-7ef35785e5768419.yaml b/releasenotes/notes/0.14/add-graph-greedy-edge-color-7ef35785e5768419.yaml similarity index 72% rename from releasenotes/notes/add-graph-greedy-edge-color-7ef35785e5768419.yaml rename to releasenotes/notes/0.14/add-graph-greedy-edge-color-7ef35785e5768419.yaml index 2c7832c23..e55c0250d 100644 --- a/releasenotes/notes/add-graph-greedy-edge-color-7ef35785e5768419.yaml +++ b/releasenotes/notes/0.14/add-graph-greedy-edge-color-7ef35785e5768419.yaml @@ -4,13 +4,14 @@ features: Added a new function, :func:`~.graph_line_graph` to construct a line graph of a :class:`~.PyGraph` object. - The line graph `L(G)` of a graph `G` represents the adjacencies between edges of G. - `L(G)` contains a vertex for every edge in `G`, and `L(G)` contains an edge between two - vertices if the corresponding edges in `G` have a vertex in common. + The line graph :math:`L(G)` of a graph :math:`G` represents the adjacencies between edges of G. + :math:`L(G)` contains a vertex for every edge in :math:`G`, and :math:`L(G)` contains an edge between two + vertices if the corresponding edges in :math:`G` have a vertex in common. .. jupyter-execute:: import rustworkx as rx + from rustworkx.visualization import mpl_draw graph = rx.PyGraph() node_a = graph.add_node("a") @@ -26,6 +27,7 @@ features: assert out_graph.node_indices() == [0, 1, 2, 3] assert out_graph.edge_list() == [(3, 1), (3, 0), (1, 0), (2, 0), (2, 1)] assert out_edge_map == {edge_ab: 0, edge_ac: 1, edge_bc: 2, edge_ad: 3} + mpl_draw(out_graph, with_labels=True) - | Added a new function, :func:`~.graph_greedy_edge_color` to color edges @@ -36,7 +38,9 @@ features: .. jupyter-execute:: import rustworkx as rx + from rustworkx.visualization import mpl_draw graph = rx.generators.cycle_graph(7) edge_colors = rx.graph_greedy_edge_color(graph) assert edge_colors == {0: 0, 1: 1, 2: 0, 3: 1, 4: 0, 5: 1, 6: 2} + mpl_draw(graph, edge_color=[edge_colors[i] for i in range(graph.num_edges())]) diff --git a/releasenotes/notes/add-graph-misra-gries-edge-color-e55a27de2b667db1.yaml b/releasenotes/notes/0.14/add-graph-misra-gries-edge-color-e55a27de2b667db1.yaml similarity index 71% rename from releasenotes/notes/add-graph-misra-gries-edge-color-e55a27de2b667db1.yaml rename to releasenotes/notes/0.14/add-graph-misra-gries-edge-color-e55a27de2b667db1.yaml index 457c829f9..14955a852 100644 --- a/releasenotes/notes/add-graph-misra-gries-edge-color-e55a27de2b667db1.yaml +++ b/releasenotes/notes/0.14/add-graph-misra-gries-edge-color-e55a27de2b667db1.yaml @@ -7,14 +7,16 @@ features: The above algorithm is described in the paper paper: "A constructive proof of Vizing's theorem" by Misra and Gries, 1992. - The coloring produces at most d + 1 colors where d is the maximum degree + The coloring produces at most :math:`d + 1` colors where :math:`d` is the maximum degree of the graph. .. jupyter-execute:: import rustworkx as rx + from rustworkx.visualization import mpl_draw graph = rx.generators.cycle_graph(7) edge_colors = rx.graph_misra_gries_edge_color(graph) assert edge_colors == {0: 0, 1: 1, 2: 2, 3: 0, 4: 1, 5: 0, 6: 2} + mpl_draw(graph, edge_color=[edge_colors[i] for i in range(graph.num_edges())]) diff --git a/releasenotes/notes/add-isolates-edc5da3a3d8fb4fd.yaml b/releasenotes/notes/0.14/add-isolates-edc5da3a3d8fb4fd.yaml similarity index 100% rename from releasenotes/notes/add-isolates-edc5da3a3d8fb4fd.yaml rename to releasenotes/notes/0.14/add-isolates-edc5da3a3d8fb4fd.yaml diff --git a/releasenotes/notes/add-substitute-node-subgraph-pygraph-44f40c01b783bb50.yaml b/releasenotes/notes/0.14/add-substitute-node-subgraph-pygraph-44f40c01b783bb50.yaml similarity index 79% rename from releasenotes/notes/add-substitute-node-subgraph-pygraph-44f40c01b783bb50.yaml rename to releasenotes/notes/0.14/add-substitute-node-subgraph-pygraph-44f40c01b783bb50.yaml index 49e023678..1fe34c3d5 100644 --- a/releasenotes/notes/add-substitute-node-subgraph-pygraph-44f40c01b783bb50.yaml +++ b/releasenotes/notes/0.14/add-substitute-node-subgraph-pygraph-44f40c01b783bb50.yaml @@ -19,7 +19,3 @@ features: # Draw the updated graph mpl_draw(graph, with_labels=True) -fixes: - - | - Fixes missing method that is present in PyDiGraph but not in PyGraph. - see `#837 `__ for more info. \ No newline at end of file diff --git a/releasenotes/notes/add-topological-generations-b0c48a3466d60ae7.yaml b/releasenotes/notes/0.14/add-topological-generations-b0c48a3466d60ae7.yaml similarity index 100% rename from releasenotes/notes/add-topological-generations-b0c48a3466d60ae7.yaml rename to releasenotes/notes/0.14/add-topological-generations-b0c48a3466d60ae7.yaml diff --git a/releasenotes/notes/bump-msrv-3208e6f55270305d.yaml b/releasenotes/notes/0.14/bump-msrv-3208e6f55270305d.yaml similarity index 100% rename from releasenotes/notes/bump-msrv-3208e6f55270305d.yaml rename to releasenotes/notes/0.14/bump-msrv-3208e6f55270305d.yaml diff --git a/releasenotes/notes/drop-python-3.7-c71f8b6559beaf86.yaml b/releasenotes/notes/0.14/drop-python-3.7-c71f8b6559beaf86.yaml similarity index 100% rename from releasenotes/notes/drop-python-3.7-c71f8b6559beaf86.yaml rename to releasenotes/notes/0.14/drop-python-3.7-c71f8b6559beaf86.yaml diff --git a/releasenotes/notes/edge-color-bipartite-70d52fc23c49ab4f.yaml b/releasenotes/notes/0.14/edge-color-bipartite-70d52fc23c49ab4f.yaml similarity index 81% rename from releasenotes/notes/edge-color-bipartite-70d52fc23c49ab4f.yaml rename to releasenotes/notes/0.14/edge-color-bipartite-70d52fc23c49ab4f.yaml index 9934583cf..3cec06018 100644 --- a/releasenotes/notes/edge-color-bipartite-70d52fc23c49ab4f.yaml +++ b/releasenotes/notes/0.14/edge-color-bipartite-70d52fc23c49ab4f.yaml @@ -15,9 +15,9 @@ features: The implemented algorithm is based on the paper "A simple algorithm for edge-coloring bipartite multigraphs" by Noga Alon, 2003. - The coloring produces at most d colors where d is the maximum degree of a node in the graph. - The algorithm runs in time ``O (n + m log m)``, where ``n`` is the number of vertices and - ``m`` is the number of edges in the graph. + The coloring produces at most :math:`d` colors where :math:`d` is the maximum degree of a node in the graph. + The algorithm runs in time :math:`\mathcal{O}(n + m\log{}m)`, where :math:`n` is the number of vertices and + :math:`m` is the number of edges in the graph. .. jupyter-execute:: @@ -39,4 +39,5 @@ features: from rustworkx.visualization import mpl_draw random_graph = rx.undirected_random_bipartite_graph(10, 5, 0.5, seed=20) - mpl_draw(random_graph) + layout = rx.bipartite_layout(random_graph, set(range(10))) + mpl_draw(random_graph, pos=layout) diff --git a/releasenotes/notes/expand-adjacency-matrix-11e56c1f49b8e4e5.yaml b/releasenotes/notes/0.14/expand-adjacency-matrix-11e56c1f49b8e4e5.yaml similarity index 100% rename from releasenotes/notes/expand-adjacency-matrix-11e56c1f49b8e4e5.yaml rename to releasenotes/notes/0.14/expand-adjacency-matrix-11e56c1f49b8e4e5.yaml diff --git a/releasenotes/notes/fix-all-simple-paths-03f4534438d1068d.yaml b/releasenotes/notes/0.14/fix-all-simple-paths-03f4534438d1068d.yaml similarity index 100% rename from releasenotes/notes/fix-all-simple-paths-03f4534438d1068d.yaml rename to releasenotes/notes/0.14/fix-all-simple-paths-03f4534438d1068d.yaml diff --git a/releasenotes/notes/fix-gnp-random-directed-41f2a436c49b9064.yaml b/releasenotes/notes/0.14/fix-gnp-random-directed-41f2a436c49b9064.yaml similarity index 100% rename from releasenotes/notes/fix-gnp-random-directed-41f2a436c49b9064.yaml rename to releasenotes/notes/0.14/fix-gnp-random-directed-41f2a436c49b9064.yaml diff --git a/releasenotes/notes/fully-typed-0fbab79a7206d7e3.yaml b/releasenotes/notes/0.14/fully-typed-0fbab79a7206d7e3.yaml similarity index 100% rename from releasenotes/notes/fully-typed-0fbab79a7206d7e3.yaml rename to releasenotes/notes/0.14/fully-typed-0fbab79a7206d7e3.yaml diff --git a/releasenotes/notes/handle-invalid-mapping-token_swapper-55d5b045b0b55345.yaml b/releasenotes/notes/0.14/handle-invalid-mapping-token_swapper-55d5b045b0b55345.yaml similarity index 100% rename from releasenotes/notes/handle-invalid-mapping-token_swapper-55d5b045b0b55345.yaml rename to releasenotes/notes/0.14/handle-invalid-mapping-token_swapper-55d5b045b0b55345.yaml diff --git a/releasenotes/notes/has_path-1addf94c4d29d455.yaml b/releasenotes/notes/0.14/has_path-1addf94c4d29d455.yaml similarity index 100% rename from releasenotes/notes/has_path-1addf94c4d29d455.yaml rename to releasenotes/notes/0.14/has_path-1addf94c4d29d455.yaml diff --git a/releasenotes/notes/numpy-2-pin-11bc3a379fb29bf7.yaml b/releasenotes/notes/0.14/numpy-2-pin-11bc3a379fb29bf7.yaml similarity index 100% rename from releasenotes/notes/numpy-2-pin-11bc3a379fb29bf7.yaml rename to releasenotes/notes/0.14/numpy-2-pin-11bc3a379fb29bf7.yaml diff --git a/releasenotes/notes/platform-updates-e9b296144e633c95.yaml b/releasenotes/notes/0.14/platform-updates-e9b296144e633c95.yaml similarity index 100% rename from releasenotes/notes/platform-updates-e9b296144e633c95.yaml rename to releasenotes/notes/0.14/platform-updates-e9b296144e633c95.yaml diff --git a/releasenotes/notes/0.14/prepare-0.14-4a655a08ce38533f.yaml b/releasenotes/notes/0.14/prepare-0.14-4a655a08ce38533f.yaml new file mode 100644 index 000000000..274dfc28e --- /dev/null +++ b/releasenotes/notes/0.14/prepare-0.14-4a655a08ce38533f.yaml @@ -0,0 +1,14 @@ +--- +prelude: | + This is a new feature release of Rustworkx that adds many new features to + the library. The highlights of this release are: + + * Fully type annotated for support with `mypy `__ + and other tooling + * Improvements to the graph coloring functions + + This release supports running with Python 3.8 through 3.12. The minimum + supported Rust version for building rustworkx and rustworkx-core from source + is now 1.64.0. The minimum supported version of macOS for this release has + been increased from 10.9 to 10.12. Also, the Linux ppc64le and s390x platform + support has been downgraded from :ref:`tier-3` to :ref:`tier-4`. diff --git a/releasenotes/notes/presets-for-graph-greedy-color-b6c1af2826914adf.yaml b/releasenotes/notes/0.14/presets-for-graph-greedy-color-b6c1af2826914adf.yaml similarity index 100% rename from releasenotes/notes/presets-for-graph-greedy-color-b6c1af2826914adf.yaml rename to releasenotes/notes/0.14/presets-for-graph-greedy-color-b6c1af2826914adf.yaml diff --git a/releasenotes/notes/retworkx-deprecation-848bc6b41f2368cf.yaml b/releasenotes/notes/0.14/retworkx-deprecation-848bc6b41f2368cf.yaml similarity index 100% rename from releasenotes/notes/retworkx-deprecation-848bc6b41f2368cf.yaml rename to releasenotes/notes/0.14/retworkx-deprecation-848bc6b41f2368cf.yaml diff --git a/releasenotes/notes/s390x-tier-4-1701a0f044759cd1.yaml b/releasenotes/notes/0.14/s390x-tier-4-1701a0f044759cd1.yaml similarity index 100% rename from releasenotes/notes/s390x-tier-4-1701a0f044759cd1.yaml rename to releasenotes/notes/0.14/s390x-tier-4-1701a0f044759cd1.yaml diff --git a/releasenotes/notes/transitive-reduction-6db2b80351c15887.yaml b/releasenotes/notes/0.14/transitive-reduction-6db2b80351c15887.yaml similarity index 100% rename from releasenotes/notes/transitive-reduction-6db2b80351c15887.yaml rename to releasenotes/notes/0.14/transitive-reduction-6db2b80351c15887.yaml diff --git a/releasenotes/notes/add-all-shortest-paths-52506ad9c5156726.yaml b/releasenotes/notes/add-all-shortest-paths-52506ad9c5156726.yaml deleted file mode 100644 index 2d54e626f..000000000 --- a/releasenotes/notes/add-all-shortest-paths-52506ad9c5156726.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -features: - - | - Added new functions :func:`~rustworkx.graph_all_shortest_paths` and - :func:`~rustworkx.digraph_all_shortest_paths` that finds every - simple shortest path in a (di)graph. diff --git a/releasenotes/notes/add-clear-and-clear_edges-for-graphs-041b166aa541639c.yaml b/releasenotes/notes/add-clear-and-clear_edges-for-graphs-041b166aa541639c.yaml deleted file mode 100644 index ef6931f54..000000000 --- a/releasenotes/notes/add-clear-and-clear_edges-for-graphs-041b166aa541639c.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -features: - - | - Added a new function, :func:`clear` that clears all nodes and edges - from a :class:`rustworkx.PyGraph` or :class:`rustworkx.PyDiGraph` - - - | - Added a new function, :func:`clear_edges` that clears all edges for - :class:`rustworkx.PyGraph` or :class:`rustworkx.PyDiGraph` without - modifying nodes diff --git a/rustworkx/__init__.py b/rustworkx/__init__.py index ae158c6e3..3b3952fe6 100644 --- a/rustworkx/__init__.py +++ b/rustworkx/__init__.py @@ -2171,3 +2171,41 @@ def reconstruct_path(source, target, successors): PyDiGraph, digraph_floyd_warshall_successor_and_distance ) floyd_warshall_successor_and_distance.register(PyGraph, graph_floyd_warshall_successor_and_distance) + + +@functools.singledispatch +def all_shortest_paths( + graph, + source, + target, + weight_fn=None, + default_weight=1.0, + as_undirected=False, +): + """ + Find all shortest paths between two nodes + + This function will generate all possible shortest paths from a source node to a + target using Dijkstra's algorithm. + + :param graph: The input graph to find the shortest paths for + :param int source: The node index to find paths from + :param int target: A target to find paths to + :param weight_fn: An optional weight function for an edge. It will accept + a single argument, the edge's weight object and will return a float which + will be used to represent the weight/cost of the edge + :param float default_weight: If ``weight_fn`` isn't specified this optional + float value will be used for the weight/cost of each edge. + + :return: List of paths. Each paths are lists of node indices, + starting at ``source`` and ending at ``target``. + :rtype: list + :raises ValueError: when an edge weight with NaN or negative value + is provided. + + """ + raise TypeError("Invalid Input Type %s for graph" % type(graph)) + + +all_shortest_paths.register(PyDiGraph, digraph_all_shortest_paths) +all_shortest_paths.register(PyGraph, graph_all_shortest_paths) diff --git a/rustworkx/__init__.pyi b/rustworkx/__init__.pyi index f8fddce79..4759e5d12 100644 --- a/rustworkx/__init__.pyi +++ b/rustworkx/__init__.pyi @@ -345,6 +345,14 @@ def k_shortest_path_lengths( edge_cost: Callable[[_T], float], goal: int | None = ..., ) -> PathLengthMapping: ... +def all_shortest_paths( + graph: PyGraph[_S, _T] | PyDiGraph[_S, _T], + source: int, + target: int, + weight_fn: Callable[[_T], float] | None = ..., + default_weight: float = ..., + as_undirected: bool = ..., +) -> list[list[int]]: ... def dfs_edges(graph: PyGraph[_S, _T] | PyDiGraph[_S, _T], source: int | None = ...) -> EdgeList: ... @overload def is_isomorphic(