Initial commit

This commit is contained in:
jslightham
2023-05-21 23:28:11 -04:00
commit 0360e7dfcc
31 changed files with 2068 additions and 0 deletions

27
P4/Graph.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef TRIE_H
#define TRIE_H
#include <iostream>
#include <vector>
#include <tuple>
#include "PriorityQueue.h"
class Graph
{
public:
Graph(int maxCount, bool mst);
~Graph();
bool Insert(int a, int b, int weight);
bool Delete(int a);
std::vector<std::tuple<int, int>> *GetAdjacent(int a);
int GetVertexCount();
int MST(std::vector<std::tuple<int, int, int>> *outList);
private:
PriorityQueue *pq;
std::vector<std::tuple<int, int>> adjacencyList[50001]; // An array of vectors of tuples <node2, weight>
std::vector<std::tuple<int, int, int>> vertexList; // List of all vertices in the graph stored as <node1, inf, -1>
int maxCount;
bool mstEnabled;
};
#endif