votca
2024.2-dev
Loading...
Searching...
No Matches
tools
include
votca
tools
graphvisitor.h
Go to the documentation of this file.
1
/*
2
* Copyright 2009-2020 The VOTCA Development Team
3
* (http://www.votca.org)
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License")
6
*
7
* You may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*
18
*/
19
20
#ifndef VOTCA_TOOLS_GRAPHVISITOR_H
21
#define VOTCA_TOOLS_GRAPHVISITOR_H
22
23
// Standard includes
24
#include <set>
25
#include <vector>
26
27
// Local VOTCA includes
28
#include "
edge.h
"
29
#include "
graphnode.h
"
30
47
namespace
votca
{
48
namespace
tools {
49
50
class
Graph;
51
52
class
GraphVisitor
{
53
protected
:
55
std::set<Index>
explored_
;
56
58
Index
startingVertex_
= 0;
59
61
virtual
void
addEdges_
(
const
Graph
& graph,
Index
vertex) = 0;
62
virtual
Edge
getEdge_
() = 0;
64
public
:
65
virtual
void
exploreNode
(std::pair<Index, GraphNode>& vertex_and_node,
66
Graph
& graph,
Edge
edge =
DUMMY_EDGE
);
67
68
GraphVisitor
() =
default
;
69
71
std::vector<Index>
getUnexploredVertex
(
const
Edge
edge)
const
;
72
76
virtual
bool
queEmpty
()
const
;
77
78
void
setStartingVertex
(
Index
vertex) {
startingVertex_
= vertex; }
79
Index
getStartingVertex
()
const
{
return
startingVertex_
; }
80
82
void
initialize
(
Graph
& graph);
83
87
virtual
void
exec
(
Graph
& graph,
Edge
edge);
88
92
Edge
nextEdge
(
Graph
graph);
93
95
std::set<Index>
getExploredVertices
()
const
;
96
98
bool
vertexExplored
(
const
Index
vertex)
const
;
99
};
100
}
// namespace tools
101
}
// namespace votca
102
103
#endif
// VOTCA_TOOLS_GRAPHVISITOR_H
votca::tools::Edge
Connects to vertices.
Definition
edge.h:42
votca::tools::GraphVisitor
Definition
graphvisitor.h:52
votca::tools::GraphVisitor::exec
virtual void exec(Graph &graph, Edge edge)
Definition
graphvisitor.cc:67
votca::tools::GraphVisitor::getUnexploredVertex
std::vector< Index > getUnexploredVertex(const Edge edge) const
Determine which vertices in the edge, if any, have not been explored.
Definition
graphvisitor.cc:44
votca::tools::GraphVisitor::getExploredVertices
std::set< Index > getExploredVertices() const
Get the set of all the vertices that have been explored.
Definition
graphvisitor.cc:101
votca::tools::GraphVisitor::getEdge_
virtual Edge getEdge_()=0
votca::tools::GraphVisitor::startingVertex_
Index startingVertex_
The vertex the visitor started on.
Definition
graphvisitor.h:58
votca::tools::GraphVisitor::GraphVisitor
GraphVisitor()=default
votca::tools::GraphVisitor::queEmpty
virtual bool queEmpty() const
Definition
graphvisitor.cc:37
votca::tools::GraphVisitor::addEdges_
virtual void addEdges_(const Graph &graph, Index vertex)=0
What is done to an individual graph node as it is explored.
votca::tools::GraphVisitor::exploreNode
virtual void exploreNode(std::pair< Index, GraphNode > &vertex_and_node, Graph &graph, Edge edge=DUMMY_EDGE)
Edge(0,0) is a dummy value.
Definition
graphvisitor.cc:39
votca::tools::GraphVisitor::setStartingVertex
void setStartingVertex(Index vertex)
Definition
graphvisitor.h:78
votca::tools::GraphVisitor::getStartingVertex
Index getStartingVertex() const
Definition
graphvisitor.h:79
votca::tools::GraphVisitor::nextEdge
Edge nextEdge(Graph graph)
Definition
graphvisitor.cc:87
votca::tools::GraphVisitor::explored_
std::set< Index > explored_
set containing all the vertix ids that have been explored
Definition
graphvisitor.h:55
votca::tools::GraphVisitor::initialize
void initialize(Graph &graph)
Initialize the graphvisitor the default starting point is 0.
Definition
graphvisitor.cc:59
votca::tools::GraphVisitor::vertexExplored
bool vertexExplored(const Index vertex) const
Has the vertex been explored.
Definition
graphvisitor.cc:55
votca::tools::Graph
Definition
graph.h:43
edge.h
graphnode.h
votca::tools::DUMMY_EDGE
const Edge DUMMY_EDGE(std::numeric_limits< Index >::max(), std::numeric_limits< Index >::max())
votca
base class for all analysis tools
Definition
basebead.h:33
votca::Index
Eigen::Index Index
Definition
types.h:26
Generated by
1.12.0