Trait fera_graph::builder::WithBuilder
[−]
[src]
pub trait WithBuilder: WithEdge { type Builder: Builder<Graph = Self>; fn builder(num_vertices: usize, num_edges: usize) -> Self::Builder { ... } fn new_with_edges<I>(n: usize, edges: I) -> Self
where
I: IntoIterator<Item = (usize, usize)>, { ... } fn new_empty(n: usize) -> Self { ... } fn new_complete(n: usize) -> Self
where
Self: WithEdge<Kind = Undirected>, { ... } fn new_complete_binary_tree(h: u32) -> Self
where
Self: WithEdge<Kind = Undirected>, { ... } fn new_random_tree<R: Rng>(n: usize, rng: R) -> Self { ... } fn new_random_tree_with_diameter<R: Rng>(
n: u32,
d: u32,
rng: R
) -> Option<Self> { ... } fn new_gn<R>(n: usize, rng: R) -> Self
where
Self::Kind: UniformEdgeKind,
R: Rng, { ... } fn new_gn_connected<R: Rng>(n: usize, rng: R) -> Self
where
Self::Kind: UniformEdgeKind, { ... } fn new_gnm<R>(n: usize, m: usize, rng: R) -> Option<Self>
where
Self::Kind: UniformEdgeKind,
R: Rng, { ... } fn new_gnm_connected<R: Rng>(n: usize, m: usize, rng: R) -> Option<Self>
where
Self::Kind: UniformEdgeKind, { ... } }
A graph that has a Builder
.
See the module documentation for examples.
Associated Types
Provided Methods
fn builder(num_vertices: usize, num_edges: usize) -> Self::Builder
Creates a new builder for a graph of this type with n
vertices and initial capacity for
m
edges.
fn new_with_edges<I>(n: usize, edges: I) -> Self where
I: IntoIterator<Item = (usize, usize)>,
I: IntoIterator<Item = (usize, usize)>,
fn new_empty(n: usize) -> Self
Creates a graph with n
vertices and no edges.
fn new_complete(n: usize) -> Self where
Self: WithEdge<Kind = Undirected>,
Self: WithEdge<Kind = Undirected>,
Creates a complete graph with n
vertices.
A complete graph has an edge between each pair of vertices.
fn new_complete_binary_tree(h: u32) -> Self where
Self: WithEdge<Kind = Undirected>,
Self: WithEdge<Kind = Undirected>,
Creates a graph that is a complete binary tree with height h
.
In complete binary tree all interior vertices have two children an all leaves have the same depth.
fn new_random_tree<R: Rng>(n: usize, rng: R) -> Self
Creates a graph with n
vertices that is a tree, that is, is connected and acyclic.
The graph has n - 1
edges if n > 0
or zero edges if n = 0
.
fn new_random_tree_with_diameter<R: Rng>(n: u32, d: u32, rng: R) -> Option<Self>
Similar to [new_random_tree
] but creates a tree with diameter d
. Returns None
if the diameter is invalid.
fn new_gn<R>(n: usize, rng: R) -> Self where
Self::Kind: UniformEdgeKind,
R: Rng,
Self::Kind: UniformEdgeKind,
R: Rng,
Creates a random graph with n
vertices.
fn new_gn_connected<R: Rng>(n: usize, rng: R) -> Self where
Self::Kind: UniformEdgeKind,
Self::Kind: UniformEdgeKind,
Creates a random connected graph with n
vertices.
fn new_gnm<R>(n: usize, m: usize, rng: R) -> Option<Self> where
Self::Kind: UniformEdgeKind,
R: Rng,
Self::Kind: UniformEdgeKind,
R: Rng,
Creates a random graph with n
vertices and m
edges.
Returns None
with m
exceeds the maximum number of edges.
fn new_gnm_connected<R: Rng>(n: usize, m: usize, rng: R) -> Option<Self> where
Self::Kind: UniformEdgeKind,
Self::Kind: UniformEdgeKind,
Creates a random connected graph (weakly connected if Self
is a digraph) with n
vertices and m
edges.
Returns None
if m
exceeds the maximum number of edges or if m
is less than n - 1
.
Implementors
impl<V: Num, K: StaticEdgeKind> WithBuilder for Static<V, K> type Builder = StaticBuilder<V, K>;