Skip to main content

Graph

Trait Graph 

Source
pub trait Graph {
    // Required methods
    fn vertex_count(&self) -> usize;
    fn neighbors(&self, vertex: Vertex, emit: impl FnMut(Vertex));
}
Expand description

A finite directed graph over vertices 0..vertex_count().

Agents move along edges or wait in place; waits are implicit and must not be reported as self-loops. For undirected graphs, report every edge in both directions.

Required Methods§

Source

fn vertex_count(&self) -> usize

The number of vertices. Vertex ids are 0..vertex_count().

Source

fn neighbors(&self, vertex: Vertex, emit: impl FnMut(Vertex))

Calls emit once for every out-neighbour of vertex.

vertex is always below Graph::vertex_count.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§