-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedge.hpp
executable file
·55 lines (44 loc) · 987 Bytes
/
edge.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
53
54
55
#ifndef __EDGE_H
#define __EDGE_H
#include <cstdint>
#include <vector>
#include <mpi.h>
#ifdef USE_32_BIT_GRAPH
typedef int32_t GraphElem;
typedef float GraphWeight;
const MPI_Datatype MPI_GRAPH_TYPE = MPI_INT32_T;
const MPI_Datatype MPI_WEIGHT_TYPE = MPI_FLOAT;
#else
typedef int64_t GraphElem;
typedef double GraphWeight;
const MPI_Datatype MPI_GRAPH_TYPE = MPI_INT64_T;
const MPI_Datatype MPI_WEIGHT_TYPE = MPI_DOUBLE;
#endif
struct Edge {
GraphElem tail;
GraphWeight weight;
Edge();
Edge(GraphElem t, GraphWeight w):
tail(t), weight(w)
{}
};
struct EdgeTuple
{
GraphElem ij_[2];
GraphWeight w_;
EdgeTuple(GraphElem i, GraphElem j, GraphWeight w):
ij_{i, j}, w_(w)
{}
EdgeTuple(GraphElem i, GraphElem j):
ij_{i, j}, w_(1.0)
{}
EdgeTuple():
ij_{-1, -1}, w_(0.0)
{}
};
typedef std::vector<GraphElem> EdgeIndexes;
inline Edge::Edge()
: tail(-1), weight(0.0)
{
} // Edge
#endif // __EDGE_DECL_H