-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdjacencyMatrix.h
50 lines (43 loc) · 1.35 KB
/
AdjacencyMatrix.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
#ifndef ADJACENCYMATRIX_H_
#define ADJACENCYMATRIX_H_
#include<vector>
#include<unordered_map>
using namespace std;
class AdjacencyMatrix{
//Class attributes
private:
int COUNTER;
unordered_map<string,int>VertexList;
vector<vector<bool>>HasEdge;
vector<vector<double>>AMatrix;
int Nodes;
bool IsDirected;
//Constructors
public:
AdjacencyMatrix();
AdjacencyMatrix(int,bool=false);
~AdjacencyMatrix();
AdjacencyMatrix(const AdjacencyMatrix&);
//Member functions to add nodes, edges, initialise the matrix etc
public:
void Init();
void AddNode(string);
void AddEdge(string,string,double=1);
double GetWeight(string,string);
bool Present(string);
//Getters and Setters
public:
const unordered_map<string,int>&GetVertexList()const;
const vector<vector<bool>>&GetEdges()const;
const vector<vector<double>>&GetAMatrix()const;
const int GetNodes()const;
const bool GetIsDirected()const;
void SetVertexList(const unordered_map<string,int>&);
void SetEdges(const vector<vector<bool>>&);
void SetAMatrix(const vector<vector<double>>&);
void SetNodes(int);
void SetIsDirected(bool);
void SetCounter(int);
void ResetCounter();
};
#endif