-
Notifications
You must be signed in to change notification settings - Fork 1
/
compute_scores.h
33 lines (28 loc) · 987 Bytes
/
compute_scores.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Given a local edit graph (nodes are pages, edges are page
similarities), compute its CC, controversy, and clustering
scores. */
#include "stdio.h"
struct node_info {
double controversy;
double edits;
int real_id;
double numerator;
double denominator;
};
struct dense_graph {
int num_nodes;
double *edges;
struct node_info *nodes;
};
void set_node(struct dense_graph graph, int node_number,
double controversy, double edits, int real_id);
void set_edge(struct dense_graph graph,
int first_node, int second_node,
double weight);
struct dense_graph make_graph(int num_nodes);
void free_graph(struct dense_graph graph);
/* Compute the CC, average controversy, and average clustering scores
for the graph. Returns the CC score, and writes the page-level scores
(controversy and clustering) to coeff_out. */
double coeff(struct dense_graph graph, FILE* coeff_out,
double* avg_cont, double* avg_clust);