graph_analysis
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
graph_analysis::GraphElement Class Reference

GraphElement is the base class for all element in a graph, i.e. for edges and vertices. More...

#include <GraphElement.hpp>

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

Public Types

typedef shared_ptr< GraphElement > Ptr
 
typedef weak_ptr< GraphElement > WeakPtr
 
typedef std::vector< Ptr > PtrList
 

Public Member Functions

 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
 
virtual std::string getClassName () const
 
virtual std::string toString (uint32_t indent) const
 
virtual std::string toString () 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
 

Static Public Member Functions

static GraphElement::Ptr fromUuid (const GraphElementUuid &uuid)
 

Protected Member Functions

GraphElement::Ptr getSharedFromThis ()
 
void disassociateFromAll ()
 
void setUuid (const GraphElementUuid &uuid)
 
void setUuid (const std::string &uuid)
 

Protected Attributes

GraphElementMap mGraphElementMap
 
GraphElementUuid mUuid
 
std::string mLabel
 

Static Protected Attributes

static boost::uuids::random_generator msUuidGenerator
 
static std::map< GraphElementUuid, function< GraphElement::Ptr()> > msGraphElements
 

Friends

class graph_analysis::io::Reader
 

Detailed Description

GraphElement is the base class for all element in a graph, i.e. for edges and vertices.

It provides labeling functionality as well as the handling of ids One GraphElement can be associated in multiple graphs

Member Typedef Documentation

◆ Ptr

◆ PtrList

◆ WeakPtr

Constructor & Destructor Documentation

◆ GraphElement()

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

Default constructor.

◆ ~GraphElement()

graph_analysis::GraphElement::~GraphElement ( )
virtual

Member Function Documentation

◆ associate()

void graph_analysis::GraphElement::associate ( GraphId  graph,
GraphElementId  elementId 
)
inline

Add the element to a corresponding graph This allows reverse mapping from the element to the graphs it belongs to

◆ associated()

bool graph_analysis::GraphElement::associated ( GraphId  graph) const
inline

Test whether this element has been associated with an edge or node

◆ disassociate()

void graph_analysis::GraphElement::disassociate ( GraphId  graph)
inline

Remove the edge that corresponds to a given graph

◆ disassociateFromAll()

void graph_analysis::GraphElement::disassociateFromAll ( )
inlineprotected

◆ fromUuid()

GraphElement::Ptr graph_analysis::GraphElement::fromUuid ( const GraphElementUuid &  uuid)
static

Get pointer to existing GraphElement from Uuid

Returns
pointer to GraphElement

◆ getClassName()

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

◆ getGraphAssociations()

GraphIdList graph_analysis::GraphElement::getGraphAssociations ( ) const

Get list of graph associations this element has

◆ getId()

GraphElementId graph_analysis::GraphElement::getId ( GraphId  graphId) const

Get id of this element within a given graph

◆ getLabel()

virtual const std::string& graph_analysis::GraphElement::getLabel ( ) const
inlinevirtual

Get label

◆ getSharedFromThis()

GraphElement::Ptr graph_analysis::GraphElement::getSharedFromThis ( )
inlineprotected

Add local method to shared from this to allow using bind

Returns
pointer to existing GraphElement

◆ getUid()

GraphElementUuid graph_analysis::GraphElement::getUid ( ) const
inline

Get a universally unique id of this GraphElement

Deprecated:
use getUuid instead

◆ getUuid()

GraphElementUuid graph_analysis::GraphElement::getUuid ( ) const
inline

Get a universally unique id of this GraphElement

Returns
uuid

◆ setLabel()

virtual void graph_analysis::GraphElement::setLabel ( const std::string &  label)
inlinevirtual

Set a label

◆ setUuid() [1/2]

void graph_analysis::GraphElement::setUuid ( const GraphElementUuid &  uuid)
inlineprotected

Set the uuid from a given one, e.g., when deserialising elements

◆ setUuid() [2/2]

void graph_analysis::GraphElement::setUuid ( const std::string &  uuid)
protected

◆ toPrefixedString()

std::string graph_analysis::GraphElement::toPrefixedString ( GraphId  graph) const

Convert to a string with the element id as prefix

◆ toString() [1/2]

virtual std::string graph_analysis::GraphElement::toString ( uint32_t  indent) const
inlinevirtual

Convert element to string and adding and indentation (in spaces) to the string

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

◆ toString() [2/2]

virtual std::string graph_analysis::GraphElement::toString ( ) const
inlinevirtual

Friends And Related Function Documentation

◆ graph_analysis::io::Reader

friend class graph_analysis::io::Reader
friend

Member Data Documentation

◆ mGraphElementMap

GraphElementMap graph_analysis::GraphElement::mGraphElementMap
protected

◆ mLabel

std::string graph_analysis::GraphElement::mLabel
protected

◆ msGraphElements

std::map< GraphElementUuid, function< GraphElement::Ptr()> > graph_analysis::GraphElement::msGraphElements
staticprotected

◆ msUuidGenerator

boost::uuids::random_generator graph_analysis::GraphElement::msUuidGenerator
staticprotected

◆ mUuid

GraphElementUuid graph_analysis::GraphElement::mUuid
protected

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