-
Notifications
You must be signed in to change notification settings - Fork 0
/
MST.h
60 lines (46 loc) · 1.26 KB
/
MST.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "common.h"
#include "Minmatching/PerfectMatching.h"
#include <vector>
#include <unordered_map>
#include <utility>
#pragma once
class MST {
public:
float** adjacentMatrix;
float ** mstAdjMatrix;
int* parent; //Array to store constructed MST
int* key; //Key values used to pick minimum weight edge in cut
bool* mstSet; //To represent set of vertices not yet included in MST
int N; //the size of pointset
int * edges;
int * weights;
bool * visited;
MST(float** adjacentMatrix, int size);
~MST();
//deliverable a
void makeTree();
int printMST();
//deliverable b
int makeTSP2();
void printTSP2();
void dfs(int u);
//deliverable c
void findOddDegreeVertices();
int makeTSP1_5();
void eulerTour(int u, float ** adjMatrix);
void printTSP1_5();
std::vector<int> mstResults;
std::vector<int> TSP2Results;
std::vector<int> TSP1p5Results;
float calMean(int option);
float calStd(int option, int mean);
private:
std::vector<int> odds;
std::vector<int> prelist;
std::vector<int> tour;
std::unordered_map<int, int> matched;
PerfectMatching * pm;
void minimumMatching();
int combine(int node_num);
int minKey(int key[], bool mstSet[]);
};