GroupCloseness.h
Go to the documentation of this file.
1 /*
2  * GroupCloseness.h
3  *
4  * Created on: 03.10.2016
5  * Author: elisabetta bergamini
6  */
7
8 #ifndef GROUPCLOSENESS_H_
9 #define GROUPCLOSENESS_H_
10 #include "../graph/Graph.h"
11 #include "../base/Algorithm.h"
12 #include "../auxiliary/PrioQueueForInts.h"
13
14 namespace NetworKit {
15
19 class GroupCloseness : public Algorithm {
20 public:
33  GroupCloseness(const Graph& G, count k = 1, count H=0);
34
38  void run();
39
43  std::vector<node> groupMaxCloseness();
44
48  double computeFarness(std::vector<node> S, count H = std::numeric_limits<count>::max());
49
50
51 protected:
53  std::vector<count> newDistances(node u, count n, Graph& G, count h);
55  count k = 1;
56  std::vector<count> D;
59  std::vector<count> d;
60  std::vector<count> d1;
61  std::vector<node> S;
62  count H = 0;
63 };
64
65
66
67 inline std::vector<node> GroupCloseness::groupMaxCloseness() {
68  if (!hasRun) throw std::runtime_error("Call run method first");
69  return S;
70 }
71
72 } /* namespace NetworKit */
73 #endif /* GROUPCLOSENESS_H_ */
std::vector< node > groupMaxCloseness()
Returns group with maximum closeness.
Definition: GroupCloseness.h:67
std::vector< node > S
Definition: GroupCloseness.h:61
std::vector< count > d
Definition: GroupCloseness.h:59
count maxD
Definition: GroupCloseness.h:58
void run()
Computes the group with maximum closeness on the graph passed in the constructor. ...
Definition: GroupCloseness.cpp:92
Graph G
Definition: GroupCloseness.h:54
GroupCloseness(const Graph &G, count k=1, count H=0)
Finds the group of nodes with highest (group) closeness centrality.
Definition: GroupCloseness.cpp:26
count k
Definition: GroupCloseness.h:55
bool hasRun
A boolean variable indicating whether an algorithm has finished its computation or not...
Definition: Algorithm.h:14
count iters
Definition: GroupCloseness.h:57
std::vector< count > newDistances(node u, count n, Graph &G, count h)
Definition: GroupCloseness.cpp:58
uint64_t count
Definition: Globals.h:21
double computeFarness(std::vector< node > S, count H=std::numeric_limits< count >::max())
Computes farness (i.e., inverse of the closeness) for a given group (stopping after H iterations if H...
Definition: GroupCloseness.cpp:220
index node
Definition: Globals.h:23
Definition: GroupCloseness.h:19
std::vector< count > D
Definition: GroupCloseness.h:56
edgeweight computeImprovement(node u, count n, Graph &G, count h)
Definition: GroupCloseness.cpp:30
count H
Definition: GroupCloseness.h:62
Definition: Algorithm.h:9
A graph (with optional weights) and parallel iterator methods.
Definition: Graph.h:79
std::vector< count > d1
Definition: GroupCloseness.h:60
double edgeweight
Definition: Globals.h:24