graph_analysis
Public Types | Public Member Functions | Protected Member Functions | List of all members
graph_analysis::Vertex Class Reference

A vertex inherited to allow storing data of any type. More...

#include <Vertex.hpp>

Inheritance diagram for graph_analysis::Vertex:
Inheritance graph
[legend]
Collaboration diagram for graph_analysis::Vertex:
Collaboration graph
[legend]

Public Types

typedef shared_ptr< Vertex > Ptr
 
typedef shared_ptr< const Vertex > ConstPtr
 
typedef std::vector< Ptr > PtrList
 
typedef std::set< Ptr > PtrSet
 
- Public Types inherited from graph_analysis::GraphElement
typedef shared_ptr< GraphElement > Ptr
 
typedef weak_ptr< GraphElement > WeakPtr
 
typedef std::vector< Ptr > PtrList
 

Public Member Functions

virtual ~Vertex ()
 
 Vertex (const std::string &label=std::string())
 
Vertex::Ptr clone () const
 
virtual std::string getClassName () const
 
virtual std::string toString () const
 
virtual std::string toString (uint32_t indentation) const
 
Vertex::Ptr getSharedPointerFromGraph (const shared_ptr< BaseGraph > &pGraph) const
 
Vertex::Ptr getPtr ()
 
Vertex::ConstPtr getPtr () const
 
virtual void registerAttributes (VertexTypeManager *) const
 
- Public Member Functions inherited from graph_analysis::GraphElement
 GraphElement (const std::string &label=std::string())
 Default constructor. More...
 
virtual ~GraphElement ()
 
virtual void setLabel (const std::string &label)
 
virtual const std::string & getLabel () const
 
bool associated (GraphId graph) const
 
void associate (GraphId graph, GraphElementId elementId)
 
void disassociate (GraphId graph)
 
GraphElementId getId (GraphId graph) const
 
GraphElementUuid getUid () const
 
GraphElementUuid getUuid () const
 
GraphIdList getGraphAssociations () const
 
std::string toPrefixedString (GraphId graph) const
 

Protected Member Functions

virtual Vertex * getClone () const
 
- Protected Member Functions inherited from graph_analysis::GraphElement
GraphElement::Ptr getSharedFromThis ()
 
void disassociateFromAll ()
 
void setUuid (const GraphElementUuid &uuid)
 
void setUuid (const std::string &uuid)
 

Additional Inherited Members

- Static Public Member Functions inherited from graph_analysis::GraphElement
static GraphElement::Ptr fromUuid (const GraphElementUuid &uuid)
 
- Protected Attributes inherited from graph_analysis::GraphElement
GraphElementMap mGraphElementMap
 
GraphElementUuid mUuid
 
std::string mLabel
 
- Static Protected Attributes inherited from graph_analysis::GraphElement
static boost::uuids::random_generator msUuidGenerator
 
static std::map< GraphElementUuid, function< GraphElement::Ptr()> > msGraphElements
 

Detailed Description

A vertex inherited to allow storing data of any type.

For the purpose of storing data with a vertex, the storage type needs to inherit from this class

Member Typedef Documentation

◆ ConstPtr

typedef shared_ptr< const Vertex > graph_analysis::Vertex::ConstPtr

◆ Ptr

typedef shared_ptr< Vertex > graph_analysis::Vertex::Ptr

◆ PtrList

typedef std::vector< Ptr > graph_analysis::Vertex::PtrList

◆ PtrSet

typedef std::set< Ptr > graph_analysis::Vertex::PtrSet

Constructor & Destructor Documentation

◆ ~Vertex()

virtual graph_analysis::Vertex::~Vertex ( )
inlinevirtual

◆ Vertex()

graph_analysis::Vertex::Vertex ( const std::string &  label = std::string())

Member Function Documentation

◆ clone()

Vertex::Ptr graph_analysis::Vertex::clone ( ) const

Clone this vertex – the returned vertex will have no graph association

◆ getClassName()

virtual std::string graph_analysis::Vertex::getClassName ( ) const
inlinevirtual

◆ getClone()

virtual Vertex* graph_analysis::Vertex::getClone ( ) const
inlineprotectedvirtual

Create a copy of this vertex using a explicit clone of the subclass of Vertex

return new MyVertex(*this);

Reimplemented in graph_analysis::HyperEdge, graph_analysis::DirectedHyperEdge, and graph_analysis::NWeightedVertex< T, Dim >.

◆ getPtr() [1/2]

Vertex::ConstPtr graph_analysis::Vertex::getPtr ( )

Get the shared pointer for this object – do not use on stack allocated objects

◆ getPtr() [2/2]

Vertex::ConstPtr graph_analysis::Vertex::getPtr ( ) const

Get the shared pointer for this object – do not use on stack allocated objects

◆ getSharedPointerFromGraph()

Vertex::Ptr graph_analysis::Vertex::getSharedPointerFromGraph ( const shared_ptr< BaseGraph > &  pGraph) const

Deprecated function in order for child-classes to iterate the graph, a way to obtain the shared pointer actually respresenting this vertex on a particular graph is needed.

Parameters
pGraphshared pointer to the graph where this vertex is contained
Returns
shared pointer of this vertex belonging to the given graph
Deprecated:
Please use functionality of std::enable_shared_from_this and thus getSharedPtr

◆ registerAttributes()

virtual void graph_analysis::Vertex::registerAttributes ( VertexTypeManager *  ) const
inlinevirtual

Hook to register attributes of this vertex, in order to properly perform serialization

If serialization is not needed, then registration is optional Otherwise each Vertex implementation has to implement this method, and add a static member

#include "VertexRegistration.hpp"

class DerivedVertex : Vertex
{
   static const VertexRegistration<DerivedVertex> __attribute__((used)) msRegistration;
}

in the source file, e.g. DerivedVertex.cpp add

const VertexRegistration<DerivedVertex> DerivedVertex::msRegistration;

Reimplemented in graph_analysis::NWeightedVertex< T, Dim >, and graph_analysis::algorithms::MultiCommodityVertex.

◆ toString() [1/2]

std::string graph_analysis::Vertex::toString ( ) const
virtual

◆ toString() [2/2]

std::string graph_analysis::Vertex::toString ( uint32_t  indentation) const
virtual

Convert element to string and apply a given indentation (in number of spaces)

Reimplemented from graph_analysis::GraphElement.

Reimplemented in graph_analysis::DirectedHyperEdge, and graph_analysis::HyperEdge.


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