Additional information for the graph program, number 3.
Most of the program requirements are stated in Dr.Stapleton's requirements, with only a few addions, clarifications, and changes:
0. The code on page 587 already does it this way, but to be specific, if two destination vertices share the same weight, you must choose the lower numbered one.
1. The vertices will be numbered from 0 to (n-1), where n is the number of vertices input in the first line of the input file. If a vertice is not mentioned in the input file, assume that it has no edges either into it or out of it. The order of edges in the input file must be assumed to be random.
2. There will be only one directed edge per pair of vertices. This does not mean that vertices can't point to each other. E.g, 0 1 2, 0 1 5 will not be allowed (should be rejected as a duplicate), but 0 1 2, 1 0 2 is, of course, allowed.
3. There can, and probably will, be disconnected graphs. There will almost certainly be paths that are not possible. Look out for these cases.
4. There will be one asterisk ('*') separating the edge inputs from the source inputs.
5. There may be multiple source vertex inputs.
6.Input error checking: The following cases should be handled:
White space should be ignored: 2 2 1 is the same as 2 2 1 etc...
blank lines should be ignored
First part: edge inputs:
Valid entries should echo: (for 1 2 3)
Entered vertex 1 with destination 2 of weight 3
Invalid vertex or weight values (should be non-negative integer):
bad input your output
r 4 1 Source Vertex r: is an invalid value
4 r 1 Destination Vertex r: is an invalid value
4 5 e Edge weight e: is an invalid value
3 2 -1 Edge weight -1: is an invalid value
Edge that contains an out of range vertex: must be 0<=vertex<count
(Assume count = 8)
bad input your output
9 3 1 Source Vertex 9 to destination vertex 3 of weight 1 is an invalid entry
3 9 1 Source Vertex 3 to destination vertex 9 of weight 1 is an invalid entry
Duplicates:
Duplicates are not allowed, even with different edge weights, and should create
this output:
Source Vertex 1 to destination vertex 2 of weight 3 is a duplicate edge
Too many/few arguments on the line:
Incorrect number of inputs: ignoring line
Second part:
Invalid source values on second part (after the *)
if the vertex entered is outside of the valid range (0 <= vertex <count):
Invalid source 9: ignoring line
too many parameters:
Incorrect number of inputs: ignoring line
7. Output: Name the output file <inputfilename>.out
output (other than that described above) should follow Dr. Stapleton's exactly,
with only two changes:
7.1: For each source vertex input, Echo:
Using <vertex> as the source vertex:
for example, using 2 as the source:
Using 2 as the source vertex:
Note that there is a tab character at the beginning of the line! That is for
readability.
7.2 Do not put blank lines between lines of output. This decreases readability
somewhat, but if there are no lines it will make the file "smaller"
to read, and help my grading. (and maybe your coding)
7.3: do NOT put the message "//Note how all these add up to 24!" in
the output.
8: Input file names will be read in on the command line. (as before)
Please check your code against the 2 inputs and outputs supplied.