graph_analysis
Public Types | Public Member Functions | List of all members
graph_analysis::algorithms::DFSVisitor Class Reference

Special visitor for the DFS. More...

#include <DFSVisitor.hpp>

Inheritance diagram for graph_analysis::algorithms::DFSVisitor:
Inheritance graph
[legend]
Collaboration diagram for graph_analysis::algorithms::DFSVisitor:
Collaboration graph
[legend]

Public Types

typedef shared_ptr< DFSVisitor > Ptr
 
- Public Types inherited from graph_analysis::algorithms::Visitor
enum  Status { UNKNOWN = 0, REGISTERED, VISITED }
 
typedef shared_ptr< Visitor > Ptr
 

Public Member Functions

virtual void initializeVertex (Vertex::Ptr &vertex)
 
virtual void leafVertex (Vertex::Ptr &vertex)
 
virtual void examineEdge (Edge::Ptr &edge)
 
virtual void treeEdge (Edge::Ptr &edge)
 
virtual void forwardOrCrossEdge (Edge::Ptr &edge)
 
virtual void backEdge (Edge::Ptr &edge)
 
virtual void discoverVertex (Vertex::Ptr &vertex)
 
virtual void finishVertex (Vertex::Ptr &vertex)
 
- Public Member Functions inherited from graph_analysis::algorithms::Visitor
virtual ~Visitor ()
 
void setStatus (const Vertex::Ptr &vertex, Status status)
 
void setStatus (const Edge::Ptr &edge, Status status)
 
Status getStatus (const Vertex::Ptr &vertex) const
 
Status getStatus (const Edge::Ptr &edge) const
 
virtual void startVertex (Vertex::Ptr &vertex)
 
virtual void cycleEdge (Edge::Ptr &edge)
 
virtual void edgeRelaxed (Edge::Ptr &edge)
 
virtual void edgeNotRelaxed (Edge::Ptr &edge)
 
virtual void edgeMinimized (Edge::Ptr &edge)
 
virtual void edgeNotMinimized (Edge::Ptr &edge)
 

Detailed Description

Special visitor for the DFS.

class PathConstructor : public graph_analysis::algorithm::DFSVisitor
{
   bool invalidTransition(graph_analysis::Edge::Ptr& edge) { // check if it a valid transition and return true or false ... }
   void discoverVertex(graph_analysis::Vertex::Ptr& vertex) { // collect vertices ... }
};

BaseGraph::Ptr graph = BaseGraph::getInstance();
...
graph->addVertex(rootVertex);
...

PathConstructor::Ptr pathConstructor(new PathConstructor());
boost::function1<bool, graph_analysis::Edge::Ptr> skipper = boost::bind(&PathConstructor::invalidTransition, pathConstructor,_1);
DFS dfs(graph, pathConstructor, skipper);
dfs.run(rootVertex);

Member Typedef Documentation

◆ Ptr

Member Function Documentation

◆ backEdge()

virtual void graph_analysis::algorithms::DFSVisitor::backEdge ( Edge::Ptr &  edge)
inlinevirtual

Called when an edge in the opposite direction has already been encountered

Reimplemented from graph_analysis::algorithms::Visitor.

◆ discoverVertex()

virtual void graph_analysis::algorithms::DFSVisitor::discoverVertex ( Vertex::Ptr &  vertex)
inlinevirtual

Invoked when a vertex is encoutered for the first time

Reimplemented from graph_analysis::algorithms::Visitor.

◆ examineEdge()

virtual void graph_analysis::algorithms::DFSVisitor::examineEdge ( Edge::Ptr &  edge)
inlinevirtual

Called when examining an edge - after it has been checked whether to skip the edge or not

Reimplemented from graph_analysis::algorithms::Visitor.

◆ finishVertex()

virtual void graph_analysis::algorithms::DFSVisitor::finishVertex ( Vertex::Ptr &  vertex)
inlinevirtual

Called when a vertex has been completely processed

Reimplemented from graph_analysis::algorithms::Visitor.

◆ forwardOrCrossEdge()

virtual void graph_analysis::algorithms::DFSVisitor::forwardOrCrossEdge ( Edge::Ptr &  edge)
inlinevirtual

Called when an edge has been encountered that leads to an already visited node

Reimplemented from graph_analysis::algorithms::Visitor.

◆ initializeVertex()

virtual void graph_analysis::algorithms::DFSVisitor::initializeVertex ( Vertex::Ptr &  vertex)
inlinevirtual

Called when the vertex is initialized

Reimplemented from graph_analysis::algorithms::Visitor.

◆ leafVertex()

virtual void graph_analysis::algorithms::DFSVisitor::leafVertex ( Vertex::Ptr &  vertex)
inlinevirtual

Called when a leaf vertex - so no outgoing edges - is discovered

Reimplemented from graph_analysis::algorithms::Visitor.

◆ treeEdge()

virtual void graph_analysis::algorithms::DFSVisitor::treeEdge ( Edge::Ptr &  edge)
inlinevirtual

Called when an edge leads to a previously unknown vertex

Reimplemented from graph_analysis::algorithms::Visitor.


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