graph_analysis
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | Related Functions | List of all members
graph_analysis::lemon::DirectedGraph Class Reference

Directed graph implementation based on lemon library. More...

#include <DirectedGraph.hpp>

Inheritance diagram for graph_analysis::lemon::DirectedGraph:
Inheritance graph
[legend]
Collaboration diagram for graph_analysis::lemon::DirectedGraph:
Collaboration graph
[legend]

Public Types

typedef shared_ptr< DirectedGraph > Ptr
 
typedef graph_t::ArcMap< Edge::Ptr > EdgeMap
 
typedef graph_t::NodeMap< Vertex::Ptr > VertexMap
 
typedef graph_t::NodeMap< bool > VertexActivationMap
 
typedef graph_t::ArcMap< bool > EdgeActivationMap
 
typedef graph_t::ArcMap< std::string > EdgeStringMap
 
typedef graph_t::NodeMap< std::string > VertexStringMap
 
typedef graph_t::ArcMap< GraphElementId > EdgeIdMap
 
typedef graph_t::NodeMap< GraphElementId > VertexIdMap
 
typedef DirectedSubGraph subgraph_t
 
- Public Types inherited from graph_analysis::TypedGraph< ::lemon::ListDigraph, graph_analysis::BaseGraph >
typedef ::lemon::ListDigraph graph_t
 
- Public Types inherited from graph_analysis::BaseGraph
enum  ImplementationType { BOOST_DIRECTED_GRAPH, LEMON_DIRECTED_GRAPH, SNAP_DIRECTED_GRAPH, IMPLEMENTATION_TYPE_END }
 
typedef shared_ptr< BaseGraph > Ptr
 

Public Member Functions

 DirectedGraph ()
 Default constructor of the graph. More...
 
 ~DirectedGraph ()
 
BaseGraph::Ptr copy () const
 
BaseGraph::Ptr newInstance () const
 
graph_t::Node getNode (const Vertex::Ptr &vertex) const
 
graph_t::Arc getArc (const Edge::Ptr &edge) const
 
Vertex::Ptr getVertex (graph_t::Node node) const
 
Edge::Ptr getEdge (graph_t::Arc arc) const
 
Vertex::Ptr getVertex (GraphElementId id) const
 Get the vertex by id. More...
 
Edge::Ptr getEdge (GraphElementId id) const
 Get the edge by id. More...
 
Vertex::Ptr getSourceVertex (const Edge::Ptr &e) const
 Get the source vertex for this edge. More...
 
Vertex::Ptr getTargetVertex (const Edge::Ptr &e) const
 Get the target vertex for this edge. More...
 
 DirectedGraph (const DirectedGraph &other)
 
DirectedGraph & operator= (const DirectedGraph &other)
 Direct usage off operator= is disallowed in lemon, thus need for explicit usage of copy functions. More...
 
void write (std::ostream &ostream=std::cout) const
 
VertexIterator::Ptr getVertexIterator () const
 
EdgeIterator::Ptr getEdgeIterator () const
 
EdgeIterator::Ptr getEdgeIterator (const Vertex::Ptr &vertex) const
 
EdgeIterator::Ptr getOutEdgeIterator (const Vertex::Ptr &vertex) const
 
EdgeIterator::Ptr getInEdgeIterator (const Vertex::Ptr &vertex) const
 
SubGraph::Ptr identifyConnectedComponents (const BaseGraph::Ptr &baseGraph) const
 
bool isConnected () const override
 
- Public Member Functions inherited from graph_analysis::TypedGraph< ::lemon::ListDigraph, graph_analysis::BaseGraph >
 TypedGraph (BaseGraph::ImplementationType type, bool directed=true)
 
virtual ~TypedGraph ()
 
graph_t & raw ()
 
const graph_t & raw () const
 
- Public Member Functions inherited from graph_analysis::BaseGraph
virtual ~BaseGraph ()
 Default deconstructor. More...
 
void addObserver (const BaseGraphObserver::Ptr &observer)
 
void removeObserver (const BaseGraphObserver::Ptr &observer)
 
void transactionEvent (TransactionType eventType)
 issue a transaction event The transaction event is passed to all observers, which can implement the respective response to the transaction. E.g. rollback, hold-and-forward, etc. More...
 
BaseGraph::Ptr clone () const
 
BaseGraph::Ptr cloneEdges () const
 
ImplementationType getImplementationType () const
 
std::string getImplementationTypeName () const
 
bool empty () const
 tests whether the graph is void/empty More...
 
GraphElementId addVertex (const Vertex::Ptr &vertex)
 Add a vertex. More...
 
GraphElementId getVertexId (const Vertex::Ptr &vertex) const
 Get the vertex id for this graph. More...
 
void removeVertex (const Vertex::Ptr &vertex)
 Remove vertex In order to reimplement, call the base function first BaseGraph::addVertex(v) More...
 
GraphElementId addEdge (const Edge::Ptr &edge)
 Add an edge Cannot be reimplemented directly, but see addEdge(Edge::Ptr, GraphElementId, GraphElementId) More...
 
void removeEdge (const Edge::Ptr &edge)
 
virtual size_t removeEdges (const Vertex::Ptr &a, const Vertex::Ptr &b)
 
GraphElementId addHyperEdge (const HyperEdge::Ptr &hyperEdge)
 
void removeHyperEdge (const HyperEdge::Ptr &hyperEdge)
 
bool contains (const Edge::Ptr &edge) const
 
bool contains (const Vertex::Ptr &vertex) const
 
GraphElementId getEdgeId (const Edge::Ptr &edge) const
 Get the edge id for this graph. More...
 
virtual std::vector< Edge::Ptr > getEdges (const Vertex::Ptr &source, const Vertex::Ptr &target) const
 Get edge by given vertices. More...
 
template<typename T >
std::vector< shared_ptr< T > > getEdges (const Vertex::Ptr &source, const Vertex::Ptr &target) const
 Get edges by given vertices and return only edges of a given type that end at target Type should be a subclass of Edge!! If dynamic_pointer_cast returns null pointer, object is not added. More...
 
template<typename T >
std::vector< shared_ptr< T > > getVertices () const
 Get all vertices of a given type Type should be a subclass of vertex If dynamic_pointer_cast returns null pointer, object is not added. More...
 
GraphId getId () const
 
virtual BaseIterable< VertexIterator::Ptr, BaseGraph, Vertex::Ptr > vertices ()
 
virtual BaseIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr > edges ()
 
virtual std::vector< Vertex::Ptr > getAllVertices () const
 
virtual std::vector< Edge::Ptr > getAllEdges () const
 
void clear ()
 
size_t size () const
 
size_t order () const
 
std::vector< Edge::Ptr > getInEdges (const Vertex::Ptr &vertex) const
 
std::vector< Edge::Ptr > getOutEdges (const Vertex::Ptr &vertex) const
 
SpecializedIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr, Vertex::Ptr > inEdges (const Vertex::Ptr &vertex) const
 
SpecializedIterable< EdgeIterator::Ptr, BaseGraph, Edge::Ptr, Vertex::Ptr > outEdges (const Vertex::Ptr &vertex) const
 
bool isUndirected () const
 
bool isDirected () const
 
- Public Member Functions inherited from graph_analysis::VertexIterable
virtual ~VertexIterable ()
 
virtual uint64_t getVertexCount () const
 
- Public Member Functions inherited from graph_analysis::EdgeIterable
virtual ~EdgeIterable ()
 
virtual uint64_t getEdgeCount () const
 
- Public Member Functions inherited from graph_analysis::Algorithms
virtual ~Algorithms ()
 
virtual shared_ptr< SubGraph > identifyConnectedComponents (const shared_ptr< BaseGraph > &baseGraph) const
 

Protected Member Functions

virtual GraphElementId addVertexInternal (const Vertex::Ptr &vertex)
 Add a vertex. More...
 
virtual void removeVertexInternal (const Vertex::Ptr &)
 
GraphElementId addEdgeInternal (const Edge::Ptr &edge, GraphElementId sourceVertexId, GraphElementId targetVertexId)
 Add an edge. More...
 
virtual void removeEdgeInternal (const Edge::Ptr &)
 
virtual SubGraph::Ptr createSubGraph (const BaseGraph::Ptr &graph) const
 
- Protected Member Functions inherited from graph_analysis::BaseGraph
 BaseGraph (ImplementationType type, bool directed)
 

Protected Attributes

EdgeMap mEdgeMap
 
VertexMap mVertexMap
 
- Protected Attributes inherited from graph_analysis::TypedGraph< ::lemon::ListDigraph, graph_analysis::BaseGraph >
graph_t mGraph
 

Friends

class NodeIterator< DirectedGraph >
 
class ArcIterator< DirectedGraph >
 
class InArcIterator< DirectedGraph >
 
class OutArcIterator< DirectedGraph >
 

Related Functions

(Note that these are not member functions.)

Vertex::Ptr getVertex (DirectedGraph::graph_t::Node node) const
 
Edge::Ptr getEdge (DirectedGraph::graph_t::Arc arc) const
 

Additional Inherited Members

- Static Public Member Functions inherited from graph_analysis::BaseGraph
static Ptr getInstance (ImplementationType type=LEMON_DIRECTED_GRAPH)
 
static SubGraph::Ptr getSubGraph (const Ptr &graph)
 
static SubGraph::Ptr applyFilters (const Ptr &graph, const Filter< Vertex::Ptr >::Ptr &vertexFilter, const Filter< Edge::Ptr >::Ptr &edgeFilter)
 
- Static Public Attributes inherited from graph_analysis::BaseGraph
static std::map< ImplementationType, std::string > ImplementationTypeTxt
 

Detailed Description

Directed graph implementation based on lemon library.

Member Typedef Documentation

◆ EdgeActivationMap

◆ EdgeIdMap

◆ EdgeMap

◆ EdgeStringMap

typedef graph_t::ArcMap< std::string > graph_analysis::lemon::DirectedGraph::EdgeStringMap

◆ Ptr

◆ subgraph_t

◆ VertexActivationMap

◆ VertexIdMap

◆ VertexMap

◆ VertexStringMap

typedef graph_t::NodeMap< std::string > graph_analysis::lemon::DirectedGraph::VertexStringMap

Constructor & Destructor Documentation

◆ DirectedGraph() [1/2]

graph_analysis::lemon::DirectedGraph::DirectedGraph ( )

Default constructor of the graph.

◆ ~DirectedGraph()

graph_analysis::lemon::DirectedGraph::~DirectedGraph ( )

◆ DirectedGraph() [2/2]

graph_analysis::lemon::DirectedGraph::DirectedGraph ( const DirectedGraph &  other)

Member Function Documentation

◆ addEdgeInternal()

GraphElementId graph_analysis::lemon::DirectedGraph::addEdgeInternal ( const Edge::Ptr &  edge,
GraphElementId  sourceVertexId,
GraphElementId  targetVertexId 
)
protectedvirtual

Add an edge.

Returns
the created edge

Reimplemented from graph_analysis::BaseGraph.

◆ addVertexInternal()

GraphElementId graph_analysis::lemon::DirectedGraph::addVertexInternal ( const Vertex::Ptr &  vertex)
protectedvirtual

Add a vertex.

Returns
the created vertex

Reimplemented from graph_analysis::BaseGraph.

◆ copy()

BaseGraph::Ptr graph_analysis::lemon::DirectedGraph::copy ( ) const
virtual

Copy the graph

Reimplemented from graph_analysis::BaseGraph.

◆ createSubGraph()

SubGraph::Ptr graph_analysis::lemon::DirectedGraph::createSubGraph ( const BaseGraph::Ptr &  graph) const
protectedvirtual

Get the subgraph – by default all vertices and edges of the base graph are available (enabled)

Reimplemented from graph_analysis::BaseGraph.

◆ getArc()

DirectedGraph::graph_t::Arc graph_analysis::lemon::DirectedGraph::getArc ( const Edge::Ptr &  edge) const

◆ getEdge() [1/2]

Edge::Ptr graph_analysis::lemon::DirectedGraph::getEdge ( graph_t::Arc  arc) const

Get the edge from a given lemon edge

Returns
edge

◆ getEdge() [2/2]

Edge::Ptr graph_analysis::lemon::DirectedGraph::getEdge ( GraphElementId  id) const
virtual

Get the edge by id.

Returns
Edge with given id

Reimplemented from graph_analysis::BaseGraph.

◆ getEdgeIterator() [1/2]

EdgeIterator::Ptr graph_analysis::lemon::DirectedGraph::getEdgeIterator ( ) const
virtual

Get the edge iterator for this implementation

Reimplemented from graph_analysis::BaseGraph.

◆ getEdgeIterator() [2/2]

EdgeIterator::Ptr graph_analysis::lemon::DirectedGraph::getEdgeIterator ( const Vertex::Ptr &  vertex) const
virtual

Get iterator over all edges (in/out) from the given vertex

Returns
EdgeIterator over all edges of this vertex

Reimplemented from graph_analysis::BaseGraph.

◆ getInEdgeIterator()

EdgeIterator::Ptr graph_analysis::lemon::DirectedGraph::getInEdgeIterator ( const Vertex::Ptr &  vertex) const
virtual

Get in edge iterator If the graph is undirected will return the same iterator as getEdgeIterator

Reimplemented from graph_analysis::BaseGraph.

◆ getNode()

DirectedGraph::graph_t::Node graph_analysis::lemon::DirectedGraph::getNode ( const Vertex::Ptr &  vertex) const

Translate between wrapper and native formats

◆ getOutEdgeIterator()

EdgeIterator::Ptr graph_analysis::lemon::DirectedGraph::getOutEdgeIterator ( const Vertex::Ptr &  vertex) const
virtual

Get out edge iterator If the graph is undirected will return the same iterator as getEdgeIterator

Reimplemented from graph_analysis::BaseGraph.

◆ getSourceVertex()

Vertex::Ptr graph_analysis::lemon::DirectedGraph::getSourceVertex ( const Edge::Ptr &  e) const

Get the source vertex for this edge.

Returns
Pointer to the vertex data

◆ getTargetVertex()

Vertex::Ptr graph_analysis::lemon::DirectedGraph::getTargetVertex ( const Edge::Ptr &  e) const

Get the target vertex for this edge.

Returns
Pointer to the vertex data

◆ getVertex() [1/2]

Vertex::Ptr graph_analysis::lemon::DirectedGraph::getVertex ( graph_t::Node  node) const

Get the vertex from a given lemon node

Returns
vertex

◆ getVertex() [2/2]

Vertex::Ptr graph_analysis::lemon::DirectedGraph::getVertex ( GraphElementId  id) const
virtual

Get the vertex by id.

Returns
vertex

Reimplemented from graph_analysis::BaseGraph.

◆ getVertexIterator()

VertexIterator::Ptr graph_analysis::lemon::DirectedGraph::getVertexIterator ( ) const
virtual

Get the vertex iterator for this implementation

Reimplemented from graph_analysis::BaseGraph.

◆ identifyConnectedComponents()

SubGraph::Ptr graph_analysis::lemon::DirectedGraph::identifyConnectedComponents ( const BaseGraph::Ptr &  baseGraph) const

Identifies the connected components

◆ isConnected()

bool graph_analysis::lemon::DirectedGraph::isConnected ( ) const
overridevirtual

Check if the graph is connected

Reimplemented from graph_analysis::Algorithms.

◆ newInstance()

BaseGraph::Ptr graph_analysis::lemon::DirectedGraph::newInstance ( ) const
virtual

Create new instance of this graph

Reimplemented from graph_analysis::BaseGraph.

◆ operator=()

DirectedGraph & graph_analysis::lemon::DirectedGraph::operator= ( const DirectedGraph &  other)

Direct usage off operator= is disallowed in lemon, thus need for explicit usage of copy functions.

◆ removeEdgeInternal()

void graph_analysis::lemon::DirectedGraph::removeEdgeInternal ( const Edge::Ptr &  edge)
protectedvirtual

Remove an edge from the internal graph representation

Returns
Element id of this vertex within this graph

Reimplemented from graph_analysis::BaseGraph.

◆ removeVertexInternal()

void graph_analysis::lemon::DirectedGraph::removeVertexInternal ( const Vertex::Ptr &  vertex)
protectedvirtual

Remove a vertex from the internal graph representation

Reimplemented from graph_analysis::BaseGraph.

◆ write()

void graph_analysis::lemon::DirectedGraph::write ( std::ostream &  ostream = std::cout) const

Friends And Related Function Documentation

◆ ArcIterator< DirectedGraph >

friend class ArcIterator< DirectedGraph >
friend

◆ getEdge()

Edge::Ptr getEdge ( DirectedGraph::graph_t::Arc  arc) const
related

◆ getVertex()

Vertex::Ptr getVertex ( DirectedGraph::graph_t::Node  node) const
related

◆ InArcIterator< DirectedGraph >

friend class InArcIterator< DirectedGraph >
friend

◆ NodeIterator< DirectedGraph >

friend class NodeIterator< DirectedGraph >
friend

◆ OutArcIterator< DirectedGraph >

friend class OutArcIterator< DirectedGraph >
friend

Member Data Documentation

◆ mEdgeMap

EdgeMap graph_analysis::lemon::DirectedGraph::mEdgeMap
protected

◆ mVertexMap

VertexMap graph_analysis::lemon::DirectedGraph::mVertexMap
protected

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