votca 2024.2-dev
Loading...
Searching...
No Matches
votca::tools::GraphVisitor Class Referenceabstract

#include <graphvisitor.h>

Inheritance diagram for votca::tools::GraphVisitor:
Collaboration diagram for votca::tools::GraphVisitor:

Public Member Functions

virtual void exploreNode (std::pair< Index, GraphNode > &vertex_and_node, Graph &graph, Edge edge=DUMMY_EDGE)
 Edge(0,0) is a dummy value.
 
 GraphVisitor ()=default
 
std::vector< IndexgetUnexploredVertex (const Edge edge) const
 Determine which vertices in the edge, if any, have not been explored.
 
virtual bool queEmpty () const
 
void setStartingVertex (Index vertex)
 
Index getStartingVertex () const
 
void initialize (Graph &graph)
 Initialize the graphvisitor the default starting point is 0.
 
virtual void exec (Graph &graph, Edge edge)
 
Edge nextEdge (Graph graph)
 
std::set< IndexgetExploredVertices () const
 Get the set of all the vertices that have been explored.
 
bool vertexExplored (const Index vertex) const
 Has the vertex been explored.
 

Protected Member Functions

virtual void addEdges_ (const Graph &graph, Index vertex)=0
 What is done to an individual graph node as it is explored.
 
virtual Edge getEdge_ ()=0
 

Protected Attributes

std::set< Indexexplored_
 set containing all the vertix ids that have been explored
 
Index startingVertex_ = 0
 The vertex the visitor started on.
 

Detailed Description

Definition at line 52 of file graphvisitor.h.

Constructor & Destructor Documentation

◆ GraphVisitor()

votca::tools::GraphVisitor::GraphVisitor ( )
default

Member Function Documentation

◆ addEdges_()

virtual void votca::tools::GraphVisitor::addEdges_ ( const Graph & graph,
Index vertex )
protectedpure virtual

What is done to an individual graph node as it is explored.

Implemented in votca::tools::Graph_BF_Visitor, and votca::tools::Graph_DF_Visitor.

◆ exec()

void votca::tools::GraphVisitor::exec ( Graph & graph,
Edge edge )
virtual

What the visitor does to each node as it is visited, it will simply add the vertex that was explored to the list of explored vertices in its current form.

Definition at line 67 of file graphvisitor.cc.

◆ exploreNode()

void votca::tools::GraphVisitor::exploreNode ( std::pair< Index, GraphNode > & vertex_and_node,
Graph & graph,
Edge edge = DUMMY_EDGE )
virtual

Edge(0,0) is a dummy value.

Reimplemented in votca::tools::GraphDistVisitor.

Definition at line 39 of file graphvisitor.cc.

◆ getEdge_()

virtual Edge votca::tools::GraphVisitor::getEdge_ ( )
protectedpure virtual

◆ getExploredVertices()

set< Index > votca::tools::GraphVisitor::getExploredVertices ( ) const

Get the set of all the vertices that have been explored.

Definition at line 101 of file graphvisitor.cc.

◆ getStartingVertex()

Index votca::tools::GraphVisitor::getStartingVertex ( ) const
inline

Definition at line 79 of file graphvisitor.h.

◆ getUnexploredVertex()

vector< Index > votca::tools::GraphVisitor::getUnexploredVertex ( const Edge edge) const

Determine which vertices in the edge, if any, have not been explored.

Definition at line 44 of file graphvisitor.cc.

◆ initialize()

void votca::tools::GraphVisitor::initialize ( Graph & graph)

Initialize the graphvisitor the default starting point is 0.

Definition at line 59 of file graphvisitor.cc.

◆ nextEdge()

Edge votca::tools::GraphVisitor::nextEdge ( Graph graph)

The next edge to be explored, note that when this function is called it removes the edge from the visitors queue and will no longer be accessible with a second call to nextEdge

Definition at line 87 of file graphvisitor.cc.

◆ queEmpty()

bool votca::tools::GraphVisitor::queEmpty ( ) const
virtual

Determine if the exploration is complete, this is determined by whether the edge queue is empty or not, it does not necessarily mean all vertices in a graph have been explored.

Reimplemented in votca::tools::Graph_BF_Visitor, and votca::tools::Graph_DF_Visitor.

Definition at line 37 of file graphvisitor.cc.

◆ setStartingVertex()

void votca::tools::GraphVisitor::setStartingVertex ( Index vertex)
inline

Definition at line 78 of file graphvisitor.h.

◆ vertexExplored()

bool votca::tools::GraphVisitor::vertexExplored ( const Index vertex) const

Has the vertex been explored.

Definition at line 55 of file graphvisitor.cc.

Member Data Documentation

◆ explored_

std::set<Index> votca::tools::GraphVisitor::explored_
protected

set containing all the vertix ids that have been explored

Definition at line 55 of file graphvisitor.h.

◆ startingVertex_

Index votca::tools::GraphVisitor::startingVertex_ = 0
protected

The vertex the visitor started on.

Definition at line 58 of file graphvisitor.h.


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