Skip to main content

Graph

Trait Graph 

Source
pub trait Graph {
    // Required methods
    fn node_count(&self) -> usize;
    fn neighbours(&self, node: usize, out: &mut Vec<(usize, f64)>);

    // Provided method
    fn edge_cost(&self, from: usize, to: usize) -> Option<f64> { ... }
}
Expand description

A directed graph with non-negative edge costs over vertices 0..node_count().

Required Methods§

Source

fn node_count(&self) -> usize

The number of vertices.

Source

fn neighbours(&self, node: usize, out: &mut Vec<(usize, f64)>)

Appends the out-edges (target, cost) of node to out; costs are non-negative and finite.

Provided Methods§

Source

fn edge_cost(&self, from: usize, to: usize) -> Option<f64>

The cost of the edge from -> to, if it exists (the cheapest of parallel edges).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§