-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
51 lines (42 loc) · 1.18 KB
/
main.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
/*
* main.cpp
*
* Created on: Sep 17, 2021
* Author: d-w-h
*/
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include <stdlib.h>
#include <time.h>
#include <vector>
#include "fib_heap.hpp"
int main(int argc, char* argv[]) {
//Declarations
int s = 2; //Start vertex. The minimum index for vertices is 1
int n = 2499; //Number of vertices
int num_edges = 3125; //Number of edges
//Create edges
std::vector< std::vector<int> > edges;
for(int i = 0; i < num_edges; ++i) {
int start_vert = rand() % n + 1;
int end_vert = rand() % n + 1;
int weight = rand() % 200 + 1;
std::vector<int> edge_elem;
edge_elem.push_back(start_vert);
edge_elem.push_back(end_vert);
edge_elem.push_back(weight);
edges.push_back(edge_elem);
}
//Compute distances to nodes from start vertex
std::vector<int> results = shortest_reach(n, edges, s);
//Print results
int size_results = (int) results.size();
for(int i = 0; i < size_results; ++i) {
std::cout << results[i] << " ";
}
std::cout << std::endl;
std::cout << "done" << std::endl;
return 0;
}