Skip to content

Commit de87d83

Browse files
gluonhiggsSILIZ4
authored andcommitted
feat: Added single_source_all_shortest_paths (Qiskit#1458)
* feat: Added single_source_all_shortest_paths * modified rust and python wrapper to handle extra tests * ran cargo clippy * re-ran cargo fmt * precompute edge weight and use fixedbitset for collect_paths * modify edge_cost_fn to take EdgeIndex
1 parent 63c3f8c commit de87d83

File tree

13 files changed

+934
-7
lines changed

13 files changed

+934
-7
lines changed

docs/source/api/algorithm_functions/shortest_paths.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ Shortest Paths
2626
rustworkx.unweighted_average_shortest_path_length
2727
rustworkx.all_shortest_paths
2828
rustworkx.digraph_all_shortest_paths
29+
rustworkx.single_source_all_shortest_paths

docs/source/api/pydigraph_api_functions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ the functions from the explicitly typed based on the data type.
3232
rustworkx.digraph_all_pairs_bellman_ford_path_lengths
3333
rustworkx.digraph_k_shortest_path_lengths
3434
rustworkx.digraph_all_shortest_paths
35+
rustworkx.digraph_single_source_all_shortest_paths
3536
rustworkx.digraph_dfs_edges
3637
rustworkx.digraph_dfs_search
3738
rustworkx.digraph_find_cycle

docs/source/api/pygraph_api_functions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ typed API based on the data type.
3232
rustworkx.graph_all_pairs_bellman_ford_shortest_paths
3333
rustworkx.graph_all_pairs_bellman_ford_path_lengths
3434
rustworkx.graph_all_shortest_paths
35+
rustworkx.graph_single_source_all_shortest_paths
3536
rustworkx.graph_dfs_edges
3637
rustworkx.graph_dfs_search
3738
rustworkx.graph_transitivity
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
features:
2+
- |
3+
Added `single_source_all_shortest_paths` function to compute all shortest paths from a source node to all other nodes using Dijkstra's algorithm.
4+
This function supports both PyGraph and PyDiGraph, with an option to treat directed graphs as undirected.
5+
See the documentation for usage and performance warnings.

rustworkx-core/src/shortest_path/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ mod astar;
2020
mod bellman_ford;
2121
mod dijkstra;
2222
mod k_shortest_path;
23+
mod single_source_all_shortest_paths;
2324

2425
pub use all_shortest_paths::all_shortest_paths;
2526
pub use astar::astar;
2627
pub use bellman_ford::{bellman_ford, negative_cycle_finder};
2728
pub use dijkstra::dijkstra;
2829
pub use k_shortest_path::k_shortest_path;
30+
pub use single_source_all_shortest_paths::single_source_all_shortest_paths;

0 commit comments

Comments
 (0)