-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVertex.h
More file actions
56 lines (43 loc) · 1.2 KB
/
Vertex.h
File metadata and controls
56 lines (43 loc) · 1.2 KB
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
#ifndef VERTEX_H_INCLUDED
#define VERTEX_H_INCLUDED
#include <vector>
#include <fstream> // Used for file managment
#include <iostream>
#include <string>
#include <cstring> // Used for strtok()
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
class Vertex
{
private:
int id;
int color,dist;//used in BFS
int d,f;//used in DFS
Vertex* pred;//used in BFS
int distance; //used in relax
Vertex* predecessor;//used in init single source
public:
// Constructor
Vertex(int _id): id(_id), color(0), dist(0), d(0), f(0), pred(0){};
Vertex():id(-1), color(0), dist(0), d(0), f(0), pred(0){};
// Destructor
~Vertex(){};
// Getters
int getId() const {return id;};
int getcolor()const{return color;};
int getdist()const{return dist;};
int getd()const{return d;};
int getf()const{return f;};
Vertex* getpred()const{return pred;};
//Setters
void setcolor(int i){color=i;};
void setdist(int i){dist=i;};
void setpred(Vertex* u){pred=u;};
void setd(int i){d=i;};
void setf(int i){f=i;};
// Ostream function
friend ostream& operator<<(ostream &os, const Vertex &v);
};
#endif // VERTEX_H_INCLUDED