-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvertex.hpp
46 lines (37 loc) · 1.03 KB
/
vertex.hpp
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
#ifndef UARK_CSCE_VERTEX_HEADER
#define UARK_CSCE_VERTEX_HEADER
#include <list>
#include <string>
#include <sstream>
using namespace std;
namespace csce {
class Vertex {
public:
Vertex* parent;
string color;
Vertex(size_t id);
Vertex &addNeighbor(size_t id);
Vertex &addNeighbor(const Vertex& vertex);
size_t getDegree() const;
size_t getId() const;
list<Vertex> getNeighbors() const;
bool hasNeighbor(size_t id) const;
bool hasNeighbor(const Vertex& vertex) const;
Vertex &removeNeighbor(size_t id);
Vertex &removeNeighbor(const Vertex& vertex);
string str() const;
bool operator ==(const Vertex& other) const {
return this->_id == other.getId();
}
bool operator <(const Vertex& other) const {
return this->_id < other.getId();
}
bool operator >(const Vertex& other) const {
return this->_id > other.getId();
}
private:
size_t _id;
list<Vertex> _neighbors;
};
}
#endif /* UARK_CSCE_VERTEX_HEADER */