MRPT
2.0.1
|
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:
Note that nodes are not explicitly listed anywhere: their existence is only inferred from their ID numbers in the list of edges in the edges_to_children data structure. If you want to include information for each node, derive from this class and create a separate container for that data.
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".
Example of insertion of a new edge:
Definition at line 51 of file CDirectedTree.h.
#include <mrpt/graphs/CDirectedTree.h>
Classes | |
struct | TEdgeInfo |
struct | Visitor |
Virtual base class for user-defined visitors. More... | |
Public Types | |
using | TListEdges = std::list< TEdgeInfo > |
using | TMapNode2ListEdges = std::map< TNodeID, TListEdges > |
Public Member Functions | |
Utilities | |
void | clear () |
Empty all edge data and set "root" to INVALID_NODEID. More... | |
void | visitDepthFirst (const TNodeID vroot, 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. More... | |
void | visitBreadthFirst (const TNodeID vroot, 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. More... | |
std::string | getAsTextDescription () const |
Return a text representation of the tree spanned in a depth-first view, as in this example: More... | |
Public Attributes | |
Data | |
TNodeID | root |
The root of the tree. More... | |
TMapNode2ListEdges | edges_to_children |
The edges of each node. More... | |
using mrpt::graphs::CDirectedTree< TYPE_EDGES >::TListEdges = std::list<TEdgeInfo> |
Definition at line 73 of file CDirectedTree.h.
using mrpt::graphs::CDirectedTree< TYPE_EDGES >::TMapNode2ListEdges = std::map<TNodeID, TListEdges> |
Definition at line 74 of file CDirectedTree.h.
|
inline |
Empty all edge data and set "root" to INVALID_NODEID.
Definition at line 88 of file CDirectedTree.h.
Referenced by mrpt::graphs::CDijkstra< TYPE_GRAPH, MAPS_IMPLEMENTATION >::getTreeGraph().
|
inline |
Return a text representation of the tree spanned in a depth-first view, as in this example:
Definition at line 166 of file CDirectedTree.h.
|
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 139 of file CDirectedTree.h.
|
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 119 of file CDirectedTree.h.
Referenced by mrpt::graphs::CDirectedTree< EDGE_TYPE >::getAsTextDescription(), mrpt::graphs::CDirectedTree< EDGE_TYPE >::visitBreadthFirst(), and mrpt::graphs::CDirectedTree< EDGE_TYPE >::visitDepthFirst().
TMapNode2ListEdges mrpt::graphs::CDirectedTree< TYPE_EDGES >::edges_to_children |
The edges of each node.
Definition at line 81 of file CDirectedTree.h.
Referenced by mrpt::graphs::CDirectedTree< EDGE_TYPE >::clear(), mrpt::graphs::CDijkstra< TYPE_GRAPH, MAPS_IMPLEMENTATION >::getTreeGraph(), mrpt::graphs::CDirectedTree< EDGE_TYPE >::visitBreadthFirst(), and mrpt::graphs::CDirectedTree< EDGE_TYPE >::visitDepthFirst().
TNodeID mrpt::graphs::CDirectedTree< TYPE_EDGES >::root |
The root of the tree.
Definition at line 79 of file CDirectedTree.h.
Referenced by mrpt::graphs::CDirectedTree< EDGE_TYPE >::clear(), mrpt::graphs::CDirectedTree< EDGE_TYPE >::getAsTextDescription(), mrpt::graphs::CDijkstra< TYPE_GRAPH, MAPS_IMPLEMENTATION >::getTreeGraph(), and mrpt::nav::PlannerRRT_SE2_TPS::solve().
Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020 |