pub struct DirectedAcyclicGraph { /* private fields */ }
Expand description

A mutable, single-threaded directed acyclic graph.

Implementations

Constructs a DAG from an iterator of edges.

Requires u < vertex_count && v < vertex_count && u < v for every edge (u, v) in edges. Panics otherwise.

Generate a random DAG sampling edges from edges_distribution.

For example, to generate a random DAG with a probability 1/2 of having an edge between any two of 321 vertices, do:

use crate::DirectedAcyclicGraph;
use rand::rngs::StdRng;
use rand::SeedableRng;
use rand::distributions::Bernoulli;

let mut rng = StdRng::seed_from_u64(123);
let dag = DirectedAcyclicGraph::random(321, &mut rng, Bernoulli::new(0.5).unwrap());

Construct a DAG from an pre-computed adjacency matrix.

Requires u < v. Panics otherwise.

Requires u < v. Panics otherwise.

Iterates over the edges in an order that favors CPU cache locality.

Iterates over vertices v such that there’s an edge (u, v) in the DAG.

Consume self and return the underlying adjacency matrix.

Trait Implementations

Return an arbitrary value. Read more

Return an iterator of values that are smaller than itself. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.