-
Notifications
You must be signed in to change notification settings - Fork 0
/
GraphInterface.h
44 lines (36 loc) · 1.06 KB
/
GraphInterface.h
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
#ifndef RED_BLUE_GRAPH_SOLVER_1_GRAPHINTERFACE_H
#define RED_BLUE_GRAPH_SOLVER_1_GRAPHINTERFACE_H
#include <iostream>
#include <vector>
#include <optional>
#include <functional>
#include <deque>
class GraphInterface
{
public:
enum class Color
{
RED,
BLUE
};
class GraphModificationException : public std::exception
{
public:
explicit GraphModificationException(const std::string &message) : _message(message)
{}
[[nodiscard]] const char *what() const noexcept override
{
return _message.c_str();
}
private:
std::string _message;
};
virtual void createNode(const GraphInterface::Color &color, size_t id) = 0;
virtual void addEdge(size_t from, size_t to, const GraphInterface::Color &color) = 0;
virtual bool nodeExists(size_t id) const = 0;
virtual void removeNode(size_t id) = 0;
virtual bool isEmpty() const = 0;
virtual size_t getMaxCapacity() const = 0;
virtual size_t size() const = 0;
};
#endif //RED_BLUE_GRAPH_SOLVER_1_GRAPHINTERFACE_H