pub struct TopologyGraph { /* private fields */ }Expand description
Lazy-rebuilt connectivity graph for topology queries.
Tracks which stops are reachable from which, via which groups/lines.
Rebuilt from ElevatorGroup data when marked dirty.
Implementations§
Source§impl TopologyGraph
impl TopologyGraph
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new topology graph (starts dirty so the first query triggers a rebuild).
Sourcepub const fn mark_dirty(&mut self)
pub const fn mark_dirty(&mut self)
Mark the graph as needing rebuild.
Sourcepub fn rebuild(&mut self, groups: &[ElevatorGroup])
pub fn rebuild(&mut self, groups: &[ElevatorGroup])
Rebuild the graph from current group/line topology.
Sourcepub fn reachable_stops_from(&self, stop: EntityId) -> Vec<EntityId>
pub fn reachable_stops_from(&self, stop: EntityId) -> Vec<EntityId>
All stops reachable from a given stop (BFS).
Returns every reachable stop except the origin. If the origin has no outgoing edges the result is empty.
Sourcepub fn transfer_points(groups: &[ElevatorGroup]) -> Vec<EntityId>
pub fn transfer_points(groups: &[ElevatorGroup]) -> Vec<EntityId>
Stops that appear in two or more groups (transfer points).
This inspects group membership directly and does not require the adjacency graph. Note: this checks group membership only, not whether riders can actually transfer between groups at the shared stop. A stop served by two disconnected groups would still appear here.
Sourcepub fn shortest_route(&self, from: EntityId, to: EntityId) -> Option<Route>
pub fn shortest_route(&self, from: EntityId, to: EntityId) -> Option<Route>
Find the shortest route from one stop to another (BFS on groups).
Returns None if to is unreachable from from, or if from == to.
Each edge traversal becomes one RouteLeg; consecutive stops sharing
the same group naturally coalesce into a single leg when the caller
chooses to, but the raw path is returned as individual per-hop legs so
the consumer can decide on merging strategy.