-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphx.h
More file actions
72 lines (64 loc) · 1.58 KB
/
graphx.h
File metadata and controls
72 lines (64 loc) · 1.58 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef GRAPHX_H
#define GRAPHX_H
#include <string>
#include <vector>
using namespace std;
class graph
{
protected:
struct properti{
vector< vector<float> > adjacencyMatrix;
vector< vector<float> > adjacencyTransversal;
vector<int> visitedVertexLog;
vector <int> shortest;
}propGraph;
int vertexCount;
int source;
int dest;
public:
graph();
~graph();
virtual void proses(string, int, int, int) = 0;
virtual void show() = 0;
void lihatRelasi(bool);
properti getData(){return propGraph;}
void defaultMatrix();
void addEdge(int, int, float);
void removeEdge(int, int);
static graph *graphAlgoritma(string pilihan);
};
class mstBobot: public graph{
private:
int lower;
int minIndexBaris;
int minIndexKolom;
public:
void show();
void proses(string, int, int, int);
void _prim(int);
};
class mst: public graph{
private:
queue<int> node;
int topNode;
public:
void show();
void proses(string, int, int, int);
void _bfs(int);
void _dfs(int);
};
class findPath: public graph{
private:
vector< pair<int, int> > dist;
int minVal;
int minIndex;
public:
void show();
void proses(string, int, int, int);
void _djikstra(int, int);
void getDistance(vector< pair<int, int> > &dist);
void getPath(vector< pair<int, int> > &dist, int, int);
vector<int> getShortest();
int minDistance(vector< pair<int, int> > &dist);
};
#endif // GRAPH_H