Trait rs_graph::builder::Buildable [−][src]
pub trait Buildable where
Self: Sized, { type Builder: Builder<Graph = Self>; fn new_builder() -> Self::Builder { ... } fn new_with<F>(f: F) -> Self
where
F: FnOnce(&mut Self::Builder), { ... } }
A graph with a default builder.
Associated Types
Loading content...Provided methods
fn new_builder() -> Self::Builder
[src]
Create a new builder for this graph type.
fn new_with<F>(f: F) -> Self where
F: FnOnce(&mut Self::Builder),
[src]
F: FnOnce(&mut Self::Builder),
Create a new graph by passing the builder to the callback f
.
Example
use rs_graph::{Buildable, Builder, LinkedListGraph}; use rs_graph::traits::GraphSize; let g = LinkedListGraph::<usize>::new_with(|b| { let u = b.add_node(); let v = b.add_node(); b.add_edge(u, v); }); assert_eq!(g.num_nodes(), 2); assert_eq!(g.num_edges(), 1);
Implementors
impl<'a, G, Gx, Nx, Ex> Buildable for Attributed<G, Gx, Nx, Ex> where
G: GraphSize<'a> + Buildable,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default,
[src]
impl<'a, G, Gx, Nx, Ex> Buildable for Attributed<G, Gx, Nx, Ex> where
G: GraphSize<'a> + Buildable,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default,
[src]type Builder = AttributedBuilder<G::Builder, Gx, Nx, Ex>
impl<ID> Buildable for VecGraph<ID> where
ID: PrimInt + Unsigned,
[src]
impl<ID> Buildable for VecGraph<ID> where
ID: PrimInt + Unsigned,
[src]type Builder = VecGraphBuilder<ID>
impl<ID, N, E> Buildable for LinkedListGraph<ID, N, E> where
ID: PrimInt + Unsigned,
N: Default,
E: Default,
[src]
impl<ID, N, E> Buildable for LinkedListGraph<ID, N, E> where
ID: PrimInt + Unsigned,
N: Default,
E: Default,
[src]