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

An Edge represents the link between two vertices. More...

#include <Edge.hpp>

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

Public Types

typedef shared_ptr< Edge > Ptr
 
typedef shared_ptr< const Edge > 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

 Edge (const std::string &label=std::string())
 
 Edge (const Vertex::Ptr &source, const Vertex::Ptr &target, const std::string &label=std::string())
 
virtual ~Edge ()
 
Edge::Ptr clone () const
 
virtual std::string getClassName () const
 
virtual std::string toString () const
 
virtual std::string toString (uint32_t indent) const
 
Vertex::Ptr getSourceVertex () const
 
Vertex::Ptr getTargetVertex () const
 
void setSourceVertex (const Vertex::Ptr &source)
 
void setTargetVertex (const Vertex::Ptr &target)
 
Edge::Ptr getSharedPointerFromGraph (const shared_ptr< BaseGraph > &pGraph) const
 
Edge::Ptr getPtr ()
 
Edge::ConstPtr getPtr () const
 
virtual void registerAttributes (EdgeTypeManager *) 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
 

Static Public Member Functions

static std::vector< Vertex::Ptr > getInvolvedVertices (const Edge::Ptr &e0, const Edge::Ptr &e1)
 
static bool areMeeting (const Edge::Ptr &e0, const Edge::Ptr &e1)
 
- Static Public Member Functions inherited from graph_analysis::GraphElement
static GraphElement::Ptr fromUuid (const GraphElementUuid &uuid)
 

Protected Member Functions

virtual Edge * 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

- 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

An Edge represents the link between two vertices.

For the purpose of storing data in a edge, the storage type needs to be defined by inheriting from this class, some default implementations exists

Member Typedef Documentation

◆ ConstPtr

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

◆ Ptr

typedef shared_ptr< Edge > graph_analysis::Edge::Ptr

◆ PtrList

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

◆ PtrSet

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

Constructor & Destructor Documentation

◆ Edge() [1/2]

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

◆ Edge() [2/2]

graph_analysis::Edge::Edge ( const Vertex::Ptr &  source,
const Vertex::Ptr &  target,
const std::string &  label = std::string() 
)

◆ ~Edge()

virtual graph_analysis::Edge::~Edge ( )
inlinevirtual

Member Function Documentation

◆ areMeeting()

bool graph_analysis::Edge::areMeeting ( const Edge::Ptr &  e0,
const Edge::Ptr &  e1 
)
static

Check if two edges meet at a vertex

Returns
true if edges meet at least one vertex

◆ clone()

Edge::Ptr graph_analysis::Edge::clone ( ) const

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

◆ getClassName()

std::string graph_analysis::Edge::getClassName ( ) const
virtual

◆ getClone()

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

◆ getInvolvedVertices()

std::vector< Vertex::Ptr > graph_analysis::Edge::getInvolvedVertices ( const Edge::Ptr &  e0,
const Edge::Ptr &  e1 
)
static

Get all involved vertices for two edges

Returns
all distinct vertices of two edges

◆ getPtr() [1/2]

Edge::Ptr graph_analysis::Edge::getPtr ( )

Get the shared pointer for this object

◆ getPtr() [2/2]

Edge::ConstPtr graph_analysis::Edge::getPtr ( ) const

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

◆ getSharedPointerFromGraph()

Edge::Ptr graph_analysis::Edge::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 edge on a particular graph is needed.

Parameters
pGraphshared pointer to the graph where this edge is contained
Returns
shared pointer of this edge belonging to the given graph

◆ getSourceVertex()

Vertex::Ptr graph_analysis::Edge::getSourceVertex ( ) const
inline

Get the source vertex

◆ getTargetVertex()

Vertex::Ptr graph_analysis::Edge::getTargetVertex ( ) const
inline

Get the target vertex

◆ registerAttributes()

virtual void graph_analysis::Edge::registerAttributes ( EdgeTypeManager *  ) 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 Edge implementation has to implement this method, and add a static member

#include "EdgeRegistration.hpp"

class DerivedEdge : Edge
{
   static const EdgeRegistration<DerivedEdge> __attribute__((used)) msRegistration;
}

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

const EdgeRegistration<DerivedEdge> DerivedEdge::msRegistration;

Reimplemented in graph_analysis::algorithms::MultiCommodityEdge.

◆ setSourceVertex()

void graph_analysis::Edge::setSourceVertex ( const Vertex::Ptr &  source)
inline

Set the source vertex

◆ setTargetVertex()

void graph_analysis::Edge::setTargetVertex ( const Vertex::Ptr &  target)
inline

Set the target vertex

◆ toString() [1/2]

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

Convert element to string

Returns
string representation of edge

Reimplemented from graph_analysis::GraphElement.

Reimplemented in graph_analysis::NWeighted< T, Dim, Edge >, and graph_analysis::algorithms::MultiCommodityEdge.

◆ toString() [2/2]

std::string graph_analysis::Edge::toString ( uint32_t  indent) const
virtual

Convert element to string

Returns
string representation of edge

Reimplemented from graph_analysis::GraphElement.


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