-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvertice.cpp
98 lines (48 loc) · 2.33 KB
/
vertice.cpp
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <iostream>
#include "vertice.h"
// ------------------------------------------------------------------------------------------------------------
Vertice::Vertice(int indice, int pos_x, int pos_y){
this -> indice = indice;
this -> pos_x = pos_x;
this -> pos_y = pos_y;
this -> cantidad_conexiones = 0;
}
// ------------------------------------------------------------------------------------------------------------
Vertice::Vertice(){
this -> indice = -1;
this -> pos_x = -1;
this -> pos_y = -1;
this -> cantidad_conexiones = 0;
}
// ------------------------------------------------------------------------------------------------------------
int Vertice::obtener_indice(){
return this -> indice;
}
// ------------------------------------------------------------------------------------------------------------
int Vertice::obtener_posx(){
return this -> pos_x;
}
// ------------------------------------------------------------------------------------------------------------
int Vertice::obtener_posy(){
return this -> pos_y;
}
// ------------------------------------------------------------------------------------------------------------
int Vertice::obtener_cantidad_conexiones(){
return this -> cantidad_conexiones;
}
// ------------------------------------------------------------------------------------------------------------
int Vertice::obtener_elemento_de_lista_conexiones(int posicion){
return this -> lista_conexiones.consulta(posicion);
}
// ------------------------------------------------------------------------------------------------------------
int Vertice::obtener_elemento_de_lista_pesos(int posicion){
return this -> lista_pesos.consulta(posicion);
}
// ------------------------------------------------------------------------------------------------------------
void Vertice::conectar_vertice(int indice, int peso){
// ME LO EVITO USANDO PILA/COLA EN VEZ DE LISTA...
//std::cout << "Conexion (" << this->indice << "->" << indice<< "): // Nº" << cantidad_conexiones << std::endl;
this -> lista_conexiones.alta(indice, cantidad_conexiones);
this -> lista_pesos.alta(peso, cantidad_conexiones);
this -> cantidad_conexiones++;
}