Travelling_Salesman_Algorithms
graph.h
Ir para a documentação deste ficheiro.
1 #pragma once
2 
3 #include <string.h>
4 
8 class Graph
9 {
10 private:
11  double **graph;
12  int V;
13 
14  void initializeGraph();
15  void printRoutes();
16 
17  /* Funções dos paradigmas */
18  void permutation(int array[], int size, int n, double sum);
19  void walkThePath(int *array);
20 
21 public:
22  Graph();
23  Graph(int V);
24 
25  ~Graph();
26 
27  Graph(const Graph &other);
28 
29  Graph &operator=(const Graph &other)
30  {
31  if (this != &other)
32  {
33  int numVertices = V = other.V;
34  graph = new double *[numVertices];
35 
36  for (size_t i = 0; i < numVertices; i++)
37  {
38  graph[i] = new double[numVertices];
39  memcpy(graph[i], other.graph[i], sizeof(double) * numVertices);
40  }
41  }
42 
43  return *this;
44  }
45 
46  void createLigation(int x, int y, double weight);
47  int getV();
48  double **getGraph();
49 
50  /* Funções uteis */
51  void print();
52  void newRandomGraph();
53  void showResult();
54  bool edgeExist(int x, int y);
55 };
bool edgeExist(int x, int y)
Definition: graph.cpp:127
void print()
Definition: graph.cpp:94
Definition: graph.h:8
int getV()
Definition: graph.cpp:87
void createLigation(int x, int y, double weight)
Definition: graph.cpp:76
void showResult()
double ** getGraph()
Definition: graph.cpp:89
void newRandomGraph()
Definition: graph.cpp:111
Graph()
Definition: graph.cpp:12
Graph & operator=(const Graph &other)
Definition: graph.h:29
~Graph()
Definition: graph.cpp:29