File tree 1 file changed +51
-0
lines changed
1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ //
2
+ // Created by ahmad on 12/27/16.
3
+ //
4
+
5
+ #ifndef GRAPHTRAVERSE_GRAPH_H
6
+ #define GRAPHTRAVERSE_GRAPH_H
7
+
8
+ #include < vector>
9
+
10
+ struct GraphVertex
11
+ {
12
+ bool isVisited;
13
+ char key;
14
+
15
+ GraphVertex ();
16
+ };
17
+
18
+ struct GraphEdgeConnection
19
+ {
20
+ private:
21
+ public:
22
+
23
+ GraphVertex vertex1;
24
+ GraphVertex vertex2;
25
+
26
+ GraphEdgeConnection (char v1, char v2);
27
+
28
+ bool contatinVertex (char v);
29
+ };
30
+
31
+
32
+
33
+ class Graph {
34
+ private:
35
+ std::vector<GraphEdgeConnection> edgeTable;
36
+ std::vector<GraphVertex> vertexes;
37
+
38
+ std::vector<char > getAllNotVisitedVertexesConnectedTo (char v);
39
+ bool containVertex (char v);
40
+ bool isVisited (char v);
41
+
42
+ void visitVertex (char v);
43
+ public:
44
+ void addEdge (char v1, char v2);
45
+
46
+ std::vector<char > dfs (char startVertex);
47
+ std::vector<char > bfs (char startVertex);
48
+ };
49
+
50
+
51
+ #endif // GRAPHTRAVERSE_GRAPH_H
You can’t perform that action at this time.
0 commit comments