Trait fera_graph::builder::Builder
[−]
[src]
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; }
A builder used to build graphs.
See the module documentation for examples.
Associated Types
Required Methods
fn new(n: usize, m: usize) -> Self
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)
.
fn add_edge(&mut self, u: usize, v: usize)
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
.
fn finalize(self) -> Self::Graph
Builds the graph.
Implementors
impl<V: Num, K: StaticEdgeKind> Builder for StaticBuilder<V, K> type Graph = Static<V, K>;