-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEdge.cpp
More file actions
56 lines (48 loc) · 728 Bytes
/
Edge.cpp
File metadata and controls
56 lines (48 loc) · 728 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
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
#include "edge.h"
#include <iostream>
#include <cmath>
using namespace std;
Edge::Edge()
{
u = 0;
v = 0;
cost = 0;
existance = true;
}
Edge::Edge(int _u, int _v) :u(_u), v(_v)
{
cost = 0;
existance = true;
}
void Edge::operator=(const Edge& a)
{
u = a.u;
v = a.v;
cost = a.cost;
}
void Edge::setCost(double _cost)
{
cost = _cost;
}
double Edge::getCost() const
{
return cost;
}
void Edge::set_order()
{
if (u > v)
{
int tmp = u;
u = v;
v = tmp;
}
}
bool operator<(const Edge& a, const Edge& b)//ÖØÔØÐ¡ÓÚ
{
return (bool)(a.getCost() > b.getCost());
}
bool operator==(const Edge& a, const Edge& b)//ÖØÔØÅеÈ
{
if ((a.u == b.u&&a.v == b.v) || (a.u == b.v && a.v == b.u)) return true;
return false;
}