Question: Write a C++ application that represents city streets as edges in a graph using nodes for intersections. Use integers to represent nodes, and tuples (pairs
Write a C++ application that represents city streets as edges in a graph using nodes for intersections. Use integers to represent nodes, and tuples (pairs of integers enclosed in parentheses, e.g., (4 7), to represent a street from node 4 to node 7, and a second tuple, (7 4) to represent the fact that this is a bidirectional street). Assume that there is but a single snowplow and it must start and return to node 1. Your program must read a collection of tuples from a file and then produce driving instructions for the snowplow operator telling the sequence of intersections (nodes) to visit so that all the streets are appropriately plowed. If it is impossible to perform a correct plowing (some street would be left unplowed or some street would be plowed twice) your program must report this fact. Your program should repeatedly read collections of tuples and processes the information until an end-of-file is encountered. Your program will lose a significant number of points if your algorithm fails to work properly for cities (graphs) containing both bidirectional and unidirectional streets.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
