-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.hpp
More file actions
48 lines (33 loc) · 1.11 KB
/
Graph.hpp
File metadata and controls
48 lines (33 loc) · 1.11 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
#ifndef GRAPH_HPP
#define GRAPH_HPP
#include <iostream>
#include <vector>
using namespace std;
namespace ariel
{
class Graph
{
// we made numVertices as size_t because it will never be negative
// and also the vector constructor takes size_t as an argument for the size
private:
vector<vector<int>> adjacencyMatrix;
bool isDirected; // false for undirected, true for directed
bool containsNegativeCycle;
int weightType; // -1 for negative weight, 0 for no weight, 1 for positive weight
size_t numVertices;
public:
Graph(bool directed = false) : isDirected(directed) {}
// inline Constructor
void setWeightsType(int type);
int getWeightsType() const;
void printGraph();
bool getContainsNegativeCycle() const;
void loadGraph(const vector<vector<int>> &matrix);
bool getIsDirected() const;
size_t getNumVertices() const;
void setContainsNegativeCycle(bool flag);
void setIsDirected(bool type);
vector<vector<int>> getAdjacencyMatrix() const;
};
}
#endif