Struct nannou::geom::graph::Graph[][src]

pub struct Graph<S = Default> where
    S: BaseFloat
{ /* fields omitted */ }

A composition of geometry described by an acyclic directed graph.

The Nodes within a graph may describe some primitive geometry (e.g. Line, Cuboid, etc) or may contain other Graphs. This allows graphs to be composed of other graphs, which may then be composed with other graphs, etc.

The Edges within a graph describe the relationships between the nodes. They allow for describing the position, orientation and scale of nodes relative to others.

All Nodes other than the graph's "origin" node must have at least one parent, but may never have more than one parent of each edge::Kind.

Methods

impl<S> Graph<S> where
    S: BaseFloat
[src]

Construct a new empty Graph with a single "origin" node.

The "origin" is the "parent-most" of all nodes. Its transform is always equal to Transform::default().

Calling this is the same as calling Graph::default().

The node::Index of the origin node.

Construct the graph with pre-allocated buffers for the given nodes, edges and vertices capacities.

The total number of Nodes in the Graph.

The total number of Edges in the Graph.

Borrow the node at the given node::Index if there is one.

Determine the full Transform for the Node.

Returns None if the node does not exist.

Transform the given vertices with the given node's Transform.

This method uses the node_transform method internally.

Returns None if the node does not exist.

Transform the given triangles with the given node's Transform.

This method uses the node_transform method internally.

Returns None if the node does not exist.

Borrow the edge at the given edge::Index if there is one.

The slice containing all nodes.

The slice containing all edges.

Removes all Nodes, Edges and vertices from the Graph and resets the origin node.

This does not de-allocate any buffers and should retain capacity. To drop all inner buffers, use mem::replace with a new empty Graph.

Return the parent and child nodes on either end of the Edge at the given index.

A Walker type that recursively walks the Graph using the given recursive_fn.

Panics If the given start index does not exist within the Graph.

Borrow the inner daggy::Dag (directed acyclic graph) upon which Graph is built.

Can be useful/necessary for utilising some of the daggy::Walker types.

Add the given Node to the graph.

The created node will be a child of the graph's origin node.

Returns the index of the new node.

Set the given Edge within the graph.

The added edge will be in the direction a -> b

There may only ever be one Edge of the given variant between a -> b.

Checks if the edge would create a cycle in the Graph.

If adding the edge would not cause the graph to cycle, the edge will be added and its edge::Index returned.

If adding the edge would cause the graph to cycle, the edge will not be added and instead a WouldCycle error with the given weight will be returned.

Panics if either a or b do not exist within the Graph.

Panics if the Graph is at the maximum number of nodes for its index type.

Add the given node as a child to the given parent connected via the given edges.

There may only ever be one Edge of the given variant between a -> b.

Panics if:

  • parent does not exist within the Graph.
  • edges does not contain at least one Edge.
  • the Graph is at the maximum number of nodes for its index type.

Important traits for Vec<u8>

Add the given children to the given parent connected via the given edges for each child.

Returns an iterator yielding the node and edge indices for each child that was added.

There may only ever be one Edge of the given variant between a -> b.

Panics if:

  • parent does not exist within the Graph.
  • any of the child edges iterators do not contain at least one Edge.
  • the Graph is at the maximum number of nodes for its index type.

Produce a walker yielding all vertices from all nodes within the graph in order of discovery within a depth-first-search.

Produce a walker yielding all vertices from all nodes within the graph in order of discovery within a depth-first-search.

Important traits for Vertices<'a, 'b, F, I, S>

Produce an iterator yielding all vertices from all nodes within the graph in order of discovery within a depth-first-search.

Important traits for Triangles<'a, 'b, F, I, V, S>

Produce an iterator yielding all triangles from all nodes within the graph in order of discovery within a depth-first-search.

The Cuboid that bounds all nodes within the geometry graph.

Returns None if the graph contains no vertices.

  1. Iterates over all nodes.
  2. Expands a cuboid to the max bounds of each node.
  3. Returns the resulting cuboid.

A Walker type that may be used to step through the parents of the given child node.

If the Node at the given index has some parent along an Edge of the given variant, return an index to it.

Return the index of the parent along the given node's Position Edge.

Return the index of the parent along the given node's Position Edge.

Return the index of the parent along the given node's Position Edge.

Return the index of the parent along the given node's Position Edge.

Produce an Iterator yielding the Position parents to the given node.

Parents are always yielded in order of axis, e.g. X, Y then Z.

Return the index of the parent along the given node's Orientation Edge.

Return the index of the parent along the given node's Orientation Edge.

Return the index of the parent along the given node's Orientation Edge.

Return the index of the parent along the given node's Orientation Edge.

Produce an Iterator yielding the Orientation parents to the given node.

Parents are always yielded in order of axis, e.g. X, Y then Z.

Return the index of the parent along the given node's Scale Edge.

Return the index of the parent along the given node's Scale Edge.

Return the index of the parent along the given node's Scale Edge.

Return the index of the parent along the given node's Scale Edge.

Produce an Iterator yielding the Scale parents to the given node.

Parents are always yielded in order of axis, e.g. X, Y then Z.

Produce an Iterator yielding the X parents to the given node.

Parents are always yielded in order of Position, Orientation and Scale.

Produce an Iterator yielding the Y parents to the given node.

Parents are always yielded in order of Position, Orientation and Scale.

Produce an Iterator yielding the Z parents to the given node.

Parents are always yielded in order of Position, Orientation and Scale.

A Walker type that may be used to step through the children of the given parent node.

Trait Implementations

impl<'a, S> Walker<&'a Graph<S>> for Dfs<S> where
    S: BaseFloat
[src]

Advance to the next item

Important traits for WalkerIter<W, C>

Create an iterator out of the walker and given context.

impl<S: Clone> Clone for Graph<S> where
    S: BaseFloat
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<S: Debug> Debug for Graph<S> where
    S: BaseFloat
[src]

Formats the value using the given formatter. Read more

impl<S> Default for Graph<S> where
    S: BaseFloat
[src]

Returns the "default value" for a type. Read more

impl<S> GraphBase for Graph<S> where
    S: BaseFloat
[src]

node identifier

edge identifier

impl<S> Visitable for Graph<S> where
    S: BaseFloat
[src]

The associated map type

Create a new visitor map

Reset the visitor map (and resize to new size of graph if needed)

impl<'a, S> IntoNeighbors for &'a Graph<S> where
    S: BaseFloat
[src]

Return an iterator of the neighbors of node a.

impl<S> Index<Index> for Graph<S> where
    S: BaseFloat
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<S> Index<Index> for Graph<S> where
    S: BaseFloat
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<'a, S> Walker<&'a Graph<S>> for Children<S> where
    S: BaseFloat
[src]

Advance to the next item

Important traits for WalkerIter<W, C>

Create an iterator out of the walker and given context.

impl<'a, S> Walker<&'a Graph<S>> for Parents<S> where
    S: BaseFloat
[src]

Advance to the next item

Important traits for WalkerIter<W, C>

Create an iterator out of the walker and given context.

Auto Trait Implementations

impl<S> Send for Graph<S> where
    S: Send

impl<S> Sync for Graph<S> where
    S: Sync