pub trait WithBuilder: WithEdge {
type Builder: Builder<Graph = Self>;
// Provided methods
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_regular<R: Rng>(d: usize, n: usize, rng: R) -> Option<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 { ... }
}Expand description
A graph that has a Builder.
See the module documentation for examples.
Required Associated Types§
Provided Methods§
Sourcefn builder(num_vertices: usize, num_edges: usize) -> Self::Builder
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.
Sourcefn new_with_edges<I>(n: usize, edges: I) -> Self
fn new_with_edges<I>(n: usize, edges: I) -> Self
Sourcefn new_complete(n: usize) -> Selfwhere
Self: WithEdge<Kind = Undirected>,
fn new_complete(n: usize) -> Selfwhere
Self: WithEdge<Kind = Undirected>,
Creates a complete graph with n vertices.
A complete graph has an edge between each pair of vertices.
Sourcefn new_complete_binary_tree(h: u32) -> Selfwhere
Self: WithEdge<Kind = Undirected>,
fn new_complete_binary_tree(h: u32) -> Selfwhere
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.
Sourcefn new_regular<R: Rng>(d: usize, n: usize, rng: R) -> Option<Self>where
Self: WithEdge<Kind = Undirected>,
fn new_regular<R: Rng>(d: usize, n: usize, rng: R) -> Option<Self>where
Self: WithEdge<Kind = Undirected>,
Creates a new d-regular graph.
Return None if d >= n of if d * n is not even.
Sourcefn new_random_tree<R: Rng>(n: usize, rng: R) -> Self
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.
Sourcefn new_random_tree_with_diameter<R: Rng>(n: u32, d: u32, rng: R) -> Option<Self>
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.
Sourcefn new_gn_connected<R: Rng>(n: usize, rng: R) -> Selfwhere
Self::Kind: UniformEdgeKind,
fn new_gn_connected<R: Rng>(n: usize, rng: R) -> Selfwhere
Self::Kind: UniformEdgeKind,
Creates a random connected graph with n vertices.
Sourcefn new_gnm<R>(n: usize, m: usize, rng: R) -> Option<Self>
fn new_gnm<R>(n: usize, m: usize, rng: R) -> Option<Self>
Creates a random graph with n vertices and m edges.
Returns None with m exceeds the maximum number of edges.
Sourcefn new_gnm_connected<R: Rng>(n: usize, m: usize, rng: R) -> Option<Self>where
Self::Kind: UniformEdgeKind,
fn new_gnm_connected<R: Rng>(n: usize, m: usize, rng: R) -> Option<Self>where
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.