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>

source

pub fn new() -> Self

Constructs a new TransitNetwork with an empty PhysicalGraph and TopologyGraph.

Returns

A new TransitNetwork instance.

source

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>

source§

fn clone(&self) -> TransitNetwork<R, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<R: Debug + Copy, T: Debug + CoordNum> Debug for TransitNetwork<R, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

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

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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

source§

fn find_shortest_path(&self, from: NodeId, to: NodeId) -> Option<Vec<NodeId>>

Finds the shortest path from the start node to the destination node. Read more
source§

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,

Calculates the cost of traversing from one node to another, considering the accessibility of the destination node. Read more
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. Read more
source§

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

Adds a TransitNode to the physical graph of the network.

Arguments
  • node - The TransitNode to be added to the network.
Returns
  • NodeId - The ID of the added node.
source§

fn add_edge(&mut self, edge: TransitEdge<T>)

Adds a TransitEdge to the physical graph of the network.

Arguments
  • edge - The TransitEdge to be added to the network.
source§

fn add_edge_with_accessibility( &mut self, edge: TransitEdge<T>, accessability: Accessability )

Adds a TransitEdge to the network with a given accessibility. Read more
source§

impl<R: Copy + EuclideanDistance<T, Coord<T>>, T: CoordNum> TransitNetworkRepairer<R, T> for TransitNetwork<R, T>

source§

fn repair_edge(&mut self, node1: NodeId, node2: NodeId)

Repairs the edge between two nodes in the network. Read more
source§

fn repair(&mut self)

Repairs the entire network. Read more

Auto Trait Implementations§

§

impl<R, T> RefUnwindSafe for TransitNetwork<R, T>where R: RefUnwindSafe, T: RefUnwindSafe,

§

impl<R, T> Send for TransitNetwork<R, T>where R: Send, T: Send,

§

impl<R, T> Sync for TransitNetwork<R, T>where R: Sync, T: Sync,

§

impl<R, T> Unpin for TransitNetwork<R, T>where R: Unpin, T: Unpin,

§

impl<R, T> UnwindSafe for TransitNetwork<R, T>where R: UnwindSafe, T: UnwindSafe,

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.
§

impl<G1, G2> Within<G2> for G1where G2: Contains<G1>,

§

fn is_within(&self, b: &G2) -> bool