All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PredictionsSorter.h
Go to the documentation of this file.
1 /*
2  * PredictionsSorter.h
3  *
4  * Created on: 26.04.2015
5  * Author: Kolja Esders (kolja.esders@student.kit.edu)
6  */
7 
8 #ifndef PREDICTIONSSORTER_H_
9 #define PREDICTIONSSORTER_H_
10 
11 #include "LinkPredictor.h"
12 
13 namespace NetworKit {
14 
21 private:
26  struct ScoreComp {
27  bool operator()(const LinkPredictor::prediction& a, const LinkPredictor::prediction& b) const {
28  return (a.second > b.second) || (a.second == b.second && a.first < b.first);
29  }
30  } static ConcreteScoreComp;
31 
35  struct NodePairComp {
36  bool operator()(const LinkPredictor::prediction& a, const LinkPredictor::prediction& b) const {
37  return a.first < b.first;
38  }
39  } static ConcreteNodePairComp;
40 
41 public:
48  static void sortByScore(std::vector<LinkPredictor::prediction>& predictions);
49 
55  static void sortByNodePair(std::vector<LinkPredictor::prediction>& predictions);
56 
57 };
58 
59 } // namespace NetworKit
60 
61 #endif /* PREDICTIONSSORTER_H_ */
static void sortByScore(std::vector< LinkPredictor::prediction > &predictions)
Sorts the predictions descendingly by score.
Definition: PredictionsSorter.cpp:13
Allows the sorting of predictions by score or node-pair.
Definition: PredictionsSorter.h:20
static void sortByNodePair(std::vector< LinkPredictor::prediction > &predictions)
Sorts the predictions ascendingly by node-pair.
Definition: PredictionsSorter.cpp:17