Struct transit_grid::graphs::TransitNetwork
source · pub struct TransitNetwork<R: Copy, T: CoordNum> {
pub physical_graph: PhysicalGraph<R, T>,
pub topology_graph: TopologyGraph,
}
Expand description
Represents a transit network as a graph with transit nodes and edges.
The struct holds a physical graph and a topological graph which are lower-level representations of the network.
TransitNetwork
provides a higher-level interface to the physical graph and topological graph.
The struct implements TransitNetworkModifier
trait for modifying the underlying physical graph.
Generics
R
: Copyable trait bound. This represents the type of the data associated with the network’s routes.
T
: This represents the type of the coordinates used in the network. It’s expected to implement CoordNum
trait.
Fields
physical_graph: PhysicalGraph<R, T>
- The physical graph representing the transit network.topology_graph: TopologyGraph
- The topological graph representing the transit network.
Fields§
§physical_graph: PhysicalGraph<R, T>
The physical graph representing the transit network.
topology_graph: TopologyGraph
The topological graph representing the transit network.
Implementations§
source§impl<R: Copy, T: CoordNum> TransitNetwork<R, T>
impl<R: Copy, T: CoordNum> TransitNetwork<R, T>
sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new TransitNetwork
with an empty PhysicalGraph
and TopologyGraph
.
Returns
A new TransitNetwork
instance.
sourcepub fn get_edge_by_id(&self, edge_id: EdgeId) -> Option<&TransitEdge<T>>
pub fn get_edge_by_id(&self, edge_id: EdgeId) -> Option<&TransitEdge<T>>
Returns a reference to the TransitNode
with the given ID.
Trait Implementations§
source§impl<R: Clone + Copy, T: Clone + CoordNum> Clone for TransitNetwork<R, T>
impl<R: Clone + Copy, T: Clone + CoordNum> Clone for TransitNetwork<R, T>
source§fn clone(&self) -> TransitNetwork<R, T>
fn clone(&self) -> TransitNetwork<R, T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<R: Copy, T: CoordNum> Default for TransitNetwork<R, T>
impl<R: Copy, T: CoordNum> Default for TransitNetwork<R, T>
source§impl<R: Copy, T: CoordNum> PartialEq<TransitNetwork<R, T>> for TransitNetwork<R, T>
impl<R: Copy, T: CoordNum> PartialEq<TransitNetwork<R, T>> for TransitNetwork<R, T>
source§impl<R: Copy, T: CoordNum> ShortestPath<R, T> for TransitNetwork<R, T>
impl<R: Copy, T: CoordNum> ShortestPath<R, T> for TransitNetwork<R, T>
source§impl<R: Copy, T: CoordNum> ShortestPathWithAccessability<R, T> for TransitNetwork<R, T>
impl<R: Copy, T: CoordNum> ShortestPathWithAccessability<R, T> for TransitNetwork<R, T>
source§fn calc_edge_cost<F>(
&self,
from: NodeId,
to: NodeId,
accessability: &Accessability,
edge_cost: &mut F
) -> f64where
F: FnMut(TransitEdge<T>) -> f64,
fn calc_edge_cost<F>( &self, from: NodeId, to: NodeId, accessability: &Accessability, edge_cost: &mut F ) -> f64where F: FnMut(TransitEdge<T>) -> f64,
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,
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,
source§impl<R: Copy, T: CoordNum> TransitNetworkModifier<R, T> for TransitNetwork<R, T>
impl<R: Copy, T: CoordNum> TransitNetworkModifier<R, T> for TransitNetwork<R, T>
Implementation of TransitNetworkModifier
trait for TransitNetwork
.
This implementation delegates the operations to the underlying physical graph.
source§fn add_node(&mut self, node: TransitNode<R>) -> NodeId
fn add_node(&mut self, node: TransitNode<R>) -> NodeId
source§fn add_edge(&mut self, edge: TransitEdge<T>)
fn add_edge(&mut self, edge: TransitEdge<T>)
Adds a TransitEdge
to the physical graph of the network.
Arguments
edge
- TheTransitEdge
to be added to the network.
source§fn add_edge_with_accessibility(
&mut self,
edge: TransitEdge<T>,
accessability: Accessability
)
fn add_edge_with_accessibility( &mut self, edge: TransitEdge<T>, accessability: Accessability )
TransitEdge
to the network with a given accessibility. Read more