-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.hpp
More file actions
51 lines (48 loc) · 1.18 KB
/
Graph.hpp
File metadata and controls
51 lines (48 loc) · 1.18 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
#ifndef GRAPH_HPP
#define GRAPH_HPP
#include <vector>
class Graph
{
public:
class Vertex
{
private:
const unsigned number;
const unsigned label;
public:
Vertex(unsigned, unsigned);
unsigned getNumber() const;
unsigned getLabel() const;
};
class Edge
{
private:
const Vertex * first;
const Vertex * second;
public:
Edge(const Vertex *, const Vertex *);
const Vertex * getFirstVertex() const;
const Vertex * getSecondVertex() const;
};
private:
std::vector<Vertex *> vertices;
std::vector<std::vector<Edge *>> adjacencyMatrix;
unsigned numberOfVertices;
unsigned numberOfEdges;
public:
Graph();
Graph(const Graph &);
Graph(Graph &&);
~Graph();
Graph & operator=(const Graph &);
unsigned getNumberOfVertices() const;
unsigned getNumberOfEdges() const;
unsigned getMaxVertex() const;
void addVertex(unsigned, unsigned);
void addEdge(unsigned, unsigned);
void removeVertex(unsigned);
void removeEdge(unsigned, unsigned);
const Vertex * getVertex(unsigned) const;
const Edge * getEdge(unsigned, unsigned) const;
};
#endif