pub trait ShortestPathWithAccessability<R, T: CoordNum> {
    // Required methods
    fn calc_edge_cost<F>(
        &self,
        from: NodeId,
        to: NodeId,
        accessability: &Accessability,
        edge_cost: &mut F
    ) -> f64
       where F: FnMut(TransitEdge<T>) -> f64;
    fn find_shortest_path_with_accessability<F>(
        &self,
        from: NodeId,
        to: NodeId,
        accessability: Accessability,
        edge_cost: F
    ) -> Option<(f64, Vec<NodeId>)>
       where F: FnMut(TransitEdge<T>) -> f64;
}
Expand description

This trait provides methods for finding the shortest path between two nodes in a graph with consideration for the accessibility of nodes.

Type Parameters

  • R: The type that represents the route or connection between nodes.
  • T: The type that represents the coordinate number used in the nodes. This should implement the CoordNum trait.

Required Methods§

source

fn calc_edge_cost<F>( &self, from: NodeId, to: NodeId, accessability: &Accessability, edge_cost: &mut F ) -> f64where F: FnMut(TransitEdge<T>) -> f64,

Calculates the cost of traversing from one node to another, considering the accessibility of the destination node.

Arguments
  • from - The ID of the node from where the traversal starts.
  • to - The ID of the node to which the traversal ends.
  • accessability - A reference to the accessibility information for nodes in the network.
  • edge_cost - A mutable reference to a function that calculates the cost of traversing an edge.
Returns
  • f64 - The cost of the traversal from from node to to node.
source

fn find_shortest_path_with_accessability<F>( &self, from: NodeId, to: NodeId, accessability: Accessability, edge_cost: F ) -> Option<(f64, Vec<NodeId>)>where F: FnMut(TransitEdge<T>) -> f64,

Finds the shortest path between two nodes considering the accessibility of nodes.

Arguments
  • from - The ID of the starting node.
  • to - The ID of the destination node.
  • accessability - The accessibility information for nodes in the network.
  • edge_cost - A function to calculate the cost of traversing an edge.
Returns
  • Option<(f64, Vec<NodeId>)> - A tuple containing the length of the shortest path and the nodes in the path, or None if no path exists.

Implementors§

source§

impl<R: Copy, T: CoordNum> ShortestPathWithAccessability<R, T> for TransitNetwork<R, T>