This repository has been archived by the owner on May 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraph.h
71 lines (41 loc) · 1.51 KB
/
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
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
//
// Created by barto on 19.05.18.
//
#ifndef GRAPHREPRESENTATIONSANDALGORITHMSCOMPARISON_GRAPH_H
#define GRAPHREPRESENTATIONSANDALGORITHMSCOMPARISON_GRAPH_H
#include <vector>
#include <forward_list>
#include <string>
class Graph {
protected:
Graph(std::string name, int numberOfAvailableAlgorithms);
// implementing it here as it is needed for adjacencyList declaration
struct EdgeListElement {
int edgeEnd;
int value;
};
const std::string name;
const int numberOfAvailableAlgorithms;
protected:
std::vector<std::vector<int>> incidenceMatrix;
std::vector<std::forward_list<EdgeListElement>> adjacencyList;
public:
std::string getName();
int getNumberOfAvailableAlgorithms();
virtual std::string getAvailableAlgorithms()= 0;
std::string printIncidenceMatrix();
std::string printAdjacencyList();
void loadDataFrom(std::string fileName);
virtual void generate(int numberOfVertices, int density, int range)= 0;
virtual std::string runAlgorithm(char index, char arg1, int arg2, int arg3)= 0;
virtual void test()= 0;
protected:
std::vector<int> loadRawDataFrom(std::string path);
virtual void loadRawDataToMatrix(std::vector<int> rawData)= 0;
virtual void loadRawDataToList(std::vector<int> rawData)= 0;
bool edgeBeginningAvailable(int vertex);
bool edgeEndAvailable(int beginning, int end);
std::string printMatrix(std::vector<std::vector<int>> v);
std::string printList(std::vector<std::forward_list<EdgeListElement>> v);
};
#endif //GRAPHREPRESENTATIONSANDALGORITHMSCOMPARISON_GRAPH_H