votca 2024-dev
Loading...
Searching...
No Matches
edgecontainer.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_EDGECONTAINER_H
21#define VOTCA_TOOLS_EDGECONTAINER_H
22
23// Standard includes
24#include <map>
25#include <set>
26#include <unordered_map>
27#include <vector>
28
29// Local VOTCA includes
30#include "edge.h"
31
32namespace votca {
33namespace tools {
34
42 protected:
44 std::unordered_map<Index, std::unordered_map<Index, Index>> adj_list_;
45
46 public:
48 EdgeContainer() = default;
49 EdgeContainer(Edge edge);
50 EdgeContainer(std::vector<Edge> edges);
51
53 Index getMaxDegree() const;
55 std::vector<Index> getVerticesDegree(Index degree) const;
57 Index getDegree(const Index vertex) const;
59 bool vertexExistWithDegree(Index degree) const;
60
62 bool edgeExist(const Edge& edge) const;
64 bool vertexExist(Index vertex) const;
66 void addEdge(Edge edge);
68 void addVertex(Index vertex);
70 std::vector<Edge> getEdges() const;
72 std::vector<Index> getVertices() const;
74 std::vector<Index> getNeighVertices(Index vertex) const;
76 std::vector<Edge> getNeighEdges(Index vertex) const;
78 friend std::ostream& operator<<(std::ostream& os,
79 const EdgeContainer edgecontainer);
80};
81} // namespace tools
82} // namespace votca
83
84#endif // VOTCA_TOOLS_EDGECONTAINER_H
EdgeContainer is responsible for operations on groups of edges.
std::vector< Index > getVerticesDegree(Index degree) const
Contains vector of all vertices with degree.
Index getDegree(const Index vertex) const
Determine the degree of the vertex/number of edges attached.
EdgeContainer()=default
Constructors can take no arguments a single Edge or a vector of edges.
std::vector< Edge > getNeighEdges(Index vertex) const
Get the edges neighboring vert.
void addEdge(Edge edge)
Add an edge to the container.
bool vertexExistWithDegree(Index degree) const
Determine if a vertex with the specified degree exists.
void addVertex(Index vertex)
Add a lone vertex.
std::unordered_map< Index, std::unordered_map< Index, Index > > adj_list_
The vertex, the neighboring vertices and the number of edges.
std::vector< Edge > getEdges() const
Get all the edges in vector form.
std::vector< Index > getVertices() const
Get all the vertices in vector form.
std::vector< Index > getNeighVertices(Index vertex) const
Get the vertices neighboring vert.
bool vertexExist(Index vertex) const
Check if the vertex exists returns true or false.
Index getMaxDegree() const
Get the value of the max degree.
bool edgeExist(const Edge &edge) const
Check if the edge exists returns true or false.
friend std::ostream & operator<<(std::ostream &os, const EdgeContainer edgecontainer)
Print output of object.
Connects to vertices.
Definition edge.h:42
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26