-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.h
More file actions
43 lines (38 loc) · 1.32 KB
/
graph.h
File metadata and controls
43 lines (38 loc) · 1.32 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
#ifndef GRAPH_H
#define GRAPH_H
#include <vector>
#include <iostream>
#include <cstdlib>
struct Connection{
int firstID;
int secondID;
int getMax()const {
return ((firstID > secondID) ? firstID : secondID);
}
};
class Graph{
int _verticesNumber;
bool** _adjacencyMatrix;
public:
static Graph* pointSideGenerator(const int n, const int l);
static Graph* copyFromAdjancencyList(std::vector<std::vector<int> > adjancencyList);
static Graph* pointProbabilityGenerator(const int n, const double p);
static Graph* copyFromConnectionList(std::vector<Connection> connectionList);
static Graph* copyFromConnectionMatrix(std::vector<std::vector<bool> > connectionMatrix);
Graph(int size);
Graph(bool** Matrix, const int number);
~Graph();
int getVerticesNumber();
bool * operator [](int pos);
void connectVertices(int firstID,int secondID);
void disconnectVertices(int firstID,int secondID);
bool getAdjacencyMatrixValue(int firstID,int secondID);
std::vector<std::vector<int> > getAdjacencyList();
void printAdjacencyList();
void printAdjacencyMatrix();
std::vector<Connection> getConnectionList();
std::vector<std::vector<bool> > getConnectionMatrix();
bool** getAdjacencyMatrix() const;
int GetVerticesNumber() const;
};
#endif // GRAPH_H