Level.h
Go to the documentation of this file.
1 /*
2  * Level.h
3  *
4  * Created on: 09.01.2015
5  * Author: Michael
6  */
7
8 #ifndef LEVEL_H_
9 #define LEVEL_H_
10
11 #include "../../../algebraic/CSRMatrix.h"
12
13 namespace NetworKit {
14
15 enum LevelType {FINEST, // original problem
16  ELIMINATION, // lowdegree node elimination
17  AGGREGATION, // aggregation of nodes with high affinity
18  COARSEST // coarsest level
19 };
20
25 template<class Matrix>
26 class Level {
27 protected:
30
31 public:
32  Level(LevelType type) : type(type) {}
33  Level(LevelType type, const Matrix& A) : type(type), A(A) {}
34  virtual ~Level() {}
35
36  inline const Matrix& getLaplacian() const {
37  return A;
38  }
39
40  inline count getNumberOfNodes() const {
41  return A.numberOfRows();
42  }
43
44  virtual void coarseType(const Vector& /*xf*/, Vector& /*xc*/) const {}
45
46  virtual void restrict(const Vector& /*bf*/, Vector& /*bc*/) const {}
47
48  virtual void restrict(const Vector& /*bf*/, Vector& /*bc*/, std::vector<Vector>& /*bStages*/) const {}
49
50  virtual void interpolate(const Vector& /*xc*/, Vector& /*xf*/) const {}
51
52  virtual void interpolate(const Vector& /*xc*/, Vector& /*xf*/, const std::vector<Vector>& /*bStages*/) const {}
53 };
54
55
56
57 } /* namespace NetworKit */
58
59 #endif /* LEVEL_H_ */
const Matrix & getLaplacian() const
Definition: Level.h:36
Matrix A
Definition: Level.h:29
virtual void interpolate(const Vector &, Vector &) const
Definition: Level.h:50
Definition: Level.h:15
LevelType type
Definition: Level.h:28
virtual ~Level()
Definition: Level.h:34
virtual void coarseType(const Vector &, Vector &) const
Definition: Level.h:44
virtual void restrict(const Vector &, Vector &, std::vector< Vector > &) const
Definition: Level.h:48
virtual void interpolate(const Vector &, Vector &, const std::vector< Vector > &) const
Definition: Level.h:52
Definition: Level.h:18
Definition: Level.h:16
uint64_t count
Definition: Globals.h:21
std::vector< std::vector< count > > Matrix
Definition: DynamicNMIDistance.h:16
LevelType
Definition: Level.h:15
count getNumberOfNodes() const
Definition: Level.h:40
Level(LevelType type, const Matrix &A)
Definition: Level.h:33
The Vector class represents a basic vector with double coefficients.
Definition: Vector.h:25
virtual void restrict(const Vector &, Vector &) const
Definition: Level.h:46
Abstract base class for an LAMG Level.
Definition: Level.h:26
Definition: Level.h:17
Level(LevelType type)
Definition: Level.h:32