-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathl_edge.h
More file actions
27 lines (20 loc) · 716 Bytes
/
Copy pathl_edge.h
File metadata and controls
27 lines (20 loc) · 716 Bytes
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
#ifndef _L_EDGE_H
#define _L_EDGE_H
#include "l.h"
struct Edge{
int v;
int w;
double weight;
Edge(int v, int w, double weight) : v(v), w(w), weight(weight){}
bool operator>(Edge &e) { return this->weight > e.weight; }
bool operator<(Edge &e) { return this->weight < e.weight; }
bool operator==(Edge &e) { return this->weight == e.weight; }
bool operator!=(Edge &e) { return this->weight != e.weight; }
friend ostream& operator<<(ostream& out, Edge &e);
int other(int u) {
if (u == v) return w;
else return v;
}
};
ostream& operator<<(ostream& out, Edge &e) { out << e.v << "-" << e.w << " " << fixed << setprecision(2) << e.weight; return out; }
#endif // !_L_EDGE_H