pub struct AStarSearch<'a, N, E, A, F, H, S = DefaultHashBuilder>{ /* private fields */ }
Expand description
An A* Search algorithm implementation for hypergraphs
Implementations§
Source§impl<'a, N, E, A, F, H, S, K, Idx> AStarSearch<'a, N, E, A, F, H, S>where
A: GraphProps<Ix = Idx, Kind = K>,
H: HyperGraph<N, E, A>,
F: Heuristic<Idx>,
S: BuildHasher,
K: GraphType,
Idx: RawIndex,
impl<'a, N, E, A, F, H, S, K, Idx> AStarSearch<'a, N, E, A, F, H, S>where
A: GraphProps<Ix = Idx, Kind = K>,
H: HyperGraph<N, E, A>,
F: Heuristic<Idx>,
S: BuildHasher,
K: GraphType,
Idx: RawIndex,
Sourcepub fn new(graph: &'a H, heuristic: F) -> Selfwhere
S: Default,
pub fn new(graph: &'a H, heuristic: F) -> Selfwhere
S: Default,
Create a new A* search instance with the given heuristic function
Sourcepub fn with_heuristic<G>(
self,
heuristic: G,
) -> AStarSearch<'a, N, E, A, G, H, S>
pub fn with_heuristic<G>( self, heuristic: G, ) -> AStarSearch<'a, N, E, A, G, H, S>
consumes the current instance to create another from the given heuristic function; note: while the functions may be different, the output type of both must match.
pub const fn came_from(&self) -> &HashMap<VertexId<A::Ix>, VertexId<A::Ix>, S>
Sourcepub const fn came_from_mut(
&mut self,
) -> &mut HashMap<VertexId<A::Ix>, VertexId<A::Ix>, S>
pub const fn came_from_mut( &mut self, ) -> &mut HashMap<VertexId<A::Ix>, VertexId<A::Ix>, S>
returns a mutable reference to the map of vertices that have been processed
Sourcepub const fn closed_set(&self) -> &VertexSet<A::Ix, S>
pub const fn closed_set(&self) -> &VertexSet<A::Ix, S>
returns an immutable reference to the closed set of vertices
Sourcepub const fn closed_set_mut(&mut self) -> &mut VertexSet<A::Ix, S>
pub const fn closed_set_mut(&mut self) -> &mut VertexSet<A::Ix, S>
returns a mutable reference to the closed set of vertices
Sourcepub const fn f_score(&self) -> &HashMap<VertexId<A::Ix>, F::Output, S>
pub const fn f_score(&self) -> &HashMap<VertexId<A::Ix>, F::Output, S>
returns an immutable reference to the f_score map
Sourcepub const fn f_score_mut(
&mut self,
) -> &mut HashMap<VertexId<A::Ix>, F::Output, S>
pub const fn f_score_mut( &mut self, ) -> &mut HashMap<VertexId<A::Ix>, F::Output, S>
returns a mutable reference to the f_score map
Sourcepub const fn g_score(&self) -> &HashMap<VertexId<A::Ix>, F::Output, S>
pub const fn g_score(&self) -> &HashMap<VertexId<A::Ix>, F::Output, S>
returns an immutable reference to the g_score map
Sourcepub const fn g_score_mut(
&mut self,
) -> &mut HashMap<VertexId<A::Ix>, F::Output, S>
pub const fn g_score_mut( &mut self, ) -> &mut HashMap<VertexId<A::Ix>, F::Output, S>
returns a mutable reference to the g_score map
Sourcepub const fn heuristic(&self) -> &F
pub const fn heuristic(&self) -> &F
returns an immutable reference to the heuristic function of the algorithm
Sourcepub const fn open_set(&self) -> &VertexSet<A::Ix, S>
pub const fn open_set(&self) -> &VertexSet<A::Ix, S>
returns an immutable reference to the set of vertices that have been visited
Sourcepub const fn open_set_mut(&mut self) -> &mut VertexSet<A::Ix, S>
pub const fn open_set_mut(&mut self) -> &mut VertexSet<A::Ix, S>
returns amutable reference to the open set of vertices
Sourcepub fn has_f_score<Q>(&self, vertex: &Q) -> bool
pub fn has_f_score<Q>(&self, vertex: &Q) -> bool
returns true if the given vertex has a f_score
Sourcepub fn has_g_score<Q>(&self, vertex: &Q) -> bool
pub fn has_g_score<Q>(&self, vertex: &Q) -> bool
returns true if the given vertex has a g_score
Sourcepub fn has_visited<Q>(&self, vertex: &Q) -> bool
pub fn has_visited<Q>(&self, vertex: &Q) -> bool
returns true if the given vertex has been visited
Sourcepub fn in_open_set<Q>(&self, vertex: &Q) -> bool
pub fn in_open_set<Q>(&self, vertex: &Q) -> bool
returns true if the given vertex is in the open set
Sourcepub fn move_open_to_closed(&mut self, vertex: &VertexId<Idx>)
pub fn move_open_to_closed(&mut self, vertex: &VertexId<Idx>)
moves the vertex from the open set before inserting it into the closed set; this is useful for updating the state, marking a node as processed.
Sourcepub fn find_path(
&mut self,
start: VertexId<Idx>,
goal: VertexId<Idx>,
) -> Result<<Self as PathFinder<Idx>>::Path>where
Self: PathFinder<Idx>,
pub fn find_path(
&mut self,
start: VertexId<Idx>,
goal: VertexId<Idx>,
) -> Result<<Self as PathFinder<Idx>>::Path>where
Self: PathFinder<Idx>,
find a path between two nodes