-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph.h
33 lines (29 loc) · 805 Bytes
/
graph.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
#include <memory>
#include "node.h"
enum class MoveType {Up, Down};
struct Move {
MoveType moveType;
int index;
};
class Graph {
std::shared_ptr<Node> head;
std::shared_ptr<Node> tail;
std::shared_ptr<Node> currA;
std::shared_ptr<Node> currB;
int y;
bool dfs(std::shared_ptr<Node> current, std::vector<std::shared_ptr<Node>> visited) const;
public:
Graph(int y);
~Graph();
std::shared_ptr<Node> &getHead();
std::shared_ptr<Node> &getTail();
std::shared_ptr<Node> &getA();
std::shared_ptr<Node> &getB();
NodeType getType() const;
void draw();
void print() const;
void printHelper(std::string prefix, std::shared_ptr<Node> current) const;
void insert(std::string label, bool status);
bool eval() const;
void traverse(Move m, std::shared_ptr<Node> ¤t);
};