-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphAlgorithms.hpp
More file actions
52 lines (44 loc) · 1.17 KB
/
GraphAlgorithms.hpp
File metadata and controls
52 lines (44 loc) · 1.17 KB
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
/**
* @file
* @author The CS2 TA Team
* @version 1.0
* @date 2018
* @copyright This code is in the public domain.
*
* @brief The MST and Shortest Path algorithms
* (header file).
*
*/
#pragma once
#include <cstdlib>
#include <stdlib.h>
#include <iostream>
#include <list>
#include <queue>
#include <vector>
#include "GraphApp.hpp"
#include "structs.hpp"
using namespace std;
/** STUDENT IMPLEMENTED FUNCTIONS */
void buildMSTPrim(Graph g, GraphApp *app);
void buildMSTKruskal(Graph g, GraphApp *app);
void findShortestPath(int start, int end, Graph g, GraphApp * app);
/** Helper function to draw an edge on the graphics app given two nodes */
void drawEdge(Node *pt1, Node *pt2, vector<Edge *> edges, GraphApp *app,
bool mst);
/** Vector to store Nodes both on and not on MST for Prim's Algorithm */
vector<Node *> onMST;
vector<Node *> notOnMST;
/**
* @brief Struct representing an edge between two trees during computation of
* MST using Kruskal's algorithm.
*
* The KruskalEdge struct stores the two Nodes that it connects as well as the
* weight of the edge (used in comparisons for priority_queue
*/
struct KruskalEdge
{
double weight;
Node *u;
Node *v;
};