Skip to main content

TransitNetwork

Struct 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>

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 duplicate of the value. Read more
1.0.0 (const: unstable) · 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 for TransitNetwork<R, T>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

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, ) -> f64
where 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, T: CoordNum> TransitNetworkRepairer<R, T> for TransitNetwork<R, T>
where Euclidean: Distance<T, R, Coord<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> Freeze for TransitNetwork<R, T>

§

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

§

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> UnsafeUnpin for TransitNetwork<R, T>

§

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

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
§

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

§

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