Assignment 5 (150 Points) - EXTENDED: Due Tuesday, December 04, 11:59PM

Announcements and Clarification

Dec 11: Assignment4 Testfile and Outputfile Assignment5_Testfile_Outputfile.zip

command used:

safejogger 2 4 random_map_1

safejogger 2 4 random_map_2

safejogger 2 4 random_map_3

safejogger 2 200 random_map_3

safejogger 2 4 small_map

Dec 1: A draft Assignment 5 Rubric is available. Please note that minor changes to the grading rubric may be made during the grading process.

Nov 29: Assignment 5 submission due date has been extended to Tuesday, December 04, 11:59PM. However, late submissions will only be accepted until Wednesday, December 05, 11:59PM (i.e. only one day late will be accepted for this submission).

Nov 26: Sorting of the jogging paths according to the average path safety have been moved from a requirement for the assignment to an extra credit opportunity. Please see below for details.

Nov 24: The paths displayed in the output of the program should use the intersection name.

Nov 24: The average path safety should be calculated using all intersections within the path, including the start and end intersections.

Nov 24: The starting intersection specified on the commandline argument will be the integer ID for the intersection.

Nov 20: You must use C++ for the assignment. Minimally, this requires that you use classes instead of structs, functions supporting a specific struct should be implemented as member functions of the class, and new and delete should be used instead of malloc() and free().

Nov 18: There is no requirement that the IDs for intersections will be sequential or that they will start with an an ID of 1. The only requirements is that the intersections are unique integers. As such, you program should ensure the input file is correct specified. If a duplicate intersection ID is provided, your program should report an appropriate error. Similarly, there should only be one street between any two intersections. Thus, your program should also report an error is a duplicate street is found.

Oct 25: The following test files can be used for testing the functionality of your program: Assignment4_testfiles.tgz

SafeJogger:

Create a safejogger program capable of finding the safest jogging paths of a specified distance given with the same starting and ending intersection.

Commandline Arguments

Your program must be capable of utilizing a commandline argument to specify the input graph file.

safejogger disantceInMiles startingIntersection streetMapGraphFile

Graph Input File

The graph input file is consisted by two sections: INTERSECTIONS and STREETS. INTERSECTIONS lists all intersections in the map. Each intersection has a unique integer ID, a Safety Index(0~1) and a unique Name. The higher a safety index, the safer the intersection. The highest possible safety is the value 1, and the lowest possible safety is the value 0.

STREETS lists all streets in the map. Every street has three properties startID, endID, and Distance. startID and endID represent two intersections linked by the street. The graph input file will specify as an undirected graph structure using the following format:

INTERSECTIONS:
ID SafetyIndex Name

STREETS:
startID endID distance

All properties will be separated by '\t'. Following is a sample streetMapGraph file;

INTERSECTIONS:
1 0.5 Speedway and Campbell
2 0.3 Park and Grant
3 0.1 Euclid and Grant

STREETS:
1 2 3
2 3 1
3 1 2

Jogging Path Requirements

The safejogger program should search the provided graph to find jogging paths that meet the following requirements:

  1. The path must start and end at the same intersection (i.e. vertex) indicated by the user-specified startingIntersection.
  2. The path should not revisit any intersections. In other words, no vertex should appear twice within the path.
  3. The path should have a total distance within 1 mile of the user-specified distance goal.

Jogging Path Safety

The safejogger program should computer two statistics for jogging paths, including:

  1. Average Path Safety: The average Safety Index of all intersections within the jogging path.
  2. Minimum Path Safety: The minimum Safety Index of all intersections within the jogging path.

Reporting Safe Jogging Paths

The safejogger program should report a list of all jogging paths that meet the jogging path requirements sorted by average path safety. Your program should report the jogging paths using the following format, where u and v are the starting/ending intersection, i1, i2, ..., in are the ordered list of intermediate intersections, and D is the length of the path, AS is the Average Path Safety, and MS is the Minimum Path Safety:

<u, i1, i2, ..., in, v> : D : AS : MS

Note 1: All jogging paths must start and end at the same intersection. Thus, u and v in the above specification should be the same intersection.

Note 2: If no jogging paths are found that match the user provided input settings, your program should report: "No joggings paths found.".

Requirements

This project must be implemented using C++ and Classes. You may use the Standard Template Library to assist in maintaining the data structures needed to implement a graph.

Extra Credit (10%)

Extra credit will be awarded for all programs that report the list of all jogging paths meeting the jogging path requirements ''sorted by average path safety with paths with the highest path safety reported first.