A directed graph with the argument of the template specifying the type of the annotations in the edges.
This class only keeps a list of edges (in the member edges), so there is no information stored for each node but its existence referred by a node_ID.
Note that edges are stored as a std::multimap<> to allow multiple edges between the same pair of nodes.
Definition at line 70 of file CDirectedGraph.h.
#include <mrpt/graphs/CDirectedGraph.h>
Classes | |
struct | edge_t |
The type of each global pose in nodes: an extension of the TYPE_EDGES pose with any optional user-defined data. More... | |
Public Types | |
typedef mrpt::aligned_containers< TPairNodeIDs, edge_t >::multimap_t | edges_map_t |
The type of the member edges. More... | |
typedef edges_map_t::iterator | iterator |
typedef edges_map_t::reverse_iterator | reverse_iterator |
typedef edges_map_t::const_iterator | const_iterator |
typedef edges_map_t::const_reverse_iterator | const_reverse_iterator |
typedef CDirectedGraph< TYPE_EDGES, EDGE_ANNOTATIONS > | self_t |
Handy self type. More... | |
Public Member Functions | |
CDirectedGraph (const edges_map_t &obj) | |
Copy constructor from a multimap<pair< >, > More... | |
CDirectedGraph () | |
Default constructor. More... | |
iterator | begin () |
iterator | rbegin () |
iterator | end () |
iterator | rend () |
const_iterator | begin () const |
const_iterator | rbegin () const |
const_iterator | end () const |
const_iterator | rend () const |
Edges/nodes utility methods | |
size_t | edgeCount () const |
The number of edges in the graph. More... | |
void | clearEdges () |
Erase all edges. More... | |
void | insertEdge (TNodeID from_nodeID, TNodeID to_nodeID, const edge_t &edge_value) |
Insert an edge (from -> to) with the given edge value. More... | |
void | insertEdgeAtEnd (TNodeID from_nodeID, TNodeID to_nodeID, const edge_t &edge_value) |
Insert an edge (from -> to) with the given edge value (more efficient version to be called if you know that the end will go at the end of the sorted std::multimap). More... | |
bool | edgeExists (TNodeID from_nodeID, TNodeID to_nodeID) const |
Test if the given directed edge exists. More... | |
edge_t & | getEdge (TNodeID from_nodeID, TNodeID to_nodeID) |
Return a reference to the content of a given edge. More... | |
const edge_t & | getEdge (TNodeID from_nodeID, TNodeID to_nodeID) const |
Return a reference to the content of a given edge. More... | |
std::pair< iterator, iterator > | getEdges (TNodeID from_nodeID, TNodeID to_nodeID) |
Return a pair<first,last> of iterators to the range of edges between two given nodes. More... | |
std::pair< const_iterator, const_iterator > | getEdges (TNodeID from_nodeID, TNodeID to_nodeID) const |
Return a pair<first,last> of const iterators to the range of edges between two given nodes. More... | |
void | eraseEdge (TNodeID from_nodeID, TNodeID to_nodeID) |
Erase all edges between the given nodes (it has no effect if no edge existed) More... | |
void | getAllNodes (std::set< TNodeID > &lstNode_IDs) const |
Return a list of all the node_ID's of the graph, generated from all the nodes that appear in the list of edges. More... | |
std::set< TNodeID > | getAllNodes () const |
Less efficient way to get all nodes that returns a copy of the set object. More... | |
size_t | countDifferentNodesInEdges () const |
Count how many different node IDs appear in the graph edges. More... | |
void | getNeighborsOf (const TNodeID nodeID, std::set< TNodeID > &neighborIDs) const |
Return the list of all neighbors of "nodeID", by creating a list of their node IDs. More... | |
std::set< TNodeID > | getNeighborsOf (const TNodeID nodeID) const |
Return the list of all neighbors of "nodeID", by creating a list of their node IDs. More... | |
template<class MAP_NODEID_SET_NODEIDS > | |
void | getAdjacencyMatrix (MAP_NODEID_SET_NODEIDS &outAdjacency) const |
Return a map from node IDs to all its neighbors (that is, connected nodes, regardless of the edge direction) This is a much more efficient method than calling getNeighborsOf() for each node in the graph. More... | |
template<class MAP_NODEID_SET_NODEIDS , class SET_NODEIDS > | |
void | getAdjacencyMatrix (MAP_NODEID_SET_NODEIDS &outAdjacency, const SET_NODEIDS &onlyForTheseNodes) const |
Just like getAdjacencyMatrix but return only the adjacency for those node_ids in the set onlyForTheseNodes (both endings nodes of an edge must be within the set for it to be returned) More... | |
I/O utilities | |
bool | saveAsDot (std::ostream &o, const TGraphvizExportParams &p=TGraphvizExportParams()) const |
Save the graph in a Graphviz (.dot files) text format; useful for quickly rendering the graph with "dot". More... | |
bool | saveAsDot (const std::string &fileName, const TGraphvizExportParams &p=TGraphvizExportParams()) const |
Public Attributes | |
edges_map_t | edges |
The public member with the directed edges in the graph. More... | |
typedef edges_map_t::const_iterator mrpt::graphs::CDirectedGraph< TYPE_EDGES, EDGE_ANNOTATIONS >::const_iterator |
Definition at line 94 of file CDirectedGraph.h.
typedef edges_map_t::const_reverse_iterator mrpt::graphs::CDirectedGraph< TYPE_EDGES, EDGE_ANNOTATIONS >::const_reverse_iterator |
Definition at line 95 of file CDirectedGraph.h.
typedef mrpt::aligned_containers<TPairNodeIDs, edge_t>::multimap_t mrpt::graphs::CDirectedGraph< TYPE_EDGES, EDGE_ANNOTATIONS >::edges_map_t |
The type of the member edges.
Definition at line 91 of file CDirectedGraph.h.
typedef edges_map_t::iterator mrpt::graphs::CDirectedGraph< TYPE_EDGES, EDGE_ANNOTATIONS >::iterator |
Definition at line 92 of file CDirectedGraph.h.
typedef edges_map_t::reverse_iterator mrpt::graphs::CDirectedGraph< TYPE_EDGES, EDGE_ANNOTATIONS >::reverse_iterator |
Definition at line 93 of file CDirectedGraph.h.
typedef CDirectedGraph<TYPE_EDGES, EDGE_ANNOTATIONS> mrpt::graphs::CDirectedGraph< TYPE_EDGES, EDGE_ANNOTATIONS >::self_t |
Handy self type.
Definition at line 97 of file CDirectedGraph.h.
|
inline |
Copy constructor from a multimap<pair< >, >
Definition at line 103 of file CDirectedGraph.h.
|
inline |
Default constructor.
Definition at line 105 of file CDirectedGraph.h.
|
inline |
Definition at line 106 of file CDirectedGraph.h.
Referenced by mrpt::graphs::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS >::mergeGraph(), and mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::saveAsDot().
|
inline |
Definition at line 110 of file CDirectedGraph.h.
|
inline |
Erase all edges.
Definition at line 120 of file CDirectedGraph.h.
Referenced by mrpt::graphs::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS >::extractSubGraph().
|
inline |
Count how many different node IDs appear in the graph edges.
Definition at line 233 of file CDirectedGraph.h.
|
inline |
The number of edges in the graph.
Definition at line 118 of file CDirectedGraph.h.
|
inline |
Test if the given directed edge exists.
Definition at line 143 of file CDirectedGraph.h.
|
inline |
Definition at line 108 of file CDirectedGraph.h.
Referenced by mrpt::graphs::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS >::mergeGraph(), and mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::saveAsDot().
|
inline |
Definition at line 112 of file CDirectedGraph.h.
|
inline |
Erase all edges between the given nodes (it has no effect if no edge existed)
Definition at line 203 of file CDirectedGraph.h.
|
inline |
Return a map from node IDs to all its neighbors (that is, connected nodes, regardless of the edge direction) This is a much more efficient method than calling getNeighborsOf() for each node in the graph.
Possible values for the template argument MAP_NODEID_SET_NODEIDS are:
Definition at line 279 of file CDirectedGraph.h.
|
inline |
Just like getAdjacencyMatrix but return only the adjacency for those node_ids in the set onlyForTheseNodes (both endings nodes of an edge must be within the set for it to be returned)
Definition at line 295 of file CDirectedGraph.h.
|
inline |
Return a list of all the node_ID's of the graph, generated from all the nodes that appear in the list of edges.
Definition at line 211 of file CDirectedGraph.h.
|
inline |
Less efficient way to get all nodes that returns a copy of the set object.
Definition at line 224 of file CDirectedGraph.h.
Referenced by mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::getAllNodes().
|
inline |
Return a reference to the content of a given edge.
If several edges exist between the given nodes, the first one is returned.
std::exception | if the given edge does not exist |
Definition at line 155 of file CDirectedGraph.h.
|
inline |
Return a reference to the content of a given edge.
If several edges exist between the given nodes, the first one is returned.
std::exception | if the given edge does not exist |
Definition at line 173 of file CDirectedGraph.h.
|
inline |
Return a pair<first,last> of iterators to the range of edges between two given nodes.
Definition at line 187 of file CDirectedGraph.h.
|
inline |
Return a pair<first,last> of const iterators to the range of edges between two given nodes.
Definition at line 194 of file CDirectedGraph.h.
|
inline |
Return the list of all neighbors of "nodeID", by creating a list of their node IDs.
Definition at line 247 of file CDirectedGraph.h.
Referenced by mrpt::graphs::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS >::extractSubGraph(), and mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::getNeighborsOf().
|
inline |
Return the list of all neighbors of "nodeID", by creating a list of their node IDs.
Definition at line 262 of file CDirectedGraph.h.
|
inline |
Insert an edge (from -> to) with the given edge value.
Definition at line 123 of file CDirectedGraph.h.
Referenced by mrpt::graphs::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS >::addVirtualEdge(), and mrpt::graphs::CNetworkOfPoses< CPOSE, MAPS_IMPLEMENTATION, NODE_ANNOTATIONS, EDGE_ANNOTATIONS >::extractSubGraph().
|
inline |
Insert an edge (from -> to) with the given edge value (more efficient version to be called if you know that the end will go at the end of the sorted std::multimap).
Definition at line 134 of file CDirectedGraph.h.
Referenced by mrpt::hmtslam::CHierarchicalMapMHPartition::computeGloballyConsistentNodeCoordinates().
|
inline |
Definition at line 107 of file CDirectedGraph.h.
|
inline |
Definition at line 111 of file CDirectedGraph.h.
|
inline |
Definition at line 109 of file CDirectedGraph.h.
|
inline |
Definition at line 113 of file CDirectedGraph.h.
|
inline |
Save the graph in a Graphviz (.dot files) text format; useful for quickly rendering the graph with "dot".
Definition at line 321 of file CDirectedGraph.h.
Referenced by mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::saveAsDot().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 365 of file CDirectedGraph.h.
edges_map_t mrpt::graphs::CDirectedGraph< TYPE_EDGES, EDGE_ANNOTATIONS >::edges |
The public member with the directed edges in the graph.
Definition at line 100 of file CDirectedGraph.h.
Referenced by mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::begin(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::clearEdges(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::countDifferentNodesInEdges(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::edgeCount(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::edgeExists(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::end(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::eraseEdge(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::getAdjacencyMatrix(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::getAllNodes(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::getEdge(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::getEdges(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::getNeighborsOf(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::insertEdge(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::insertEdgeAtEnd(), mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::rbegin(), and mrpt::graphs::CDirectedGraph< CPOSE, EDGE_ANNOTATIONS >::rend().
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019 |