Struct graph::walkers::best::BestFirst

source ·
pub struct BestFirst<'a, I, N, E, Ty, Ix, F> {
    pub direction: Direction,
    pub h: F,
    /* private fields */
}
Expand description

Best first implementation.

This is a key function that is later used to implement variants, this is possible due to the pattern all variants repeat, where only the heuristics function changes but te procedure is the same.

The following searching methods are implemented using this function: - Dijkstra - A* - A* Weighted - Greedy best first

The function takes a function h of type F for computing the heuristic value for each node. This function F has access to the node index on the graph, the edge index of the connection to its parent, the current state of the search instance and the index of its parent. With all these values, any heuristic can be calculated, I presume.

Fields§

§direction: Direction§h: F

Implementations§

source§

impl<'a, I, N, E, Ty: EdgeType, Ix: IndexType, F> BestFirst<'a, I, N, E, Ty, Ix, F>where F: Fn(NodeIndex<Ix>, EdgeIndex<Ix>, f32, NodeIndex<Ix>) -> f32,

source

pub fn new( graph: &'a Graph<I, N, E, Ty, Ix>, journey: (NodeIndex<Ix>, Option<NodeIndex<Ix>>), h: F, direction: Direction ) -> Self

Trait Implementations§

source§

impl<'a, I, N, E, Ty: EdgeType, Ix: IndexType, F> Walker<Ix> for BestFirst<'a, I, N, E, Ty, Ix, F>where F: Fn(NodeIndex<Ix>, EdgeIndex<Ix>, f32, NodeIndex<Ix>) -> f32,

source§

fn step(&mut self) -> WalkerState<Ix>

Auto Trait Implementations§

§

impl<'a, I, N, E, Ty, Ix, F> RefUnwindSafe for BestFirst<'a, I, N, E, Ty, Ix, F>where E: RefUnwindSafe, F: RefUnwindSafe, I: RefUnwindSafe, Ix: RefUnwindSafe, N: RefUnwindSafe, Ty: RefUnwindSafe,

§

impl<'a, I, N, E, Ty, Ix, F> !Send for BestFirst<'a, I, N, E, Ty, Ix, F>

§

impl<'a, I, N, E, Ty, Ix, F> !Sync for BestFirst<'a, I, N, E, Ty, Ix, F>

§

impl<'a, I, N, E, Ty, Ix, F> Unpin for BestFirst<'a, I, N, E, Ty, Ix, F>where F: Unpin, Ix: Unpin,

§

impl<'a, I, N, E, Ty, Ix, F> UnwindSafe for BestFirst<'a, I, N, E, Ty, Ix, F>where E: RefUnwindSafe, F: UnwindSafe, I: RefUnwindSafe, Ix: UnwindSafe + RefUnwindSafe, N: RefUnwindSafe, Ty: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.