-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension.cpp
More file actions
32 lines (26 loc) · 859 Bytes
/
Copy pathextension.cpp
File metadata and controls
32 lines (26 loc) · 859 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
#include <iostream>
#include <fstream>
#include "Graph.h"
using namespace std;
/* Name: Fu Yang Chin
* Given a city, find all the cheapest flights
* that visits all other cities accessible from the city.
* Usage: ./extension flights_fare_dataset.tsv city_source.tsv output_flight_path.tsv
**/
int main(int argc, char** argv)
{
if (argc != 4) {
cout << "./extension called with invalid arguments." << endl;
cout << "Usage: ./extension flights_fare_dataset.tsv city_source.tsv output_flight_path.tsv" << endl;
return -1;
}
ifstream inFile(argv[1]);
Graph flightsGraph(inFile);
cout << "Finding minimum spanning tree...\n";
ifstream citysourceFile(argv[2]);
flightsGraph.findMinimumSpaningTree(citysourceFile);
cout << "Writing flights to file...\n\n\n";
ofstream outFile(argv[3]);
flightsGraph.outputFlightPaths(outFile);
return 0;
}