-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.hpp
52 lines (45 loc) · 1.26 KB
/
common.hpp
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
#ifndef COMMON_HPP
#define COMMON_HPP
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <chrono>
#include <sys/stat.h>
#include <gflags/gflags.h>
#include <glog/logging.h>
DECLARE_int32(p);
DECLARE_int32(k);
DECLARE_string(filename);
DECLARE_string(filetype);
DECLARE_string(method);
DECLARE_string(write);
DECLARE_double(hdf);
DECLARE_double(lambda);
DECLARE_bool(write_low_degree_edgelist);
DECLARE_bool(extended_metrics);
DECLARE_bool(hybrid_NE);
using vid_t = uint32_t;
using eid_t = uint64_t;
using bid_t = uint8_t;
const vid_t kInvalidVid = std::numeric_limits<vid_t>::max();
const bid_t kInvalidBid = std::numeric_limits<bid_t>::max();
const vid_t offset = (vid_t)1 << 31;
struct edge_t {
vid_t first, second;
edge_t() : first(0), second(0) {}
edge_t(vid_t first, vid_t second) : first(first), second(second) {}
// const bool valid() { return first != INVALID_VID; }
// void remove() { first = INVALID_VID; }
bool valid() const { return first < offset; }
void remove() { first += offset; }
void recover() {
if (first >= offset) {
first -= offset;
}
}
bool operator == (const edge_t & rhs) const {
return first == rhs.first && second == rhs.second;
}
};
#endif