votca 2024.2-dev
Loading...
Searching...
No Matches
reducedgraph.h
Go to the documentation of this file.
1/*
2 * E
3 * Copyright 2009-2020 The VOTCA Development Team
4 * (http://www.votca.org)
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License")
7 *
8 * You may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 */
20
21#ifndef VOTCA_TOOLS_REDUCEDGRAPH_H
22#define VOTCA_TOOLS_REDUCEDGRAPH_H
23
24// Local VOTCA includes
25#include "graph.h"
26#include "reducededge.h"
27
28namespace votca {
29namespace tools {
30
55class ReducedGraph : public Graph {
56 private:
73 std::unordered_map<Edge, std::vector<std::vector<Index>>> expanded_edges_;
74
75 void init_(std::vector<ReducedEdge> reduced_edges,
76 std::unordered_map<Index, GraphNode> nodes);
77
78 // Junctions must be stored internally
79 std::set<Index> junctions_;
80
81 public:
82 ReducedGraph() = default;
83
84 ReducedGraph(std::vector<ReducedEdge> reduced_edges);
85 ReducedGraph(std::vector<ReducedEdge> reduced_edges,
86 std::unordered_map<Index, GraphNode> nodes);
87
110 std::vector<std::vector<Edge>> expandEdge(const Edge& edge) const;
111
113 Graph expandGraph() const;
114
134 // std::vector<Index> getJunctions() const;
135
136 std::vector<std::pair<Index, GraphNode>> getNodes(void) const override;
137
138 std::vector<Index> getVerticesDegree(Index degree) const override;
139
140 friend std::ostream& operator<<(std::ostream& os, const ReducedGraph graph);
141};
142
143} // namespace tools
144} // namespace votca
145#endif // VOTCA_TOOLS_REDUCEDGRAPH_H
Connects to vertices.
Definition edge.h:42
Contains a graph that consits of vertices with degree of 1 or greater than 3.
Graph expandGraph() const
This method will return a copy of the full graph.
friend std::ostream & operator<<(std::ostream &os, const ReducedGraph graph)
std::vector< std::vector< Edge > > expandEdge(const Edge &edge) const
Allows one to return all edges connecting two vertices of the reduced graph.
void init_(std::vector< ReducedEdge > reduced_edges, std::unordered_map< Index, GraphNode > nodes)
std::set< Index > junctions_
std::unordered_map< Edge, std::vector< std::vector< Index > > > expanded_edges_
std::vector< std::pair< Index, GraphNode > > getNodes(void) const override
Gets the junctions in the graph.
std::vector< Index > getVerticesDegree(Index degree) const override
Returns all the vertices with degree specified by degree
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26