All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LocalSimilarityScore.h
Go to the documentation of this file.
1 /*
2  * LocalSimilarityScore.h
3  *
4  * Created on: 26.07.2014
5  * Author: Gerd Lindner
6  */
7 
8 #ifndef LOCALSIMSCORE_H_
9 #define LOCALSIMSCORE_H_
10 
11 #include "../edgescores/EdgeScore.h"
12 
13 namespace NetworKit {
14 
15 template<typename T>
16 struct AttributizedEdge {
19  edgeid eid;
20  T value;
21 
23  ego(ego), alter(alter), eid(eid), value(v) {
24  }
25 
26  bool operator<(const AttributizedEdge<T>& other) const {
27  return (value > other.value)
28  || (value == other.value && alter < other.alter);
29  }
30 
31  bool operator>(const AttributizedEdge<T>& other) const {
32  return (value < other.value)
33  || (value == other.value && alter > other.alter);
34  }
35 
36  bool operator==(const AttributizedEdge<T>& other) const {
37  return ego == other.ego && alter == other.alter
38  && value == other.value;
39  }
40 };
41 
42 struct greater {
43  template<class T>
44  bool operator()(T const &a, T const &b) const { return a > b; }
45 };
46 
50 class LocalSimilarityScore : public EdgeScore<double> {
51 
52 public:
53 
54  LocalSimilarityScore(const Graph& G, const std::vector<count>& triangles);
55  virtual double score(edgeid eid) override;
56  virtual double score(node u, node v) override;
57  virtual void run() override;
58 
59 private:
60  const std::vector<count>& triangles;
61 };
62 
63 }
64 /* namespace NetworKit */
65 
66 #endif /* LOCALSIMSCORE_H_ */
bool operator==(const AttributizedEdge< T > &other) const
Definition: LocalSimilarityScore.h:36
index edgeid
Definition: Globals.h:25
virtual void run() override
Compute the edge score.
Definition: LocalSimilarityScore.cpp:17
const Graph & G
Definition: EdgeScore.h:43
bool operator()(T const &a, T const &b) const
Definition: LocalSimilarityScore.h:44
LocalSimilarityScore(const Graph &G, const std::vector< count > &triangles)
Definition: LocalSimilarityScore.cpp:14
T value
Definition: LocalDegreeScore.cpp:16
node ego
Definition: LocalSimilarityScore.h:17
node alter
Definition: LocalSimilarityScore.h:18
Definition: LocalDegreeScore.cpp:14
index node
Definition: Globals.h:23
AttributizedEdge(node ego, node alter, edgeid eid, T v)
Definition: LocalSimilarityScore.h:22
edgeid eid
Definition: LocalDegreeScore.cpp:15
Implementation of the Local Sparsification Algorithm by Sataluri et al.
Definition: LocalSimilarityScore.h:50
virtual double score(edgeid eid) override
Get the edge score of the edge with the given edge id.
Definition: LocalSimilarityScore.cpp:72
A graph (with optional weights) and parallel iterator methods.
Definition: Graph.h:79
bool operator>(const AttributizedEdge< T > &other) const
Definition: LocalSimilarityScore.h:31
Definition: LocalSimilarityScore.h:42
Abstract base class for an edge score.
Definition: EdgeScore.h:20