-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEdge.h
33 lines (25 loc) · 845 Bytes
/
Edge.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
#ifndef EDGE_H_INCLUDED
#define EDGE_H_INCLUDED
#include <cstdint>
#include <cstddef>
//residual edges have negative cost
class Edge {
public:
//empty (invalid) initialization
Edge () : node0 (0), node1 (0) {};
//edges are initialized with a flow of zero
Edge (size_t node0, size_t node1, intmax_t cost, intmax_t capacity, bool isResidual = false);
//returns true when flow change is possible
bool changeFlowPossible (intmax_t value);
//returns true when flow change was successful
bool changeFlow (intmax_t value);
//toggles cost betweeen itself and 0
void toggleCost ();
//turn edge into residual edge and vice versa
void invert ();
//private:
size_t node0, node1;
intmax_t cost, capacity, flow, toggledCost;
bool isResidual, isToggled = false;
};
#endif // EDGE_H_INCLUDED