pub enum GraphResult {
VisitOrder,
Reached,
CostTable,
Distance,
Path,
}Expand description
What a graph helper answers.
Variants§
VisitOrder
Vec[T] — every state reached, in the order the walk reached it.
Reached
Set[T] — every state reached, without an order.
CostTable
Map[T, Int] — the least cost from the start to each reachable state.
A state that is not reachable is simply absent, which is why this needs
no Option.
Distance
Option[Int] — the cost of the cheapest path to a goal, or None when
no goal is reachable. “Unreachable” is an ordinary outcome of a search,
not a fault, and a sentinel -1 would be a number nobody wrote.
Path
Option[Vec[T]] — the route to the goal a search stopped at, from the
start to the goal inclusive, or None when no goal is reachable.
The Option is Distance’s, for the same reason: a
helper that takes a goal may not find one. An empty Vec could not
stand for that, because a route that was found always holds at least
its own start — so “no route” and “a route of nothing” would be the same
value.
Trait Implementations§
Source§impl Clone for GraphResult
impl Clone for GraphResult
Source§fn clone(&self) -> GraphResult
fn clone(&self) -> GraphResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more