-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocality.c
More file actions
34 lines (28 loc) · 706 Bytes
/
locality.c
File metadata and controls
34 lines (28 loc) · 706 Bytes
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
34
#include "graph.h"
/* Computes the locality of a BADJ graph. */
int main(int argc, char *argv[])
{
// Check arguments
if (argc < 3)
{
fprintf(stderr, "Usage: ./locality [BADJ file] [window]\n");
return 1;
}
// Initialize graph
graph g;
if (initialize(&g, argv[1], 0))
{
return 1;
}
// Print numbers of nodes and edges
fprintf(stderr, "Nodes: %llu\n", g.n);
fprintf(stderr, "Edges: %llu\n\n", g.m);
// Compute locality
unsigned int window = (unsigned int) atoi(argv[2]);
double loc;
locality(&g, window, &loc);
fprintf(stderr, "Locality: %e\n", loc);
// Destroy graph
destroy(&g);
return 0;
}