pub struct GraphGrammar<I: Index, NL: Label, EL: Label> {
    pub start_graph: Graph<I, NL, EL>,
    pub productions: HashMap<String, Production<I, NL, EL>>,
    pub terminal_nodes: HashSet<NL>,
}
Expand description

A GraphGrammar yields different graphs, that are constructible using a starting graph and a list of transformations (productions). It is also used to further transform generated graphs using evolve. Refer to generate_random.

Fields

start_graph: Graph<I, NL, EL>

Starting graph

productions: HashMap<String, Production<I, NL, EL>>

Number of productions, that transform a matching subgraph to another

terminal_nodes: HashSet<NL>

List of terminal nodes. A graph has to consist only of terminal nodes to be considered valid.

Implementations

Applies a random production, that can applied. This function is very expensive. Return None if it can’t be transformed.

A graph has to consist only of terminal nodes to be considered valid. This validates if a graph g is valid under the used GraphGrammar.

Evolves g by applying productions of the GraphGrammar until the first condition specified in qc is statisfied and returns the resulting graph.

Similar to evolve. Returns the first valid graph that is part of the language specified by the grammar using random productions on the starting graph.

Panics

Panics if quitcondition is invalid.

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

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. 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.