-
Notifications
You must be signed in to change notification settings - Fork 0
/
edge.cpp
42 lines (35 loc) · 1005 Bytes
/
edge.cpp
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
#include "edge.h"
Edge::Edge(int iOne, int iTwo)
{
m_Edge.first = iOne;
m_Edge.second = iTwo;
m_direction = EdgeDirection::UNDIRECTED;
m_iWeight = 1;
}
/*
m_bFirstLast - boolean var which determins direction
if true - then first node -> second node
if false - then first node <- second node
*/
DirectedEdge::DirectedEdge(int iOne, int iTwo, const EdgeDirection &direction) :
Edge(iOne, iTwo)
{
m_direction = direction;
}
WeightEdge::WeightEdge(int iOne, int iTwo, int iWeight) :
Edge(iOne, iTwo)
{
m_iWeight = iWeight;
}
DirectedWeightEdge::DirectedWeightEdge(int iOne, int iTwo, const EdgeDirection &direction, int iWeight) :
Edge(iOne, iTwo), DirectedEdge(iOne, iTwo, direction), WeightEdge(iOne, iTwo, iWeight)
{
}
bool operator<(const Edge &edge1, const Edge &edge2)
{
return edge1.Weight() < edge2.Weight();
}
bool operator==(const Edge &edge1, const Edge &edge2)
{
return edge1.Weight() == edge2.Weight();
}