-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraph.h
34 lines (34 loc) · 930 Bytes
/
Graph.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
#pragma once
#include "HashTable.h"
#include "Array.h"
#include "Coords.h"
class Graph
{
private:
int width;
int height;
struct City {
Coords location;
String name;
};
Array<City> VIDToCity;
int** CoordsToVID;
HashTable<String, int> CityNameToVID;
int citiesCount = 0;
const Coords DIRECTIONS[4] = { Coords(0, 1), Coords(0, -1), Coords(1, 0), Coords(-1, 0) };
struct Flight {
int destination;
int time;
};
Array<Array<Flight>> adjList;
public:
Graph(int w, int h);
~Graph();
void AddCity(String& cityName, Coords& location);
void AddAnonymousCity(Coords& location);
void PrepareForAddingFlights();
void AddFlight(String& from, String& to, int time);
void AddFlight(int& from, int& to, int time);
void AddFlight(Coords& from, Coords& to, int time);
void PrintShortestPath(String& from, String& to, bool verbose);
};