-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVertex.cpp
64 lines (49 loc) · 845 Bytes
/
Vertex.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "Vertex.h"
Vertex::Vertex()
{
TotalEdges = 0;
Visited = false;
CostSoFar = 0.0f;
parent = 0;
}
bool Vertex::isVisited()
{
return Visited;
}
void Vertex::setVisitState(bool state)
{
Visited = state;
}
void Vertex::insertEdge(int Key)
{
data[TotalEdges++] = Key;
}
ArrayList<int> Vertex::getAllEdgeLeftToRight(int& size)
{
size = TotalEdges;
return data;
}
ArrayList<int> Vertex::getAllEdgeRightToLeft(int& size)
{
size = TotalEdges;
ArrayList<int> temp;
for (int i = TotalEdges - 1, j = 0; i >= 0; i--, j++)
temp[j] = data[i];
return temp;
}
float Vertex::getCostSoFar()
{
return CostSoFar;
}
void Vertex::setCostSoFar(float cost)
{
CostSoFar = cost;
}
int Vertex::getParent()
{
return parent;
}
void Vertex::setParent(int key)
{
parent = key;
}