pub trait TraversalModel: Send + Sync {
    // Required methods
    fn state_features(&self) -> Vec<(String, StateFeature)>;
    fn traverse_edge(
        &self,
        trajectory: (&Vertex, &Edge, &Vertex),
        state: &mut Vec<StateVar>,
        state_model: &StateModel
    ) -> Result<(), TraversalModelError>;
    fn estimate_traversal(
        &self,
        od: (&Vertex, &Vertex),
        state: &mut Vec<StateVar>,
        state_model: &StateModel
    ) -> Result<(), TraversalModelError>;
}
Expand description

Dictates how state transitions occur while traversing a graph in a search algorithm.

see the super::default module for implementations bundled with RouteE Compass:

Required Methods§

source

fn state_features(&self) -> Vec<(String, StateFeature)>

lists the state variables expected by this traversal model that are not defined on the base configuration. for example, if this traversal model has state variables that differ based on the query, they can be injected into the state model by listing them here.

source

fn traverse_edge( &self, trajectory: (&Vertex, &Edge, &Vertex), state: &mut Vec<StateVar>, state_model: &StateModel ) -> Result<(), TraversalModelError>

Updates the traversal state by traversing an edge.

§Arguments
  • src - source vertex
  • edge - edge to traverse
  • dst - destination vertex
  • state - state of the search at the beginning of this edge
§Returns

Either a traversal result or an error.

source

fn estimate_traversal( &self, od: (&Vertex, &Vertex), state: &mut Vec<StateVar>, state_model: &StateModel ) -> Result<(), TraversalModelError>

Estimates the traversal state by traversing between two vertices without performing any graph traversals.

§Arguments
  • src - source vertex
  • dst - destination vertex
  • state - state of the search at the source vertex
§Returns

Either a traversal result or an error.

Implementors§