-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.h
More file actions
33 lines (28 loc) · 711 Bytes
/
graph.h
File metadata and controls
33 lines (28 loc) · 711 Bytes
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
#ifndef GRAPH_H_
#define GRAPH_H_
#include <list>
#include <map>
#include <string>
#include <utility>
typedef std::pair<int, std::list<int>> iterator_t;
class Graph {
private:
std::map<int, std::list<int>> nodes;
int size();
bool hasBeenFound(int node, std::list<int>& found);
bool _isCyclic(int start, std::list<int>& found);
public:
Graph() {}
void addVertex(int node);
bool isIn(int node);
void addIfItsNotIn(int node);
void addEdge(int from, int to);
bool isCyclic();
void dfs(int start, std::list<int>& found);
void connect(int from, int to);
void connectLast(int to);
bool hasUnusedInstructions();
void disconnectNext(int nodo);
void clear();
};
#endif // GRAPH_H_