A special kind of graph in the form of a tree with directed edges and optional edge annotations of templatized type "TYPE_EDGES".
The tree is represented by means of:
This class is less general than CDirectedGraph but more efficient to traverse (see visitDepthFirst and visitBreadthFirst).
If annotations in edges are not required, you can leave TYPE_EDGES to its default type "uint8_t".
#include <mrpt/graphs/CDirectedTree.h>
Classes | |
| struct | TEdgeInfo |
| struct | Visitor |
| Virtual base class for user-defined visitors. More... | |
Public Types | |
| typedef std::list< TEdgeInfo > | TListEdges |
| typedef std::map< TNodeID, TListEdges > | TMapNode2ListEdges |
Public Member Functions | |
Utilities | |
| void | clear () |
| Empty all edge data and set "root" to INVALID_NODEID. | |
| void | visitDepthFirst (const TNodeID root, Visitor &user_visitor, const size_t root_depth_level=0) const |
| Depth-first visit of all children nodes of a given root (itself excluded from the visit), invoking a user-provided function for each node/edge. | |
| void | visitBreadthFirst (const TNodeID root, Visitor &user_visitor, const size_t root_depth_level=0) const |
| Breadth-first visit of all children nodes of a given root (itself excluded from the visit), invoking a user-provided function for each node/edge. | |
| std::string | getAsTextDescription () const |
| Return a text representation of the tree spanned in a depth-first view, as in this example: | |
Public Attributes | |
Data | |
| TNodeID | root |
| The root of the tree. | |
| TMapNode2ListEdges | edges_to_children |
| The edges of each node. | |
Definition at line 64 of file CDirectedTree.h.
Definition at line 65 of file CDirectedTree.h.
| void mrpt::graphs::CDirectedTree::clear | ( | void | ) | [inline] |
Empty all edge data and set "root" to INVALID_NODEID.
Definition at line 77 of file CDirectedTree.h.
References edges_to_children, root, and INVALID_NODEID.
Referenced by mrpt::graphs::CDijkstra::getTreeGraph().
| std::string mrpt::graphs::CDirectedTree::getAsTextDescription | ( | ) | const [inline] |
Return a text representation of the tree spanned in a depth-first view, as in this example:
0
-> 1
-> 2
-> 4
-> 5
-> 3
Definition at line 130 of file CDirectedTree.h.
References mrpt::graphs::CDirectedTree::TEdgeInfo::reverse, mrpt::graphs::CDirectedTree::TEdgeInfo::id, root, and visitDepthFirst().
| void mrpt::graphs::CDirectedTree::visitBreadthFirst | ( | const TNodeID | root, |
| Visitor & | user_visitor, | ||
| const size_t | root_depth_level = 0 |
||
| ) | const [inline] |
Breadth-first visit of all children nodes of a given root (itself excluded from the visit), invoking a user-provided function for each node/edge.
Definition at line 108 of file CDirectedTree.h.
References edges_to_children, and visitDepthFirst().
| void mrpt::graphs::CDirectedTree::visitDepthFirst | ( | const TNodeID | root, |
| Visitor & | user_visitor, | ||
| const size_t | root_depth_level = 0 |
||
| ) | const [inline] |
Depth-first visit of all children nodes of a given root (itself excluded from the visit), invoking a user-provided function for each node/edge.
Definition at line 94 of file CDirectedTree.h.
References edges_to_children.
Referenced by visitBreadthFirst(), and getAsTextDescription().
The edges of each node.
Definition at line 70 of file CDirectedTree.h.
Referenced by clear(), visitDepthFirst(), visitBreadthFirst(), and mrpt::graphs::CDijkstra::getTreeGraph().
The root of the tree.
Definition at line 69 of file CDirectedTree.h.
Referenced by clear(), getAsTextDescription(), and mrpt::graphs::CDijkstra::getTreeGraph().
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |