-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdijkstra.h
More file actions
33 lines (24 loc) · 950 Bytes
/
dijkstra.h
File metadata and controls
33 lines (24 loc) · 950 Bytes
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
#ifndef _DIJKSTRA_H_
#define _DIJKSTRA_H_
#include "wdigraph.h"
#include "heap.h"
#include <utility>
#include <unordered_map>
using namespace std;
// for brevity
// typedef introduces a synonym (alias)
// for the type specified
typedef pair<int, long long> PIL;
// again, for brevity
// used to store a vertex v and its predecessor pair (u,d) on the search
// where u is the node prior to v on a path to v of cost d
// eg. PIPIL x;
// x.first is "v", x.second.first is "u" and x.second.second is "d" from this
typedef pair<int, PIL> PIPIL;
// NOTE: you are not required to use PIPIL in your solution if you would prefer
// to implement Dijkstra's algorithm differently, this is here simply because
// it was used in the lecture for the slower version of Dijkstra's algorithm.
typedef pair<int, int> Edge;
typedef pair<Edge, long long> Edge_w_Cost;
void dijkstra(const WDigraph& graph, int startVertex, unordered_map<int, PIL>& tree);
#endif