All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CommuteTimeDistance.h
Go to the documentation of this file.
1 /*
2  * CommuteTimeDistance.h
3  *
4  * Created on: 12.04.2016
5  * Author: ebergamini
6  */
7 
8 #ifndef COMMUTETIMEDIST_H_
9 #define COMMUTETIMEDIST_H_
10 
11 #include "../algebraic/CSRMatrix.h"
12 #include "../numerics/LAMG/Lamg.h"
13 #include "../graph/Graph.h"
14 #include "../base/Algorithm.h"
15 
16 
17 namespace NetworKit {
18 
26 
27 public:
33  CommuteTimeDistance(const Graph& G, double tol = 0.1);
34 
38  virtual ~CommuteTimeDistance() = default;
39 
40 
44  virtual void run();
48  void runApproximation();
49 
57  uint64_t getSetupTime() const;
62  double distance(node u, node v);
68  double runSinglePair(node u, node v);
69 
75  double runSingleSource(node u);
76 
77 protected:
78  const Graph& G;
79  double tol;
81  uint64_t setupTime;
82  std::vector<std::vector<double>> distances;
83  std::vector<Vector> solutions;
84  bool hasRun = false;
85  bool exactly;
87 };
88 
89 } /* namespace NetworKit */
90 
91 
92 #endif /* COMMUTETIMEDIST_H_ */
bool exactly
Definition: CommuteTimeDistance.h:85
virtual void run()
Computes ECTD exactly.
Definition: CommuteTimeDistance.cpp:37
uint64_t getSetupTime() const
Definition: CommuteTimeDistance.cpp:71
uint64_t setupTime
Definition: CommuteTimeDistance.h:81
double distance(node u, node v)
Returns the commute time distance between node u and node v.
Definition: CommuteTimeDistance.cpp:155
void runApproximation()
Computes approximation by projection.
Definition: CommuteTimeDistance.cpp:75
count k
Definition: CommuteTimeDistance.h:86
double tol
Definition: CommuteTimeDistance.h:79
std::vector< std::vector< double > > distances
Definition: CommuteTimeDistance.h:82
double runSingleSource(node u)
Returns the the sum of the distances from node u.
Definition: CommuteTimeDistance.cpp:199
const Graph & G
Definition: CommuteTimeDistance.h:78
virtual ~CommuteTimeDistance()=default
Destructor.
uint64_t count
Definition: Globals.h:21
index node
Definition: Globals.h:23
bool hasRun
Definition: CommuteTimeDistance.h:84
Lamg< CSRMatrix > lamg
Definition: CommuteTimeDistance.h:80
std::vector< Vector > solutions
Definition: CommuteTimeDistance.h:83
double runSinglePair(node u, node v)
Returns the commute time distance between node u and node v.
Definition: CommuteTimeDistance.cpp:180
Represents the interface to the Lean Algebraic Multigrid (LAMG) graph Laplacian linear solver by Oren...
Definition: Lamg.h:30
Definition: Algorithm.h:9
A graph (with optional weights) and parallel iterator methods.
Definition: Graph.h:79
void runParallelApproximation()
Computes approximation by projection, in parallel.
Definition: CommuteTimeDistance.cpp:115
CommuteTimeDistance edge centrality.
Definition: CommuteTimeDistance.h:25
CommuteTimeDistance(const Graph &G, double tol=0.1)
Constructs the CommuteTimeDistance class for the given Graph G.
Definition: CommuteTimeDistance.cpp:21