All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LinkPredictor.h
Go to the documentation of this file.
1 /*
2  * LinkPredictor.h
3  *
4  * Created on: 28.02.2015
5  * Author: Kolja Esders (kolja.esders@student.kit.edu)
6  */
7 
8 #ifndef LINKPREDICTOR_H_
9 #define LINKPREDICTOR_H_
10 
11 #include <memory>
12 
13 #include "../graph/Graph.h"
14 
15 namespace NetworKit {
16 
23 public:
24  // Declare typedef in advance for use in the protected section
25  typedef std::pair<std::pair<node, node>, double> prediction;
26 
27 private:
35  virtual double runImpl(node u, node v) = 0;
36 
37 protected:
38  const Graph* G;
39 
40  bool validCache;
41 
42 public:
43  LinkPredictor();
44 
49  explicit LinkPredictor(const Graph& G);
50 
54  virtual ~LinkPredictor() = default;
55 
60  virtual void setGraph(const Graph& newGraph);
61 
73  virtual double run(node u, node v);
74 
84  virtual std::vector<prediction> runOn(std::vector<std::pair<node, node>> nodePairs);
85 
92  virtual std::vector<prediction> runAll();
93 
94 };
95 
96 } // namespace NetworKit
97 
98 #endif /* LINKPREDICTOR_H_ */
index node
Definition: Globals.h:23
A graph (with optional weights) and parallel iterator methods.
Definition: Graph.h:79