-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGraph.h
67 lines (54 loc) · 2.76 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
#ifndef _GRAPH_H_
#define _GRAPH_H_
#include "Utility.h"
#include "Timer.h"
#include "LinearHeap.h"
class Graph {
private:
std::string dir; //input graph directory
ui n; //number of nodes of the graph
ept m; //number of edges of the graph
ui K; //the value of k in k-plex
ept *pstart; //offset of neighbors of nodes
ept *pend; //used in search
ept *pend_buf;
ui *edges; //adjacent ids of edges
std::vector<ui> kplex;
ui *s_degree;
ept *s_pstart;
ept *s_pend;
ui *s_edges;
ui *s_peel_sequence;
ui *s_core;
char *s_vis;
ListLinearHeap *s_heap;
ui *s_edgelist_pointer;
ui *s_tri_cnt;
ui *s_edge_list;
ui *s_active_edgelist;
char *s_deleted;
public:
Graph(const char *_dir, const int _K) ;
~Graph() ;
void read_graph_binary() ;
void read_graph() ;
void output_one_kplex() ;
void verify_kplex() ;
void kPlex_exact() ;
private:
void write_subgraph(ui n, const std::vector<std::pair<int,int> > &edge_list) ;
void heuristic_kplex_max_degree(ui processed_threshold) ;
void extract_subgraph(ui u, ui *ids, ui &ids_n, ui *rid, std::vector<std::pair<int,int> > &vp, char *exists, ept *pstart, ept *pend, ui *edges, char *deleted, ui *edgelist_pointer) ;
void extract_subgraph_and_prune(ui u, ui *ids, ui &ids_n, ui *rid, std::vector<std::pair<int,int> > &vp, ui *Q, ui* degree, char *exists, ept *pend, char *deleted, ui *edgelist_pointer) ;
void extract_subgraph_full(const ui *ids, ui ids_n, ui *rid, std::vector<std::pair<int,int> > &vp, char *exists, ept *pstart, ept *pend, ui *edges, char *deleted, ui *edgelist_pointer) ;
ui degen(ui n, ui *peel_sequence, ui *core, ept *pstart, ui *edges, ui *degree, char *vis, ListLinearHeap *heap, bool output) ;
void shrink_graph(ui &n, ept &m, ui *peel_sequence, ui *core, ui *out_mapping, ui *in_mapping, ui *rid, ept *pstart, ui *edges, bool output) ;
void oriented_triangle_counting(ui n, ui m, ui *peel_sequence, ept *pstart, ept *pend, ui *edges, ui *tri_cnt, ui *adj) ;
void reorganize_oriented_graph(ui n, ui *tri_cnt, ui *edge_list, ept *pstart, ept *pend, ept *pend2, ui *edges, ui *edgelist_pointer, ui *buf) ;
ept peeling(ui critical_vertex, ListLinearHeap *linear_heap, ui *Qv, ui &Qv_n, ui d_threshold, ui *Qe, bool initialize_Qe, ui t_threshold, ui *tri_cnt, ui *active_edgelist, ui &active_edgelist_n, ui *edge_list, ui *edgelist_pointer, char *deleted, ui *degree, ept *pstart, ept *pend, ui *edges, char *exists) ;
char find(ui u, ui w, ept &b, ept e, char *deleted, ept &idx, ui *edgelist_pointer, ui *edges) ;
// functions for subgraph processing
void load_graph_from_edgelist(ui _n, const std::vector<std::pair<int,int> > &edge_list, ui &n, ept &m, ui *degree, ept *pstart, ui *edges) ;
void subgraph_prune(ui *ids, ui &_n, std::vector<std::pair<int,int> > &edge_list, ui *rid, ui *Qv, ui *Qe, char *exists) ;
};
#endif