Parasol Planning Library (PPL)
GenericStateGraph< Vertex, Edge > Class Template Reference

#include <GenericStateGraph.h>

Inheritance diagram for GenericStateGraph< Vertex, Edge >:
Inheritance graph
[legend]
Collaboration diagram for GenericStateGraph< Vertex, Edge >:
Collaboration graph
[legend]

Public Types

Local Types
enum class  HookType { AddVertex , DeleteVertex , AddEdge , DeleteEdge }
 
using STAPLGraph = stapl::sequential::graph< stapl::DIRECTED, stapl::NONMULTIEDGES, Vertex, Edge >
 
typedef STAPLGraph::vertex_descriptor VID
 
typedef STAPLGraph::edge_descriptor EID
 
typedef EID::edge_id_type EdgeID
 
typedef std::unordered_set< VIDVertexSet
 
typedef STAPLGraph::vertex_iterator VI
 
typedef STAPLGraph::adj_edge_iterator EI
 
typedef STAPLGraph::const_vertex_iterator CVI
 
typedef STAPLGraph::const_adj_edge_iterator CEI
 
typedef STAPLGraph::vertex_property VP
 
typedef STAPLGraph::edge_property EP
 
typedef Vertex CfgType
 
typedef Edge EdgeType
 
typedef stapl::sequential::vector_property_map< STAPLGraph, size_t > ColorMap
 
typedef std::function< void(VI)> VertexHook
 
typedef std::function< void(EI)> EdgeHook
 
typedef CCTracker< GenericStateGraph< Vertex, Edge > > CCTrackerType
 

Public Member Functions

Construction
 GenericStateGraph ()
 
 GenericStateGraph (Robot *const _r)
 
Move and Copy

Move and copy operations do not copy hook functions.

 GenericStateGraph (const GenericStateGraph &_r)
 
 GenericStateGraph (GenericStateGraph &&_r)
 
GenericStateGraphoperator= (const GenericStateGraph &_r)
 
GenericStateGraphoperator= (GenericStateGraph &&_r)
 
Equality
bool operator== (const GenericStateGraph &_r) const noexcept
 
bool operator!= (const GenericStateGraph &_r) const noexcept
 
Modifiers
virtual VID AddVertex (const Vertex &_v) noexcept
 
virtual VID AddVertex (const VID _vid, const Vertex &_v) noexcept
 
virtual VID AddDuplicateVertex (const Vertex &_v) noexcept
 
virtual void DeleteVertex (const VID _v) noexcept
 
virtual EID AddEdge (const VID _source, const VID _target, const Edge &_w) noexcept
 
virtual std::pair< EID, EIDAddEdge (const VID _source, const VID _target, const std::pair< Edge, Edge > &_w) noexcept
 
virtual EID AddEdge (const EID _eid, const Edge &_w) noexcept
 
virtual EID AddEdge (const VID _source, const VID _target) noexcept
 
virtual void DeleteEdge (const VID _source, const VID _target) noexcept
 
virtual void DeleteEdge (EI _iterator) noexcept
 
void SetRobot (Robot *const _r) noexcept
 Set the robot pointer on all configurations in the map. More...
 
void AppendRoadmap (const GenericStateGraph &_r)
 
void SetCCTracker (StatClass *const _stats=nullptr)
 
Queries
size_t Size () const noexcept
 Get the number of vertices in the roadmap. More...
 
bool IsVertex (const VID _vid) const noexcept
 
bool IsVertex (const Vertex &_v) const noexcept
 
bool IsVertex (const Vertex &_v, CVI &_vi) const noexcept
 
bool IsEdge (const VID _source, const VID _target) const noexcept
 
template<typename T >
VID GetVID (const T &_t) const noexcept
 
VID GetVID (const VI &_t) const noexcept
 
VID GetVID (const Vertex &_t) const noexcept
 
const VertexSetGetPredecessors (const VID _vid) const noexcept
 
VID GetLastVID () const noexcept
 Get the descriptor of the last vertex added to the graph. More...
 
size_t GetTimestamp () const noexcept
 Each time the roadmap is modified, we update the timestamp. More...
 
const VertexSetGetAllVIDs () const noexcept
 Get the set of all VIDs in the roadmap. More...
 
Accessors
RobotGetRobot () const noexcept
 Get the robot represented by this roadmap. More...
 
CCTrackerTypeGetCCTracker () const noexcept
 Get the connected component tracker. More...
 
template<typename T >
VPGetVertex (T &_t) noexcept
 Retrieve a reference to a vertex property by descriptor or iterator. More...
 
VPGetVertex (VI &_t) noexcept
 
VPGetVertex (VID _t) noexcept
 
template<typename T >
const VPGetVertex (T &_t) const noexcept
 
const VPGetVertex (CVI &_t) const noexcept
 
const VPGetVertex (VID _t) const noexcept
 
std::vector< VIDGetChildren (const VID _vid) const noexcept
 
size_t GetInDegree (const VID _vid) noexcept
 
std::vector< EIFindInboundEdges (const VID _vid)
 
bool GetEdge (const VID _source, const VID _target, EI &_ei) noexcept
 
bool GetEdge (const VID _source, const VID _target, CEI &_ei) const noexcept
 
EPGetEdge (const VID _source, const VID _target) noexcept
 
EPGetEdge (const EID _descriptor) noexcept
 
Hooks

Hooks are arbitrary functions that are attached to roadmap events. I.e., whenever a vertex is added, a set of functions should be called (hooks). There is a set of hooks for each of the four modifying actions (add/delete a vertex/edge).

IMPORTANT: Hooks for 'add' events execute immediately after the event, while hooks for 'delete' events execute immediately prior. This ensures that the iterator and neighbor information are valid in both cases.

IMPORTANT: Dependencies between hooks create data races. To avoid problems, any piece of data that is modified by one hook should not be read or modified by any other hook.

bool IsHook (const HookType, const std::string &_label) const
 
void InstallHook (const HookType _type, const std::string &_label, const VertexHook &_h)
 
void InstallHook (const HookType _type, const std::string &_label, const EdgeHook &_h)
 
void RemoveHook (const HookType _type, const std::string &_label)
 
void DisableHooks () noexcept
 
void EnableHooks () noexcept
 Enable the hook functions (default). More...
 
virtual void ClearHooks () noexcept
 

Protected Member Functions

Helpers
void ExecuteAddVertexHooks (const VI _iterator) noexcept
 
void ExecuteDeleteVertexHooks (const VI _iterator) noexcept
 
void ExecuteAddEdgeHooks (const EI _iterator) noexcept
 
void ExecuteDeleteEdgeHooks (const EI _iterator) noexcept
 
std::string ToString (const HookType &_t) const noexcept
 

Protected Attributes

Internal State
Robotm_robot {nullptr}
 The robot this roadmap is for. More...
 
size_t m_timestamp {0}
 Tracks the number of changes to the graph. More...
 
bool m_enableHooks {true}
 Use hook functions? More...
 
std::unordered_map< std::string, VertexHookm_addVertexHooks
 Hook functions to call when adding a vertex. More...
 
std::unordered_map< std::string, VertexHookm_deleteVertexHooks
 Hook functions to call when deleting a vertex. More...
 
std::unordered_map< std::string, EdgeHookm_addEdgeHooks
 Hook functions to call when adding an edge. More...
 
std::unordered_map< std::string, EdgeHookm_deleteEdgeHooks
 Hook functions to call when deleting an edge. More...
 
std::unique_ptr< CCTrackerTypem_ccTracker
 Tracks weak CCs within the roadmap. More...
 
std::unordered_map< VID, VertexSetm_predecessors
 
VertexSet m_allVIDs
 

I/O

virtual void Write (const std::string &_filename, Environment *_env) const
 
template<typename RG >
void Read (RG *_g, const std::string &_filename)
 
template<typename RG >
void ReadMessage (RG *_g, const std::string &_msg)
 

Detailed Description

template<typename Vertex, typename Edge>
class GenericStateGraph< Vertex, Edge >

Graph data structure of robot configurations (vertices) connected by local plans (edges).

We often want to do some extra stuff whenever the roadmap is modified. To support that, this object can install hook functions for each of the four modifying events (add/delete a vertex/edge). Note that there is no particular ordering to the hook execution - this is deliberate because we will create a maintenance nightmare if hooks are allowed to depend on each other. As such, no two hooks should modify the same data. Terrible and unpredictable things will happen if you do this!

Template Parameters
VertexThe vertex or configuration type.
EdgeThe edge or local plan type.

Member Typedef Documentation

◆ CCTrackerType

template<typename Vertex , typename Edge >
typedef CCTracker<GenericStateGraph<Vertex, Edge> > GenericStateGraph< Vertex, Edge >::CCTrackerType

◆ CEI

template<typename Vertex , typename Edge >
typedef STAPLGraph::const_adj_edge_iterator GenericStateGraph< Vertex, Edge >::CEI

◆ CfgType

template<typename Vertex , typename Edge >
typedef Vertex GenericStateGraph< Vertex, Edge >::CfgType

◆ ColorMap

template<typename Vertex , typename Edge >
typedef stapl::sequential::vector_property_map<STAPLGraph, size_t> GenericStateGraph< Vertex, Edge >::ColorMap

◆ CVI

template<typename Vertex , typename Edge >
typedef STAPLGraph::const_vertex_iterator GenericStateGraph< Vertex, Edge >::CVI

◆ EdgeHook

template<typename Vertex , typename Edge >
typedef std::function<void(EI)> GenericStateGraph< Vertex, Edge >::EdgeHook

◆ EdgeID

template<typename Vertex , typename Edge >
typedef EID::edge_id_type GenericStateGraph< Vertex, Edge >::EdgeID

◆ EdgeType

template<typename Vertex , typename Edge >
typedef Edge GenericStateGraph< Vertex, Edge >::EdgeType

◆ EI

template<typename Vertex , typename Edge >
typedef STAPLGraph::adj_edge_iterator GenericStateGraph< Vertex, Edge >::EI

◆ EID

template<typename Vertex , typename Edge >
typedef STAPLGraph::edge_descriptor GenericStateGraph< Vertex, Edge >::EID

◆ EP

template<typename Vertex , typename Edge >
typedef STAPLGraph::edge_property GenericStateGraph< Vertex, Edge >::EP

◆ STAPLGraph

template<typename Vertex , typename Edge >
using GenericStateGraph< Vertex, Edge >::STAPLGraph = stapl::sequential::graph<stapl::DIRECTED, stapl::NONMULTIEDGES, Vertex, Edge>

◆ VertexHook

template<typename Vertex , typename Edge >
typedef std::function<void(VI)> GenericStateGraph< Vertex, Edge >::VertexHook

◆ VertexSet

template<typename Vertex , typename Edge >
typedef std::unordered_set<VID> GenericStateGraph< Vertex, Edge >::VertexSet

◆ VI

template<typename Vertex , typename Edge >
typedef STAPLGraph::vertex_iterator GenericStateGraph< Vertex, Edge >::VI

◆ VID

template<typename Vertex , typename Edge >
typedef STAPLGraph::vertex_descriptor GenericStateGraph< Vertex, Edge >::VID

◆ VP

template<typename Vertex , typename Edge >
typedef STAPLGraph::vertex_property GenericStateGraph< Vertex, Edge >::VP

Member Enumeration Documentation

◆ HookType

template<typename Vertex , typename Edge >
enum GenericStateGraph::HookType
strong
Enumerator
AddVertex 
DeleteVertex 
AddEdge 
DeleteEdge 

Constructor & Destructor Documentation

◆ GenericStateGraph() [1/4]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::GenericStateGraph

◆ GenericStateGraph() [2/4]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::GenericStateGraph ( Robot *const  _r)

◆ GenericStateGraph() [3/4]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::GenericStateGraph ( const GenericStateGraph< Vertex, Edge > &  _r)

◆ GenericStateGraph() [4/4]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::GenericStateGraph ( GenericStateGraph< Vertex, Edge > &&  _r)

Member Function Documentation

◆ AddDuplicateVertex()

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::VID GenericStateGraph< Vertex, Edge >::AddDuplicateVertex ( const Vertex &  _v)
virtualnoexcept

Add a vertex to the graph without checking for uniqueness.

Parameters
_vThe vertex to add.
Returns
A new VID of the added vertex, or the VID of the existing vertex.

◆ AddEdge() [1/4]

template<class Vertex , class Edge >
GenericStateGraph< Vertex, Edge >::EID GenericStateGraph< Vertex, Edge >::AddEdge ( const EID  _eid,
const Edge &  _w 
)
virtualnoexcept

◆ AddEdge() [2/4]

template<class Vertex , class Edge >
GenericStateGraph< Vertex, Edge >::EID GenericStateGraph< Vertex, Edge >::AddEdge ( const VID  _source,
const VID  _target 
)
virtualnoexcept

◆ AddEdge() [3/4]

template<class Vertex , class Edge >
GenericStateGraph< Vertex, Edge >::EID GenericStateGraph< Vertex, Edge >::AddEdge ( const VID  _source,
const VID  _target,
const Edge &  _w 
)
virtualnoexcept

Add an edge from source to target.

Parameters
_sourceThe source vertex.
_targetThe target vertex.
_wThe edge property.

Reimplemented in GroupRoadmap< Vertex, Edge >, and CompositeGraph< Vertex, Edge >.

◆ AddEdge() [4/4]

template<class Vertex , class Edge >
std::pair< typename GenericStateGraph< Vertex, Edge >::EID, typename GenericStateGraph< Vertex, Edge >::EID > GenericStateGraph< Vertex, Edge >::AddEdge ( const VID  _source,
const VID  _target,
const std::pair< Edge, Edge > &  _w 
)
virtualnoexcept

Add edges both ways between source and target vertices.

Parameters
_sourceThe source vertex.
_targetThe target vertex.
_wThe edge properties (source to target first).

◆ AddVertex() [1/2]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::VID GenericStateGraph< Vertex, Edge >::AddVertex ( const Vertex &  _v)
virtualnoexcept

Add a new unique vertex to the graph. If it already exists, a warning will be printed to cerr.

Parameters
_vThe vertex to add.
Returns
A new VID of the added vertex, or the VID of the existing vertex.

Reimplemented in GroupRoadmap< Vertex, Edge >, and CompositeGraph< Vertex, Edge >.

◆ AddVertex() [2/2]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::VID GenericStateGraph< Vertex, Edge >::AddVertex ( const VID  _vid,
const Vertex &  _v 
)
virtualnoexcept

Add a new unique vertex to the graph with a designated descriptor. If it already exists or the descriptor is already in use, a warning will be printed to cerr.

Parameters
_vidThe desired descriptor.
_vThe vertex property.
Returns
A new VID of the added vertex, or the VID of the existing vertex.

◆ AppendRoadmap()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::AppendRoadmap ( const GenericStateGraph< Vertex, Edge > &  _r)

Copy the nodes and edges from another roadmap and append them to this. Assumes the configurations are compatible with this roadmap's robot.

Parameters
_rThe roadmap to copy from.

◆ ClearHooks()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::ClearHooks
virtualnoexcept

Uninstall all hooks. Should only be used at the end of a library run to clean the roadmap object.

Reimplemented in CompositeGraph< Vertex, Edge >.

◆ DeleteEdge() [1/2]

template<class Vertex , class Edge >
void GenericStateGraph< Vertex, Edge >::DeleteEdge ( const VID  _source,
const VID  _target 
)
virtualnoexcept

Remove an edge from the graph if it exists.

Parameters
_sourceThe source vertex.
_targetThe target vertex.

Reimplemented in CompositeGraph< Vertex, Edge >.

◆ DeleteEdge() [2/2]

template<class Vertex , class Edge >
void GenericStateGraph< Vertex, Edge >::DeleteEdge ( EI  _iterator)
virtualnoexcept

Remove an edge from the graph if it exists.

Parameters
_iteratorAn iterator to the edge.

Reimplemented in CompositeGraph< Vertex, Edge >.

◆ DeleteVertex()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::DeleteVertex ( const VID  _v)
virtualnoexcept

Remove a vertex (and attached edges) from the graph if it exists.

Parameters
_vThe vertex descriptor.

Reimplemented in CompositeGraph< Vertex, Edge >.

◆ DisableHooks()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::DisableHooks
inlinenoexcept

Disable the hooks. This is useful for making temporary additions and deletions to the roadmap without triggering the hook functions. Be sure to re-enable them after, and to only use this in isolated code segments where you are sure that we won't miss any real nodes.

◆ EnableHooks()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::EnableHooks
inlinenoexcept

Enable the hook functions (default).

◆ ExecuteAddEdgeHooks()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::ExecuteAddEdgeHooks ( const EI  _iterator)
inlineprotectednoexcept

Execute the AddEdge hooks.

Parameters
_iteratorAn iterator to the newly added edge.

◆ ExecuteAddVertexHooks()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::ExecuteAddVertexHooks ( const VI  _iterator)
inlineprotectednoexcept

Execute the AddVertex hooks.

Parameters
_iteratorAn iterator to the newly added vertex.

◆ ExecuteDeleteEdgeHooks()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::ExecuteDeleteEdgeHooks ( const EI  _iterator)
inlineprotectednoexcept

Execute the DeleteEdge hooks.

Parameters
_iteratorAn iterator to the to-be-deleted edge.

◆ ExecuteDeleteVertexHooks()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::ExecuteDeleteVertexHooks ( const VI  _iterator)
inlineprotectednoexcept

Execute the DeleteVertex hooks.

Parameters
_iteratorAn iterator to the to-be-deleted vertex.

◆ FindInboundEdges()

template<typename Vertex , typename Edge >
std::vector< typename GenericStateGraph< Vertex, Edge >::EI > GenericStateGraph< Vertex, Edge >::FindInboundEdges ( const VID  _vid)

◆ GetAllVIDs()

template<typename Vertex , typename Edge >
const GenericStateGraph< Vertex, Edge >::VertexSet & GenericStateGraph< Vertex, Edge >::GetAllVIDs
inlinenoexcept

Get the set of all VIDs in the roadmap.

◆ GetCCTracker()

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::CCTrackerType * GenericStateGraph< Vertex, Edge >::GetCCTracker
inlinenoexcept

Get the connected component tracker.

◆ GetChildren()

template<typename Vertex , typename Edge >
std::vector< typename GenericStateGraph< Vertex, Edge >::VID > GenericStateGraph< Vertex, Edge >::GetChildren ( const VID  _vid) const
noexcept

Get the set of VIDs which are children of a given vertex.

Parameters
_vidThe VID of the given vertex.
Returns
The VIDs of each node u for which and edge (_vid, u) exists.

◆ GetEdge() [1/4]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::EP & GenericStateGraph< Vertex, Edge >::GetEdge ( const EID  _descriptor)
inlinenoexcept

◆ GetEdge() [2/4]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::EP & GenericStateGraph< Vertex, Edge >::GetEdge ( const VID  _source,
const VID  _target 
)
inlinenoexcept

◆ GetEdge() [3/4]

template<typename Vertex , typename Edge >
bool GenericStateGraph< Vertex, Edge >::GetEdge ( const VID  _source,
const VID  _target,
CEI _ei 
) const
inlinenoexcept

◆ GetEdge() [4/4]

template<typename Vertex , typename Edge >
bool GenericStateGraph< Vertex, Edge >::GetEdge ( const VID  _source,
const VID  _target,
EI _ei 
)
inlinenoexcept

Retrieve an edge from the graph.

Parameters
_sourceThe source node VID.
_targetThe target node VID.
_eiAn edge iterator, set to the specified edge if found or end otherwise.
Returns
True if the edge was located.

◆ GetInDegree()

template<typename Vertex , typename Edge >
size_t GenericStateGraph< Vertex, Edge >::GetInDegree ( const VID  _vid)
noexcept

◆ GetLastVID()

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::VID GenericStateGraph< Vertex, Edge >::GetLastVID
inlinenoexcept

Get the descriptor of the last vertex added to the graph.

◆ GetPredecessors()

template<typename Vertex , typename Edge >
const GenericStateGraph< Vertex, Edge >::VertexSet & GenericStateGraph< Vertex, Edge >::GetPredecessors ( const VID  _vid) const
inlinenoexcept

Get the set of predecessors for a given vertex.

Parameters
_vidThe vertex descriptor.
Returns
The set of VIDs which have _vid as a child node.

◆ GetRobot()

template<typename Vertex , typename Edge >
Robot * GenericStateGraph< Vertex, Edge >::GetRobot
inlinenoexcept

Get the robot represented by this roadmap.

◆ GetTimestamp()

template<typename Vertex , typename Edge >
size_t GenericStateGraph< Vertex, Edge >::GetTimestamp
inlinenoexcept

Each time the roadmap is modified, we update the timestamp.

◆ GetVertex() [1/6]

template<typename Vertex , typename Edge >
const GenericStateGraph< Vertex, Edge >::VP & GenericStateGraph< Vertex, Edge >::GetVertex ( CVI _t) const
inlinenoexcept

◆ GetVertex() [2/6]

template<typename Vertex , typename Edge >
template<typename T >
const GenericStateGraph< Vertex, Edge >::VP & GenericStateGraph< Vertex, Edge >::GetVertex ( T &  _t) const
inlinenoexcept

Retrieve a constant reference to a vertex property by descriptor or iterator.

◆ GetVertex() [3/6]

template<typename Vertex , typename Edge >
template<typename T >
GenericStateGraph< Vertex, Edge >::VP & GenericStateGraph< Vertex, Edge >::GetVertex ( T &  _t)
inlinenoexcept

Retrieve a reference to a vertex property by descriptor or iterator.

◆ GetVertex() [4/6]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::VP & GenericStateGraph< Vertex, Edge >::GetVertex ( VI _t)
inlinenoexcept

◆ GetVertex() [5/6]

template<typename Vertex , typename Edge >
const GenericStateGraph< Vertex, Edge >::VP & GenericStateGraph< Vertex, Edge >::GetVertex ( VID  _t) const
inlinenoexcept

◆ GetVertex() [6/6]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::VP & GenericStateGraph< Vertex, Edge >::GetVertex ( VID  _t)
inlinenoexcept

◆ GetVID() [1/3]

template<typename Vertex , typename Edge >
template<typename T >
GenericStateGraph< Vertex, Edge >::VID GenericStateGraph< Vertex, Edge >::GetVID ( const T &  _t) const
inlinenoexcept

Get the descriptor of a vertex property if it exists in the graph, or INVALID_VID otherwise.

◆ GetVID() [2/3]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::VID GenericStateGraph< Vertex, Edge >::GetVID ( const Vertex &  _t) const
inlinenoexcept

◆ GetVID() [3/3]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::VID GenericStateGraph< Vertex, Edge >::GetVID ( const VI _t) const
inlinenoexcept

◆ InstallHook() [1/2]

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::InstallHook ( const HookType  _type,
const std::string &  _label,
const EdgeHook _h 
)

Install an edge hook. It will be called each time a new edge is added.

Parameters
_typeThe hook type (edge add/delete).
_labelThe unique label.
_hThe hook function.

◆ InstallHook() [2/2]

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::InstallHook ( const HookType  _type,
const std::string &  _label,
const VertexHook _h 
)

Install a vertex hook. It will be called each time a new vertex is added.

Parameters
_typeThe hook type (vertex add/delete).
_labelThe unique label.
_hThe hook function.

◆ IsEdge()

template<typename Vertex , typename Edge >
bool GenericStateGraph< Vertex, Edge >::IsEdge ( const VID  _source,
const VID  _target 
) const
inlinenoexcept

Check if an edge is present between two vertices.

Parameters
_sourceThe source vertex.
_targetThe target vertex.
Returns
True if an edge exists from source to target.

◆ IsHook()

template<typename Vertex , typename Edge >
bool GenericStateGraph< Vertex, Edge >::IsHook ( const HookType  _type,
const std::string &  _label 
) const

Check if a hook with a given type and label is installed.

Parameters
_typeThe hook type.
_labelThe unique label.
Returns
True if a hook of the specified type and label is present.

◆ IsVertex() [1/3]

template<typename Vertex , typename Edge >
bool GenericStateGraph< Vertex, Edge >::IsVertex ( const Vertex &  _v) const
inlinenoexcept

Check if a vertex is present in the graph.

Parameters
_vThe vertex property to seek.
Returns
True if the vertex property was found in the graph.

◆ IsVertex() [2/3]

template<typename Vertex , typename Edge >
bool GenericStateGraph< Vertex, Edge >::IsVertex ( const Vertex &  _v,
CVI _vi 
) const
inlinenoexcept

Check if a vertex is present in the graph and retrieve a const iterator to it if so.

Parameters
_vThe vertex property to seek.
_viA vertex iterator, set to the located vertex or end if not found.
Returns
True if the vertex property was found in the graph.

◆ IsVertex() [3/3]

template<typename Vertex , typename Edge >
bool GenericStateGraph< Vertex, Edge >::IsVertex ( const VID  _vid) const
inlinenoexcept

Check if a vertex is present in the graph.

Parameters
_vidThe vertex descriptor
Returns
True if the vertex descriptor was found in the graph.

◆ operator!=()

template<typename Vertex , typename Edge >
bool GenericStateGraph< Vertex, Edge >::operator!= ( const GenericStateGraph< Vertex, Edge > &  _r) const
noexcept

◆ operator=() [1/2]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge > & GenericStateGraph< Vertex, Edge >::operator= ( const GenericStateGraph< Vertex, Edge > &  _r)

◆ operator=() [2/2]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge > & GenericStateGraph< Vertex, Edge >::operator= ( GenericStateGraph< Vertex, Edge > &&  _r)

◆ operator==()

template<typename Vertex , typename Edge >
bool GenericStateGraph< Vertex, Edge >::operator== ( const GenericStateGraph< Vertex, Edge > &  _r) const
noexcept

◆ RemoveHook()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::RemoveHook ( const HookType  _type,
const std::string &  _label 
)

Remove a hook.

Parameters
_typeThe hook type.
_labelThe unique label.

◆ SetCCTracker()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::SetCCTracker ( StatClass *const  _stats = nullptr)
inline

Set the CC tracker.

Parameters
_statsOptional stat class for performance profiling.

◆ SetRobot()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::SetRobot ( Robot *const  _r)
noexcept

Set the robot pointer on all configurations in the map.

◆ Size()

template<typename Vertex , typename Edge >
size_t GenericStateGraph< Vertex, Edge >::Size
inlinenoexcept

Get the number of vertices in the roadmap.

◆ ToString()

template<typename Vertex , typename Edge >
std::string GenericStateGraph< Vertex, Edge >::ToString ( const HookType _t) const
protectednoexcept

Helper for printing hook type names.

Parameters
_tA hook type.
Returns
The string representation of _t.

◆ Write()

template<typename Vertex , typename Edge >
void GenericStateGraph< Vertex, Edge >::Write ( const std::string &  _filename,
Environment _env 
) const
virtual

Write the current roadmap out to a roadmap (.map) file.

Parameters
_filenameThe name of the map file to write to.
_envThe environment for which this map was constructed.

Reimplemented in CompositeGraph< Vertex, Edge >.

Friends And Related Function Documentation

◆ Read

template<typename Vertex , typename Edge >
template<typename RG >
void Read ( RG *  _g,
const std::string &  _filename 
)
friend

Read in a roadmap (.map) file.

Parameters
_filenameThe name of the map file to read.
Note
Temporarily moved to non-member function.

◆ ReadMessage

template<typename Vertex , typename Edge >
template<typename RG >
void ReadMessage ( RG *  _g,
const std::string &  _msg 
)
friend

Field Documentation

◆ m_addEdgeHooks

template<typename Vertex , typename Edge >
std::unordered_map<std::string, EdgeHook> GenericStateGraph< Vertex, Edge >::m_addEdgeHooks
protected

Hook functions to call when adding an edge.

◆ m_addVertexHooks

template<typename Vertex , typename Edge >
std::unordered_map<std::string, VertexHook> GenericStateGraph< Vertex, Edge >::m_addVertexHooks
protected

Hook functions to call when adding a vertex.

◆ m_allVIDs

template<typename Vertex , typename Edge >
VertexSet GenericStateGraph< Vertex, Edge >::m_allVIDs
protected

A set of all VIDs in the roadmap. We track this to make nearest-neighbor queries more efficient.

◆ m_ccTracker

template<typename Vertex , typename Edge >
std::unique_ptr<CCTrackerType> GenericStateGraph< Vertex, Edge >::m_ccTracker
protected

Tracks weak CCs within the roadmap.

◆ m_deleteEdgeHooks

template<typename Vertex , typename Edge >
std::unordered_map<std::string, EdgeHook> GenericStateGraph< Vertex, Edge >::m_deleteEdgeHooks
protected

Hook functions to call when deleting an edge.

◆ m_deleteVertexHooks

template<typename Vertex , typename Edge >
std::unordered_map<std::string, VertexHook> GenericStateGraph< Vertex, Edge >::m_deleteVertexHooks
protected

Hook functions to call when deleting a vertex.

◆ m_enableHooks

template<typename Vertex , typename Edge >
bool GenericStateGraph< Vertex, Edge >::m_enableHooks {true}
protected

Use hook functions?

◆ m_predecessors

template<typename Vertex , typename Edge >
std::unordered_map<VID, VertexSet> GenericStateGraph< Vertex, Edge >::m_predecessors
protected

Tracks predecessor information. We use this instead of switching to a STAPL directed_preds graph because (a) directed_preds uses a vector for storage of VIDs, making all changes linear-time operations in the in-degree of each vertex, and (b) the STAPL API is not interchangable as it should be, so switching causes ridiculous compiler errors.

◆ m_robot

template<typename Vertex , typename Edge >
Robot* GenericStateGraph< Vertex, Edge >::m_robot {nullptr}
protected

The robot this roadmap is for.

◆ m_timestamp

template<typename Vertex , typename Edge >
size_t GenericStateGraph< Vertex, Edge >::m_timestamp {0}
protected

Tracks the number of changes to the graph.


The documentation for this class was generated from the following files: