-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgraph.h
79 lines (56 loc) · 1.57 KB
/
graph.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef SCAN_QUERY_GRAPH
#define SCAN_QUERY_GRAPH
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<sstream>
#include "union_find.h"
using namespace std;
#define UNCLASSIFIED 0
#define CORE 1 //Member of cluster
#define HUB 2
//#define BALANCE 8192
/*
* For integrating PKC (to compute core values)
*/
typedef int vid_t;
typedef unsigned int eid_t;
typedef struct {
long n;
long m;
vid_t *adj;
eid_t *num_edges;
eid_t *eid;
} graph_t;
struct Graph {
uint32_t nodemax;
uint32_t edgemax;
// csr representation
uint32_t *node_off;
int *edge_dst;
// balanced offset array by splitting single vertex into multiple balanced ones
// edge property
bool *similarity;
int *common_node_num;
// vertex property
int *core_count;
int *label;
// other
vector<int> degree;
// clusters: core and non-core(hubs)
vector<int> cluster_dict; // observation 2: core vertex clusters are disjoint
// first: cluster id(min core-vertex id in cluster), second: non-core vertex id
vector<pair<int, int>> noncore_cluster; // observation 1: clusters may overlap, observation 3: non-core uniquely determined by core
string dir;
explicit Graph(char *dir_cstr);
public:
void ReadDegree();
void CheckInputGraph();
void ReadAdjacencyList();
void Output(const char *eps_s, const char *min_u, UnionFind *union_find_ptr);
void Output(const char *eps_s, const char *min_u, UnionFind *union_find_ptr, vector<int> &old_vid_dict);
};
#endif