Trait fera::graph::builder::Builder

source ·
pub trait Builder {
    type Graph: WithEdge;

    fn new(n: usize, m: usize) -> Self;
    fn add_edge(&mut self, u: usize, v: usize);
    fn finalize(self) -> Self::Graph;
}
Expand description

A builder used to build graphs.

See the module documentation for examples.

Required Associated Types§

The graph type produced by this builder.

Required Methods§

Creates a new builder for a graph with exactly n vertices and initial capacity for m edges.

This method is generally called through WithBuilder::builder, for example, StaticGraph::builder(10, 26).

Add (u, v) edge to the graph. Support for multiple edges and loops are graph dependent.

Panics

If u or v is not a valid vertex, that is >= num_vertices.

Builds the graph.

Implementors§