-
Notifications
You must be signed in to change notification settings - Fork 5
/
Vertex.cpp
107 lines (93 loc) · 2.13 KB
/
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include "Vertex.h"
/*vertex class default constructor
*/
vertex:: vertex(){
this->vertex_name=-1;
this->index=-1;
this->low_link=-1;
this->tarjan_flag=0;
}
/*vertex class constructor
*@pram: a is vertex_name
*@pram: b is the index used for Tarjan's Algorithm
*/
vertex::vertex(int a,int b){
this->vertex_name=a;
this->index=b;
this->low_link=-1;
this->tarjan_flag=0;
}
vertex::~vertex()
{
}
/*vertex class function
*operator == that checks if this vertex is equal to parameter
*@pram: vertex to check for equality
*/
bool vertex::operator==(const vertex &rhs){
return this->vertex_name==rhs.vertex_name;
}
/*vertex class function
*operator != that checks if this vertex is not equal to parameter
*/
bool vertex::operator!=(const vertex &rhs){
return !(this->vertex_name==rhs.vertex_name);
}
/*vertex class function
*operator = sets this vertex to parameter
*@pram: vertex to set this vertex to
*/
vertex* vertex::operator=(const vertex *rhs){
this->vertex_name=rhs->vertex_name;
this->index=rhs->index;
this->low_link=rhs->low_link;
return this;
}
/*vertex class function
*operator = sets this vertex to parameter
*/
vertex& vertex::operator=(const vertex &rhs){
this->vertex_name=rhs.vertex_name;
this->index=rhs.index;
this->low_link=rhs.low_link;
return *this;
}
/*vertex class function
*sets this vertex's index to a
*@pram: integer to set index to
*/
void vertex::set_index(long a){
this->index=a;
}
/*vertex class function
*sets this vertex's low_link to b
*@pram: integer to set low link to
*/
void vertex::set_low_link(long b){
this->tarjan_flag=1;
this->low_link=b;
}
/*vertex class function
*returns this vertex's index
*/
long vertex:: get_index(){
return this->index;
}
/*vertex class function
*returns this vertex's low link
*/
long vertex:: get_low_link(){
return this->low_link;
}
/*vertex class function
*returns this vertex's name
*/
int vertex:: get_vertex_name(){
return this->vertex_name;
}
/*vertex class function
*returns this vertex's tarjan flag
*/
int vertex:: get_tarjan_flag(){
return this->tarjan_flag;
}