-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dijkstra shortest path functions (#162)
* Add to_undirected method for PyDiGraph This commit adds a new method to the PyDiGraph class, to_undirected(), which will generate an undirected PyGraph object from the PyDiGraph object. Fixes #153 * Fix lint * Add Dijkstra shortest path functions This commit adds 2 new functions, digraph_dijkstra_shortest_paths() and graph_dijkstra_shortest_path(), which is a function to get the shortest path from a node in a graph. It leverages the same dijkstra's algorithm module which has been modified to get a path in addition to the path length. Depends on #161 Fixes #151 * Fix lint * Fix duplicate weight_callable functions from rebase This commit fixes an issue with duplicate weight_callable functions that happened because one was added in this PR's branch and another was added in a different PR. The functions were mostly identical so this just consolidates the 2. * Apply suggestions from code review Co-authored-by: Lauren Capelluto <laurencapelluto@gmail.com> * Add docs for paths parameter in dijkstra::dijkstra * Use setUp() to build common test graphs * Move path HashMap initialization into dijkstra::dijkstra() Co-authored-by: Lauren Capelluto <laurencapelluto@gmail.com>
- Loading branch information
1 parent
b790a86
commit 0ef76fe
Showing
4 changed files
with
368 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.