Spec Tree
A tree.

Extends Graph
All Extended Graph
All Impl'd AssignableConcept, ContainerConcept, DestructibleConcept
Defined in <seqan/graph_types.h>
Signature template <[typename TCargo[, typename TSpec]]> class Graph<Tree<TCargo, TSpec> >;

Template Parameters

TCargo The cargo type that can be attached to the edges. Default: void.
TSpec Specializing type. Default: Default.

Member Function Overview

Member Functions Inherited From AssignableConcept

Interface Function Overview

Interface Functions Inherited From Graph

Interface Functions Inherited From AssignableConcept

Interface Functions Inherited From ContainerConcept

Interface Metafunction Overview

Interface Metafunctions Inherited From Graph

Interface Metafunctions Inherited From ContainerConcept

Detailed Description

A Tree has a distinct root and directed edges. The source vertex of each edge is the parent vertex, the target vertex of each edge is the child. Trees provide fast access to child vertices and the parent.

Interface Functions Detail

TVertexDescriptor(g, parent[, cargo]);

Adds a new child vertex to a parent vertex, optionally with an edge cargo.

Parameters

g The Tree to append the vertex and edge to.
parent Descriptor of the parent vertex.
cargo The cargo to attach to the edge.

Returns

TVertexDescriptor Vertex descriptor of the added vertex.

void assignRoot(t, v);

Assign a new root vertex to the tree.

Parameters

t The Tree to assign the root for.
v A vertex descriptor.

TVertexDescriptor childVertex(g, e);

Returns the child vertex of an edge.

Parameters

g The Tree to query.
e The edge descriptor of the edge to query.

Returns

TVertexDescriptor The descriptor of the child vertex.

void collectLeaves(g, v, group);

Returns all leaves underneath a given vertex.

Parameters

g The Tree to collect the leaves for.
v The root of the subtree to query the leaves of.
group A String of leaf vertex descriptors.

void createRoot(t);

Creates the root for the tree.

Parameters

t The Tree to create the root for.

TVertexDescriptor getRoot(t);

Gets the root of the tree.

Parameters

t The Tree to query for its root.

Returns

TVertexDescriptor The root's vertex descriptor.

bool isLeaf(g, v);

Tests whether a given vertex is a leaf or not.

Parameters

g The Tree to query.
v The descriptor of the vertex to query for.

bool isRoot(t, v);

Tests whether a given vertex is the root or not.

Parameters

a The Tree to query.
t The descriptor of the vertex to query.

Returns

bool true if v is the root and false otherwise.

TSize numChildren(g, v);

Number of children of a given tree vertex.

Parameters

g The Tree to query.
v The descriptor of the vertex to count the children of.

Returns

TSize The number of children.

TSize numTreeEdges(g);

Number of tree edges.

Parameters

g The tree to query.

Returns

TSize The number of tree edges. Faster than numEdges for trees.

TVertexDescriptor childVertex(g, e); TVertexDescriptor childVertex(g, v);

Returns the parent vertex of an edge.

Parameters

g The Tree to query.
e The edge descriptor of the edge to query.
v The descriptor of the vertex to query.

Returns

TVertexDescriptor The descriptor of the child vertex.

void removeAllChildren(g, parent);

Removes all children from the tree given a parent.

Parameters

g The Tree to modify.
parent Descriptor of the vertex to remove children of.

void removeChidl(g, parent, child);

Removes a child from the tree given a parent.

Parameters

g The Tree to remove the vertex from.
parent The descriptor of the parent vertex.
child The descriptor of the child vertex.

TVertexDescriptor root(t);

Gets reference to the root of the tree.

Parameters

t The Tree to query for its root.

Returns

TVertexDescriptor Reference to the root's vertex descriptor.