location|203792386|-90.0020975|35.1606029 location|203841564|-90.0142355|35.1582919 location|1782970695|-89.9816435|35.1509496 location|203829293|-89.9948465|35.1590589 ... more lines here ... road|203792386|203848891|45|Jackson Avenue road|203670568|203690459|25|North Idlewild Street road|203659739|203659741|25|Hawthorne Street road|203874737|203874738|25|Tutwiler Avenue road|203785561|203785562|25|Mignon Avenue ... more lines here ...All the "locations" come first. Each line that begins with "location" contains a description of an intersection where at least two roads meet. For each location, you are given a unique integer identifier (up to ten digits), then the longitude of the location, then the latitude. Because Memphis is in the Western Hemisphere, all of the longitudes will be negative numbers (they will all be close to -90).
After all of the locations, the file will lists all of the "roads." A road is any sort of straight-line connection between two locations. This covers any kind of surface a car can drive on. Roads with curves are approximated by multiple "road" listings, since a single "road" instance only represents a straight line. Each road is described by the identifiers of the locations that it connects, the speed limit on the road (in mph), and the name of the road.
For example, in the file above, the road Jackson Avenue connects the locations with the IDs 203792386 and 203848891, and has a speed limit of 45 miles per hour.
All roads are assumed to be bi-directional (no one-way streets), but each road is only listed once in the file. In other words, if there is a line in the file that looks like
road|x|y|....then there will not be a line that looks like
road|y|x|....even though your program should assume that you can travel in either direction between locations x and y.
Use these files for testing: west-of-rhodes.txt all-memphis.txt
Enter a filename: west-of-rhodes.txt Enter a location or zero to quit: 203744902 Location 203744902 has edges leading to: 203744900 35 mph North McLean Boulevard 203874090 25 mph Lyndale Avenue 203744903 35 mph North McLean Boulevard Enter a location or zero to quit: 204000748 Location 204000748 has edges leading to: 761690915 35 mph University Street 424696634 35 mph University Street Enter a location or zero to quit: 203804462 Location 203804462 has edges leading to: 1782962464 25 mph North Evergreen Street 203848835 25 mph North Evergreen Street 203659689 25 mph Forrest Avenue 203804459 25 mph Forrest Avenue Enter a location or zero to quit: 203821515 Location 203821515 has edges leading to: 203874118 35 mph University Street 2471207719 35 mph University Street 203785186 25 mph Snowden Avenue Enter a location or zero to quit: 203744908 Location 203744908 has edges leading to: 203744906 35 mph North McLean Boulevard 203690459 45 mph Jackson Avenue 203670571 35 mph North McLean Boulevard 203761725 45 mph Jackson Avenue Enter a location or zero to quit: 203744906 Location 203744906 has edges leading to: 203659729 25 mph Crump Avenue 203744904 35 mph North McLean Boulevard 203744908 35 mph North McLean Boulevard Enter a location or zero to quit: 0