FindShortestPath
A shortest path from u to v, respecting edge direction (BFS, unweighted).
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
FindShortestPath✓FindShortestPath(g, u, v)the vertices of one shortest path, both ends included; the empty list if is unreachable from .Typed signatures
| Type | Package | Applies |
|---|---|---|
(value, any, any) -> list<any> | combinatorics | always |
Details
- A directed edge is only traversable forward; an undirected edge, either way.
- Weighted (g carries EdgeWeight): the path minimizing summed edge weight (Dijkstra), not the fewest hops — same as Wolfram, which reads EdgeWeight automatically when present. Requires every weight to be non-negative; a negative weight leaves the call unevaluated rather than guess (Dijkstra doesn't support them — Wolfram itself switches algorithm in that case, out of scope here).
Examples
1 more kept as data, checked against the oraclesAbout
| Examples | 4 |
|---|---|
| Checked against | Wolfram Language 3 agree |
| Crosswalk | Wolfram Language |
See also: GraphDistance, GraphDistanceMatrix, Graph