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

#include <CompositeGraph.h>

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

Public Types

Local Types
typedef GenericStateGraph< Vertex, Edge > BaseType
 
typedef CompositeGraph< Vertex, Edge > CompositeGraphType
 
typedef Vertex::IndividualGraph IndividualGraph
 
typedef BaseType::EID ED
 
typedef IndividualGraph::EdgeType IndividualEdge
 
typedef BaseType::adj_edge_iterator adj_edge_iterator
 
typedef BaseType::edge_descriptor edge_descriptor
 
typedef BaseType::vertex_iterator vertex_iterator
 
typedef BaseType::vertex_descriptor vertex_descriptor
 
typedef STAPLGraph::const_vertex_iterator CVI
 
typedef STAPLGraph::vertex_iterator VI
 
typedef STAPLGraph::adj_edge_iterator EI
 
typedef STAPLGraph::vertex_descriptor VID
 
using STAPLGraph = stapl::sequential::graph< stapl::DIRECTED, stapl::NONMULTIEDGES, Vertex, Edge >
 
typedef std::function< void(VI)> VertexHook
 
typedef std::function< void(EI)> EdgeHook
 
enum class  HookType
 
- Public Types inherited from GenericStateGraph< Vertex, Edge >
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
 CompositeGraph (RobotGroup *const _g=nullptr, std::vector< IndividualGraph * > _graphs={})
 Construct a composite graph. More...
 
Disabled Functions

Move and copy are disabled because the composite states and edges need to know their group graph pointer. To implement these, we'll need to update the pointer on every component.

 CompositeGraph (const CompositeGraph &)=delete
 
 CompositeGraph (CompositeGraph &&)=delete
 
CompositeGraphoperator= (const CompositeGraph &)=delete
 
CompositeGraphoperator= (CompositeGraph &&)=delete
 
Accessors
virtual RobotGroupGetGroup ()
 Get the robot group. More...
 
virtual IndividualGraphGetIndividualGraph (const size_t _index)
 
virtual const IndividualGraphGetIndividualGraph (const size_t _index) const
 
virtual size_t GetNumRobots () const noexcept
 Get the number of robots for the group this graph is for. More...
 
Input/Output
virtual void Write (const std::string &_filename, Environment *_env) const override
 
virtual void WriteCompositeGraph (const std::string &_filename, Environment *const _env) const
 
std::string PrettyPrint () const
 
Modifiers
virtual VID AddVertex (const Vertex &_v) noexcept override
 
virtual void DeleteVertex (const VID _v) noexcept override
 
virtual ED AddEdge (const VID _source, const VID _target, const Edge &_w) noexcept override
 
virtual void DeleteEdge (const VID _source, const VID _target) noexcept override
 
virtual void DeleteEdge (EI _iterator) noexcept override
 
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
 
Hooks
virtual void ClearHooks () noexcept override
 
- Public Member Functions inherited from GenericStateGraph< Vertex, Edge >
 GenericStateGraph ()
 
 GenericStateGraph (Robot *const _r)
 
 GenericStateGraph (const GenericStateGraph &_r)
 
 GenericStateGraph (GenericStateGraph &&_r)
 
GenericStateGraphoperator= (const GenericStateGraph &_r)
 
GenericStateGraphoperator= (GenericStateGraph &&_r)
 
bool operator== (const GenericStateGraph &_r) const noexcept
 
bool operator!= (const GenericStateGraph &_r) const noexcept
 
virtual VID AddVertex (const VID _vid, const Vertex &_v) noexcept
 
virtual VID AddDuplicateVertex (const Vertex &_v) 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
 
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)
 
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...
 
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
 
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...
 

Protected Attributes

Internal State
RobotGroup *const m_group
 The robot group. More...
 
std::vector< IndividualGraph * > m_graphs
 The individual graphs. More...
 
size_t m_timestamp
 Tracks the number of changes to the graph. More...
 
- Protected Attributes inherited from GenericStateGraph< Vertex, Edge >
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
 

Additional Inherited Members

- Protected Member Functions inherited from GenericStateGraph< Vertex, Edge >
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
 

Detailed Description

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

Represents a composite graph for a robot group.

Rather than duplicating the data for each robot, this object refers to an individual graph for each robot. This object however does not own the individual graphs - it merely points to them.

Note that VIDs in this object refer to composite state VIDs.

Member Typedef Documentation

◆ adj_edge_iterator

template<typename Vertex , typename Edge >
typedef BaseType::adj_edge_iterator CompositeGraph< Vertex, Edge >::adj_edge_iterator

◆ BaseType

template<typename Vertex , typename Edge >
typedef GenericStateGraph<Vertex, Edge> CompositeGraph< Vertex, Edge >::BaseType

◆ CompositeGraphType

template<typename Vertex , typename Edge >
typedef CompositeGraph<Vertex, Edge> CompositeGraph< Vertex, Edge >::CompositeGraphType

◆ CVI

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

◆ ED

template<typename Vertex , typename Edge >
typedef BaseType::EID CompositeGraph< Vertex, Edge >::ED

◆ edge_descriptor

template<typename Vertex , typename Edge >
typedef BaseType::edge_descriptor CompositeGraph< Vertex, Edge >::edge_descriptor

◆ EdgeHook

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

◆ EI

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

◆ IndividualEdge

template<typename Vertex , typename Edge >
typedef IndividualGraph::EdgeType CompositeGraph< Vertex, Edge >::IndividualEdge

◆ IndividualGraph

template<typename Vertex , typename Edge >
typedef Vertex::IndividualGraph CompositeGraph< Vertex, Edge >::IndividualGraph

◆ STAPLGraph

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

◆ vertex_descriptor

template<typename Vertex , typename Edge >
typedef BaseType::vertex_descriptor CompositeGraph< Vertex, Edge >::vertex_descriptor

◆ vertex_iterator

template<typename Vertex , typename Edge >
typedef BaseType::vertex_iterator CompositeGraph< Vertex, Edge >::vertex_iterator

◆ VertexHook

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

◆ 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

Member Enumeration Documentation

◆ HookType

template<typename Vertex , typename Edge >
enum GenericStateGraph::HookType
strong

Constructor & Destructor Documentation

◆ CompositeGraph() [1/3]

template<typename Vertex , typename Edge >
CompositeGraph< Vertex, Edge >::CompositeGraph ( RobotGroup *const  _g = nullptr,
std::vector< IndividualGraph * >  _graphs = {} 
)

Construct a composite graph.

◆ CompositeGraph() [2/3]

template<typename Vertex , typename Edge >
CompositeGraph< Vertex, Edge >::CompositeGraph ( const CompositeGraph< Vertex, Edge > &  )
delete

◆ CompositeGraph() [3/3]

template<typename Vertex , typename Edge >
CompositeGraph< Vertex, Edge >::CompositeGraph ( CompositeGraph< Vertex, Edge > &&  )
delete

Member Function Documentation

◆ AddEdge() [1/5]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::EID GenericStateGraph< Vertex, Edge >::AddEdge
noexcept

Import the base-class version for this (required because we've overridden one of the overloads).

◆ AddEdge() [2/5]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::EID GenericStateGraph< Vertex, Edge >::AddEdge
noexcept

Import the base-class version for this (required because we've overridden one of the overloads).

◆ AddEdge() [3/5]

template<typename Vertex , typename Edge >
GenericStateGraph< Vertex, Edge >::EID GenericStateGraph< Vertex, Edge >::AddEdge
noexcept

Import the base-class version for this (required because we've overridden one of the overloads).

◆ AddEdge() [4/5]

template<typename Vertex , typename Edge >
CompositeGraph< Vertex, Edge >::ED CompositeGraph< Vertex, Edge >::AddEdge ( const VID  _source,
const VID  _target,
const Edge &  _w 
)
overridevirtualnoexcept

Add an edge from source to target.

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

Reimplemented from GenericStateGraph< Vertex, Edge >.

Reimplemented in GroupRoadmap< Vertex, Edge >.

◆ AddEdge() [5/5]

template<typename Vertex , typename Edge >
std::pair< typename GenericStateGraph< Vertex, Edge >::EID, typename GenericStateGraph< Vertex, Edge >::EID > GenericStateGraph< Vertex, Edge >::AddEdge
noexcept

Import the base-class version for this (required because we've overridden one of the overloads).

◆ AddVertex()

template<typename Vertex , typename Edge >
CompositeGraph< Vertex, Edge >::VID CompositeGraph< Vertex, Edge >::AddVertex ( const Vertex &  _v)
overridevirtualnoexcept

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 from GenericStateGraph< Vertex, Edge >.

Reimplemented in GroupRoadmap< Vertex, Edge >.

◆ ClearHooks()

template<typename Vertex , typename Edge >
void CompositeGraph< Vertex, Edge >::ClearHooks
overridevirtualnoexcept

Uninstall all hooks from each individual graph. Should only be used at the end of a library run to clean the graph object.

Reimplemented from GenericStateGraph< Vertex, Edge >.

◆ DeleteEdge() [1/2]

template<typename Vertex , typename Edge >
void CompositeGraph< Vertex, Edge >::DeleteEdge ( const VID  _source,
const VID  _target 
)
overridevirtualnoexcept

Remove an edge from the graph if it exists.

Parameters
_sourceThe source vertex.
_sourceThe target vertex.

Reimplemented from GenericStateGraph< Vertex, Edge >.

◆ DeleteEdge() [2/2]

template<typename Vertex , typename Edge >
void CompositeGraph< Vertex, Edge >::DeleteEdge ( EI  _iterator)
overridevirtualnoexcept

Remove an edge from the graph if it exists.

Parameters
_iteratorAn iterator to the edge.

Reimplemented from GenericStateGraph< Vertex, Edge >.

◆ DeleteVertex()

template<typename Vertex , typename Edge >
void CompositeGraph< Vertex, Edge >::DeleteVertex ( const VID  _v)
overridevirtualnoexcept

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

Parameters
_vThe vertex descriptor.

@TODO This could be done faster with a directed preds graph, but I want to profile it both ways to be sure of the costs before doing that. We rarely delete vertices, so right now this is an edge case. If we start working with methods that delete a lot of vertices, we will likely need to switch to the directed preds graph.

Reimplemented from GenericStateGraph< Vertex, Edge >.

◆ GetGroup()

template<typename Vertex , typename Edge >
RobotGroup * CompositeGraph< Vertex, Edge >::GetGroup
inlinevirtual

Get the robot group.

◆ GetIndividualGraph() [1/2]

template<typename Vertex , typename Edge >
CompositeGraph< Vertex, Edge >::IndividualGraph * CompositeGraph< Vertex, Edge >::GetIndividualGraph ( const size_t  _index)
inlinevirtual

Get the individual graph for a robot in the group.

Parameters
_indexThe index of the desired robot.

◆ GetIndividualGraph() [2/2]

template<typename Vertex , typename Edge >
const CompositeGraph< Vertex, Edge >::IndividualGraph * CompositeGraph< Vertex, Edge >::GetIndividualGraph ( const size_t  _index) const
inlinevirtual

Get the individual graph for a robot in the group.

Parameters
_indexThe index of the desired robot.

◆ GetNumRobots()

template<typename Vertex , typename Edge >
size_t CompositeGraph< Vertex, Edge >::GetNumRobots
virtualnoexcept

Get the number of robots for the group this graph is for.

◆ operator=() [1/2]

template<typename Vertex , typename Edge >
CompositeGraph& CompositeGraph< Vertex, Edge >::operator= ( CompositeGraph< Vertex, Edge > &&  )
delete

◆ operator=() [2/2]

template<typename Vertex , typename Edge >
CompositeGraph& CompositeGraph< Vertex, Edge >::operator= ( const CompositeGraph< Vertex, Edge > &  )
delete

◆ PrettyPrint()

template<typename Vertex , typename Edge >
std::string CompositeGraph< Vertex, Edge >::PrettyPrint

Print the size of this composite graph and the individual graphs for terminal debugging.

◆ Write()

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

Write the graph using the current standard output rule.

Parameters
_filenameThe file to write to.
_envThe environment, to place in the graph.

For now, we only support composite C-Space output as vizmo is the only vizualiser that has support for groups/composite robots.

Reimplemented from GenericStateGraph< Vertex, Edge >.

◆ WriteCompositeGraph()

template<typename Vertex , typename Edge >
void CompositeGraph< Vertex, Edge >::WriteCompositeGraph ( const std::string &  _filename,
Environment *const  _env 
) const
virtual

Write the graph as a Vizmo-compatible composite C-Space path.

Parameters
_filenameThe file to write to.
_envThe environment, to place in the graph.

Field Documentation

◆ m_graphs

template<typename Vertex , typename Edge >
std::vector<IndividualGraph*> CompositeGraph< Vertex, Edge >::m_graphs
protected

The individual graphs.

◆ m_group

template<typename Vertex , typename Edge >
RobotGroup* const CompositeGraph< Vertex, Edge >::m_group
protected

The robot group.

◆ m_timestamp

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

Tracks the number of changes to the graph.


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