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

A subgraph represent a particular filtered 'view' on a BaseGraph. More...

#include <SubGraph.hpp>

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

Public Types

typedef shared_ptr< SubGraph > Ptr
 

Public Member Functions

 SubGraph (const shared_ptr< BaseGraph > &graph)
 
virtual ~SubGraph ()
 
virtual void enable (const Vertex::Ptr &vertex)
 
virtual void disable (const Vertex::Ptr &vertex)
 
virtual void enable (const Edge::Ptr &edge)
 
virtual void disable (const Edge::Ptr &edge)
 
virtual bool enabled (const Vertex::Ptr &vertex) const
 
virtual bool enabled (const Edge::Ptr &edge) const
 
bool disabled (const Vertex::Ptr &vertex) const
 
bool disabled (const Edge::Ptr &edge) const
 
void enableAllVertices ()
 
void enableAllEdges ()
 
void disableAllVertices ()
 
void disableAllEdges ()
 
void applyFilters (const Filter< Vertex::Ptr >::Ptr &vertexFilter, const Filter< Edge::Ptr >::Ptr &edgeFilter)
 
virtual shared_ptr< BaseGraph > toBaseGraph () const
 
virtual VertexIterator::Ptr getVertexIterator () const
 
virtual EdgeIterator::Ptr getEdgeIterator () const
 
virtual EdgeIterator::Ptr getEdgeIterator (const Vertex::Ptr &vertex) const
 
shared_ptr< BaseGraph > getBaseGraph () 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
 

Protected Attributes

shared_ptr< BaseGraph > mpBaseGraph
 Ptr which refers to the original (super) graph. More...
 
std::set< GraphElementId > mDisabledVertices
 
std::set< GraphElementId > mDisabledEdges
 

Detailed Description

A subgraph represent a particular filtered 'view' on a BaseGraph.

Initialize the Subgraph G'(V',E') with a BaseGraph G(V,E), where the following holds

\[ V' \subseteq V \land E' \subseteq E \]

The subset membership for vertices and edges can be controlled via functions SubGraph::enable and SubGraph::disable

The iterators of the subgraph check the membership in order to transparently skip vertices / edges that are not members of the subgraph

Disabling a vertex will result in disabling all outgoing or incoming edges Reenabling such vertex however will only reenable the particular vertex

In order to export the SubGraph as a BaseGraph use SubGraph::toBaseGraph

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ SubGraph()

graph_analysis::SubGraph::SubGraph ( const shared_ptr< BaseGraph > &  graph)

Default constructor

Parameters
graphInitialize the Subgraph G'(V',E') with a BaseGraph G(V,E), where the following holds

\[ V' \subseteq V \land E' \subseteq E \]

◆ ~SubGraph()

virtual graph_analysis::SubGraph::~SubGraph ( )
inlinevirtual

Member Function Documentation

◆ applyFilters()

void graph_analysis::SubGraph::applyFilters ( const Filter< Vertex::Ptr >::Ptr &  vertexFilter,
const Filter< Edge::Ptr >::Ptr &  edgeFilter 
)

Apply filters to this subgraph

Apply filters to this subgraph, pass filters::Filter<Vertex::Ptr>::Null() or filters::Filter<Edge::Ptr>::Null() to skip filter for vertices or nodes

◆ disable() [1/2]

void graph_analysis::SubGraph::disable ( const Edge::Ptr &  edge)
virtual

Disable the given edge

Parameters
edgeEdge that is part of the underlying main graph and should not be part of the subgraph

Reimplemented in graph_analysis::lemon::DirectedSubGraph.

◆ disable() [2/2]

void graph_analysis::SubGraph::disable ( const Vertex::Ptr &  vertex)
virtual

Disable the given vertex

Parameters
vertexVertex that is part of the underlying main graph and should not(!) be part of the subgraph

Reimplemented in graph_analysis::lemon::DirectedSubGraph.

◆ disableAllEdges()

void graph_analysis::SubGraph::disableAllEdges ( )

Disable all edges

◆ disableAllVertices()

void graph_analysis::SubGraph::disableAllVertices ( )

Disable all vertices

◆ disabled() [1/2]

bool graph_analysis::SubGraph::disabled ( const Edge::Ptr &  edge) const
inline

Test if an edge is disabled

Returns
True if edge is disabled, false otherwise

◆ disabled() [2/2]

bool graph_analysis::SubGraph::disabled ( const Vertex::Ptr &  vertex) const
inline

Test if a vertex is disabled

Returns
True if vertex is disable, false otherwise

◆ enable() [1/2]

void graph_analysis::SubGraph::enable ( const Edge::Ptr &  edge)
virtual

Enable the given edge

Parameters
edgeEdge that is part of the underlying main graph and should be part of the subgraph

Reimplemented in graph_analysis::lemon::DirectedSubGraph.

◆ enable() [2/2]

void graph_analysis::SubGraph::enable ( const Vertex::Ptr &  vertex)
virtual

Enable the given vertex

Parameters
vertexVertex that is part of the underlying main graph and should also be part of the subgraph

Reimplemented in graph_analysis::lemon::DirectedSubGraph.

◆ enableAllEdges()

void graph_analysis::SubGraph::enableAllEdges ( )

Enable all edges

◆ enableAllVertices()

void graph_analysis::SubGraph::enableAllVertices ( )

Enable all vertices

◆ enabled() [1/2]

bool graph_analysis::SubGraph::enabled ( const Edge::Ptr &  edge) const
virtual

Test if an edge is enabled

Returns
True if edge is enabled, false otherwise

Reimplemented in graph_analysis::lemon::DirectedSubGraph.

◆ enabled() [2/2]

bool graph_analysis::SubGraph::enabled ( const Vertex::Ptr &  vertex) const
virtual

Test if a vertex is enabled

Returns
True if vertex is enabled, false otherwise

Reimplemented in graph_analysis::lemon::DirectedSubGraph.

◆ getBaseGraph()

BaseGraph::Ptr graph_analysis::SubGraph::getBaseGraph ( ) const

Get the underlying base graph

◆ getEdgeIterator() [1/2]

EdgeIterator::Ptr graph_analysis::SubGraph::getEdgeIterator ( ) const
virtual

Get iterator over all edge in this subgraph

Returns
the edge iterator

Reimplemented from graph_analysis::EdgeIterable.

◆ getEdgeIterator() [2/2]

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

Get iterator over all edges that are starting a vertex

Returns
the edge iterator

◆ getVertexIterator()

VertexIterator::Ptr graph_analysis::SubGraph::getVertexIterator ( ) const
virtual

Get the iterator over all vertices in this subgraph

Returns
the egde iterator

Reimplemented from graph_analysis::VertexIterable.

◆ toBaseGraph()

BaseGraph::Ptr graph_analysis::SubGraph::toBaseGraph ( ) const
virtual

Convert the subgraph into a base graph by copying only the enabled nodes and edges

Member Data Documentation

◆ mDisabledEdges

std::set<GraphElementId> graph_analysis::SubGraph::mDisabledEdges
protected

◆ mDisabledVertices

std::set<GraphElementId> graph_analysis::SubGraph::mDisabledVertices
protected

◆ mpBaseGraph

shared_ptr<BaseGraph> graph_analysis::SubGraph::mpBaseGraph
protected

Ptr which refers to the original (super) graph.


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