Skip to main content

CchGraph

Trait CchGraph 

Source
pub trait CchGraph {
    // Required methods
    fn num_nodes(&self) -> usize;
    fn num_edges(&self) -> usize;
    fn first_out(&self) -> &[u32];
    fn head(&self) -> &[u32];
    fn x(&self, node_id: u32) -> f32;
    fn y(&self, node_id: u32) -> f32;

    // Provided methods
    fn edge_indices(&self, u: usize) -> Range<usize> { ... }
    fn neighbors(&self, u: u32) -> impl Iterator<Item = u32> + '_ { ... }
}
Expand description

The base graph representation required by the CCH engine.

This trait abstracts the underlying memory layout of your road network, providing the core structural queries needed to build the elimination tree.

Required Methods§

Source

fn num_nodes(&self) -> usize

Returns the total number of nodes in the graph.

Source

fn num_edges(&self) -> usize

Returns the total number of directed edges in the graph.

Source

fn first_out(&self) -> &[u32]

Returns a slice representing the start indices of outgoing edges for each node. Standard CSR (Compressed Sparse Row) format.

Source

fn head(&self) -> &[u32]

Returns a slice of target nodes corresponding to the edges.

Source

fn x(&self, node_id: u32) -> f32

The X-coordinate (longitude) of the given node.

Source

fn y(&self, node_id: u32) -> f32

The Y-coordinate (latitude) of the given node.

Provided Methods§

Source

fn edge_indices(&self, u: usize) -> Range<usize>

Returns the range of edge indices originating from node u.

Source

fn neighbors(&self, u: u32) -> impl Iterator<Item = u32> + '_

Returns an iterator over the target nodes of all outgoing edges from node u.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§