Skip to content

Commit 2957506

Browse files
authored
Add section on utility functions for paths (#409)
Give short descriptions of utility functions (as mentioned in the first paragraph) that complement the main shortest path algorithms.
1 parent 24539fd commit 2957506

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

docs/src/first_steps/paths_traversal.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,17 @@ The following properties always hold for shortest path algorithms implemented he
3333
- The distance from a vertex to itself is always `0`.
3434
- The distance between two vertices with no connecting edge is always `Inf` or `typemax(eltype(distmx))`.
3535

36-
The [`dijkstra_shortest_paths`](@ref), [`desopo_pape_shortest_paths`](@ref), [`floyd_warshall_shortest_paths`](@ref), [`bellman_ford_shortest_paths`](@ref), and [`yen_k_shortest_paths`](@ref) functions return path states (subtypes of `Graphs.AbstractPathState`) that contain various information about the graph learned during traversal.
36+
The [`dijkstra_shortest_paths`](@ref), [`desopo_pape_shortest_paths`](@ref), [`floyd_warshall_shortest_paths`](@ref), [`bellman_ford_shortest_paths`](@ref), and [`yen_k_shortest_paths`](@ref) functions return _path states_ (subtypes of `Graphs.AbstractPathState`) that contain various information about the graph learned during traversal.
3737

3838
The corresponding state types (with the exception of `YenState`) have the following common fields:
3939

4040
- `state.dists` holds a vector with the distances computed, indexed by source vertex.
4141
- `state.parents` holds a vector of parents of each vertex on the shortest paths (the parent of a source vertex is always `0`). `YenState` substitutes `.paths` for `.parents`.
4242

43-
In addition, with the appropriate optional arguments, [`dijkstra_shortest_paths`](@ref) will return information on all possible shortest paths available from the source.
43+
In addition, with the appropriate optional arguments, [`dijkstra_shortest_paths`](@ref) will return information on all possible shortest paths available from the source.
44+
45+
## Utility functions
46+
47+
- Once a path state is found using a shortest path algorithm, some or all of the paths can be obtained using [`enumerate_paths`](@ref).
48+
- A longest path within a directed acyclic graph can be found with [`dag_longest_path`](@ref).
49+
- In the case of a graph with some edges having negative weights, the existence of a cycle whose edges sum to a negative value can be detected with [`has_negative_edge_cycle_spfa`](@ref).

0 commit comments

Comments
 (0)