iceoryx_doc  1.0.1
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT > Class Template Reference

#include <directed_graph.hpp>

Inheritance diagram for DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >:
Inheritance graph
[legend]
Collaboration diagram for DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >:
Collaboration graph
[legend]

Classes

struct  VertexData
 

Public Types

using Index_t = int32_t
 
using AdjacencyList = iox::cxx::vector< VertexType *, DEGREE_LIMIT >
 

Public Member Functions

bool addVertex (VertexType *vertex)
 
virtual bool addEdge (VertexType *fromVertex, VertexType *toVertex)
 
Index_t getIndex (VertexType const *vertex)
 
const AdjacencyListgetSuccessors (VertexType const *vertex)
 
const AdjacencyListgetPredecessors (VertexType const *vertex)
 
const AdjacencyListgetSuccessors (Index_t index)
 
const AdjacencyListgetPredecessors (Index_t index)
 
iox::cxx::vector< VertexType *, VERTEX_LIMIT > getSources ()
 
iox::cxx::vector< VertexType *, VERTEX_LIMIT > getSinks ()
 
bool isSource (VertexType const *vertex)
 
bool isSink (VertexType const *vertex)
 
size_t numberOfVertices ()
 
size_t numberOfEdges ()
 

Static Public Attributes

static constexpr Index_t INVALID_INDEX = -1
 

Protected Types

using AdjacencyIndexList = iox::cxx::vector< Index_t, DEGREE_LIMIT >
 

Protected Member Functions

Index_t findVertex (VertexType const *vertex) const
 
bool isValid (Index_t index)
 

Protected Attributes

iox::cxx::vector< VertexData, VERTEX_LIMIT > m_vertices
 
size_t m_numEdges {0}
 

Detailed Description

template<typename VertexType, int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
class DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >

Todo:
: refine and move to utils

Member Function Documentation

◆ addEdge()

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
virtual bool DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::addEdge ( VertexType *  fromVertex,
VertexType *  toVertex 
)
inlinevirtual

add an edge between fromVertex and toVertex to the graph

Parameters
[in]fromVertex
[in]toVertex
Returns
pointer true if the edge was added successfully, false otherwise (e.g. vertices do not exist)

Reimplemented in DirectedAcyclicGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >.

◆ addVertex()

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
bool DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::addVertex ( VertexType *  vertex)
inline

add a vertex to the graph

Parameters
[in]vertexvertex to be added
Returns
pointer true if the vertex was added successfully, false otherwise (e.g. capacity reached or vertex already exists)

◆ getIndex()

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
Index_t DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::getIndex ( VertexType const *  vertex)
inline

get the internal index of a given vertex

Parameters
[in]vertexvertex of which the index is requested
Returns
internal index of vertex, -1 if vertex does not exist

◆ getPredecessors() [1/2]

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
const AdjacencyList* DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::getPredecessors ( Index_t  index)
inline

get the direct predecessors of a given vertex index in the graph

Parameters
[in]indexindex of vertex of which the predecessors are requested
Returns
pointer to the list of predecessors, nullptr if index does not exist in the graph

◆ getPredecessors() [2/2]

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
const AdjacencyList* DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::getPredecessors ( VertexType const *  vertex)
inline

get the direct predecessors of a given vertex in the graph

Parameters
[in]vertexvertex of which the predecessors are requested
Returns
pointer to the list of predecessors, nullptr if vertex does not exist

◆ getSinks()

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
iox::cxx::vector<VertexType*, VERTEX_LIMIT> DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::getSinks ( )
inline

get the sink vertices of the graph, i.e. vertices without outgoing edges

Returns
vector filled with sink vertices (might be empty if e.g. the graph is a cycle)

◆ getSources()

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
iox::cxx::vector<VertexType*, VERTEX_LIMIT> DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::getSources ( )
inline

get the source vertices of the graph, i.e. vertices without incoming edges

Returns
vector filled with source vertices (might be empty if e.g. the graph is a cycle)

◆ getSuccessors() [1/2]

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
const AdjacencyList* DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::getSuccessors ( Index_t  index)
inline

get the direct successors of a given vertex index in the graph

Parameters
[in]indexindex of vertex of which the successors are requested
Returns
pointer to the list of successors, nullptr if index does not exist in the graph

◆ getSuccessors() [2/2]

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
const AdjacencyList* DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::getSuccessors ( VertexType const *  vertex)
inline

get the direct successors of a given vertex in the graph

Parameters
[in]vertexvertex of which the successors are requested
Returns
pointer to the list of successors, nullptr if vertex does not exist

◆ isSink()

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
bool DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::isSink ( VertexType const *  vertex)
inline

check whether the given vertex is a sink

Parameters
[in]vertexto be checked
Returns
true if the vertex is a sink

◆ isSource()

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
bool DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::isSource ( VertexType const *  vertex)
inline

check whether the given vertex is a source

Parameters
[in]vertexto be checked
Returns
true iff the vertex is a source

◆ numberOfEdges()

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
size_t DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::numberOfEdges ( )
inline

get the number of edges

Returns
number of edges

◆ numberOfVertices()

template<typename VertexType , int32_t VERTEX_LIMIT, int32_t DEGREE_LIMIT>
size_t DirectedGraph< VertexType, VERTEX_LIMIT, DEGREE_LIMIT >::numberOfVertices ( )
inline

get the number of vertices

Returns
number of vertices

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