pub trait RailwayGraphAlgos {
    // Required methods
    fn reachable_nodes(&self, start_node_id: NodeId) -> Vec<NodeId>;
    fn reachable_edges(&self, start_node_id: NodeId) -> Vec<EdgeId>;
    fn get_next_node(&self, current: NodeId, target: NodeId) -> Option<NodeId>;
}
Expand description

RailwayGraphAlgos trait provides algorithms for railway graphs.

Required Methods§

source

fn reachable_nodes(&self, start_node_id: NodeId) -> Vec<NodeId>

Find all reachable nodes from the given start node in the railway graph.

This function performs a breadth-first search from the given start node and returns a vector of reachable node IDs.

Arguments
  • start_node_id - The ID of the start node.
Returns

A Vec<i64> containing the IDs of all nodes reachable from the start node. If the start node ID is not found in the graph, an empty vector is returned.

source

fn reachable_edges(&self, start_node_id: NodeId) -> Vec<EdgeId>

Find all reachable edges from the given start node in the railway graph.

This function performs a breadth-first search from the given start node and returns a vector of reachable edge IDs.

Arguments
  • start_node_id - The ID of the start node.
Returns

A Vec<i64> containing the IDs of all edges reachable from the start node. If the start node ID is not found in the graph, an empty vector is returned.

source

fn get_next_node(&self, current: NodeId, target: NodeId) -> Option<NodeId>

Returns the next reachable node on the shortest path

Implementors§