Spec
TreeA 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. |
Interface Function Overview
-
TVertexDescriptor(g, parent[, cargo]);
Adds a new child vertex to a parent vertex, optionally with an edge cargo. -
void assignRoot(t, v);
Assign a new root vertex to the tree. -
TVertexDescriptor childVertex(g, e);
Returns the child vertex of an edge. -
void collectLeaves(g, v, group);
Returns all leaves underneath a given vertex. -
void createRoot(t);
Creates the root for the tree. -
TVertexDescriptor getRoot(t);
Gets the root of the tree. -
bool isLeaf(g, v);
Tests whether a given vertex is a leaf or not. -
bool isRoot(t, v);
Tests whether a given vertex is the root or not. -
TSize numChildren(g, v);
Number of children of a given tree vertex. -
TSize numTreeEdges(g);
Number of tree edges. -
TVertexDescriptor childVertex(g, e);, TVertexDescriptor childVertex(g, v);
Returns the parent vertex of an edge. -
void removeAllChildren(g, parent);
Removes all children from the tree given a parent. -
void removeChidl(g, parent, child);
Removes a child from the tree given a parent. -
TVertexDescriptor root(t);
Gets reference to the root of the tree.
Interface Functions Inherited From Graph
addEdge
addEdges
addVertex
assignEdgeMap
assignVertexMap
clear
clearEdges
clearVertices
degree
empty
findEdge
getAdjacencyMatrix
getNil
getVertexAdjacencyVector
inDegree
numEdges
numVertices
outDegree
removeEdge
removeInEdges
removeOutEdges
removeVertex
resizeEdgeMap
resizeVertexMap
sourceVertex
targetVertex
transpose
writeRecords
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. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
void createRoot(t);
Creates the root for the tree.
Parameters
t
|
The Tree to create the root for. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.
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. |
---|
Data Races
If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.