-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNo.h
40 lines (27 loc) · 885 Bytes
/
No.h
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
#pragma once
#include <vector>
#include <unordered_map>
#include <string>
#include <iostream>
using namespace std;
class No {
private:
string id;
int grau = 0;
int peso = 0;
unordered_map<int, int> *arestas;
public:
No(string id, int peso);
~No();
bool operator=(const No &d) { return this->id.compare(d.id) == 0; };
int getGrau() { return grau; };
int getPeso() { return peso; };
string getId() { return id; };
// como o getArestas é usado só para leitura, retornar ponteiro
// para o vetor de arestas para evitar que o vetor seja copiado desnecessariamente
unordered_map<int, int> *getArestas() { return arestas; };
void inserirAresta(int destino, int peso);
int removerAresta(int destino);
void atualizarIndices(int indiceRemovido);
pair<const int, int> *encontrarArestasComDestino(int destino);
};