Rename DigraphDijkstra #570
Labels
difficulty: 1
A label for feature requests of moderate difficulty
newcomer-friendly
A label for issues that someone thought might be friendly newcomers.
not-backwards-compatible
A label for PRs that break backwards compatibility
DigraphShortestPath
andDigraphDijkstra
are two closely related functions that both find the shortest path between two vertices, where "shortest" means "fewest edges".The algorithm they're using appears to be basically the same: it's a breadth-first search starting at the source vertex and proceeding until the destination vertex is found. Dijkstra's algorithm in general is smarter than this, since it uses edge lengths to decide where to explore next; but we don't have edge lengths, so this isn't relevant here.
The reason both operations are valuable is that they have different outputs. They both return two lists, but don't be fooled! DigraphShortestPath returns
whereas DigraphDijkstra returns
The issue here is that "DigraphDijkstra" isn't a helpful name. We usually name our operations after the thing they return rather than the author of the core algorithm we're using. The output of DigraphShortestPath is consistent with other "paths" in the package, so this is reasonable. Hence we need a name to replace "Dijkstra".
The main thing that distinguishes Dijkstra from ShortestPath is that it gives information on how to reach multiple vertices in the shortest distance: all vertices in the connected component, or else all the ones it can find while searching for
destination
. Hence, a good option might beDigraphShortestPaths
, which I don't think would be too confusing.We could make this change easily, although we should make sure to preserve DigraphDijkstra as a synonym for backwards compatibility, till 2.0
Any thoughts?
The text was updated successfully, but these errors were encountered: