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 theCoordNumtrait.
Required Methods§
Sourcefn calc_edge_cost<F>(
&self,
from: NodeId,
to: NodeId,
accessability: &Accessability,
edge_cost: &mut F,
) -> f64
fn calc_edge_cost<F>( &self, from: NodeId, to: NodeId, accessability: &Accessability, edge_cost: &mut F, ) -> 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 fromfromnode totonode.
Sourcefn find_shortest_path_with_accessability<F>(
&self,
from: NodeId,
to: NodeId,
accessability: Accessability,
edge_cost: F,
) -> Option<(f64, Vec<NodeId>)>
fn find_shortest_path_with_accessability<F>( &self, from: NodeId, to: NodeId, accessability: Accessability, edge_cost: F, ) -> Option<(f64, Vec<NodeId>)>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.