-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgraph64.hpp
More file actions
71 lines (57 loc) · 1.33 KB
/
Copy pathgraph64.hpp
File metadata and controls
71 lines (57 loc) · 1.33 KB
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
#ifndef GRAPH64_HPP
#define GRAPH64_HPP
#include <iostream>
using std::cout; using std::cerr; using std::endl;
#include <stdexcept>
using std::domain_error;
#include <vector>
using std::vector;
#include <string>
using std::string;
extern "C" {
#include <cstdio>
}
typedef unsigned long long uint64;
typedef uint64 graph64;
typedef uint64 edge;
typedef unsigned long vertex;
typedef short edgetype;
const edgetype NOEDGE_UV = 0;
const edgetype DIR_U_T_V = 1;
const edgetype DIR_V_T_U = 2;
const edgetype UNDIR_U_V = 3;
const short INDEG = 0;
const short OUDEG = 1;
const vertex NILLVERTEX = 0xFFFFFFFFUL;
inline edge new_edge(vertex u, vertex v)
{
return uint64(u) << 32 | uint64(v);
}
inline edge edge_code(vertex u, vertex v)
{
if (u < v) {
return uint64(u) << 32 | uint64(v);
} else {
return uint64(v) << 32 | uint64(u);
}
}
inline vertex edge_get_u(edge e)
{
return vertex(e >> 32);
}
inline vertex edge_get_v(edge e)
{
return vertex(e & 0xFFFFFFFFULL);
}
inline edgetype reverse(edgetype et)
{
return (et >> 1) | ((et << 1) & 2);
}
void adj(graph64 g);
inline void DEL(graph64 &g, long row, long col) {
(g &= ~(1ULL << (63-(row*8+col))));
}
inline void SET(graph64 &g, long row, long col) {
(g |= (1ULL << (63-(row*8+col))));
}
#endif