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

A ‘prototype’ chunk graph that is (relatively) inefficient to traverse but easy to modify. This is usually used to build and optimise the chunk graph before being converted into an efficient graph representation for use in tree search.

Implementations

Optimisation

Repeatedly apply a sequence of Passes until the graph stops getting smaller, or 20 iterations are made. Use Graph::optimise_with_iter_limit to set a custom iteration limit.

Repeatedly apply a sequence of Passes until the graph either becomes static, or limit many iterations are performed.

For each start chunk in self, creates a copy of self with only that start chunk. This partitions the set of generated compositions across these Graphs, but allows for better optimisations because more is known about each Graph.

Return a value representing the ‘size’ of this graph. Optimisation passes are required to never increase this quantity. Graph size is compared on the following factors (in order of precedence, most important first):

  1. Number of nodes (smaller is better)
  2. Number of links (smaller is better)
  3. Number of required nodes (more is better)

Helpers for optimisation passes

Removes all chunks for whom pred returns false

Removes all links for whom pred returns false. The parameters of pred are (link, chunk_from, chunk_to)

Remove elements from Self::start_chunks for which a predicate returns false.

Remove elements from Self::end_chunks for which a predicate returns false.

Getters & Iterators

An Iterator over the ChunkId of every Chunk in this Graph

An Iterator over every Chunk in this Graph (including its ChunkId)

An Iterator over every Chunk in this Graph, without its ChunkId.

A mutable Iterator over the ChunkId of every Chunk in this Graph

Generate a graph of all chunks which are reachable within a given length constraint.

Trait Implementations

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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more