Project 3 - Shortest Paths |
< Previous Next > |
VERTEX1 VERTEX2 WEIGHTwhere WEIGHT is the (positive) cost for to go from VERTEX1 to VERTEX2. An example input file is project3-testA.txt:
s t 10 s y 5 t x 1 t y 2 y t 3 y x 9 y z 2 x z 4 z s 7 z x 6
Please enter the input filename (or simply press return to use ./project3-testA.txt): project3-testA.txt
Importing vertices, edges (and their weights) from project3-testA.txt . . .
Found 5 vertices and 10 edges in project3-testA.txt
The costs for the shortest path from the first vertex (s):
Vertex Dist. Path
------ ----- ----
t 8 y, s
y 5 s
x 9 t, y, s
z 7 y, s
Here's another example. Given the input file project3-testC.txt:z x 6 z s 7 x z 4 y z 2 y x 9 y t 3 t y 2 t x 1 s y 5 s t 10 a b 1 a c 2 b c 3
Please enter the input filename (or simply press return to use ./project3-testA.txt): project3-testC.txt
Importing vertices, edges (and their weights) from project3-testC.txt . . .
Found 8 vertices and 13 edges in project3-testC.txt
The costs for the shortest path from the first vertex (z):
Vertex Dist. Path
------ ----- ----
x 6 z
s 7 z
y 12 s, z
t 15 y, s, z
a Infinity
b Infinity
c Infinity
Points Item ---------- -------------------------------------------------------------- _____ / 10 Style + Code is indented correctly + Functions should be no longer than 1 page + Documentation: (written for another software developer) * All source code files include Javadoc header block with description, author, version/date, etc. * Javadoc (with block tags) before each method * All non-trivial variables are commented * Comments included before major portions of code _____ / 0 Program compiles without errors _____ / 0 Program executes without crashing Requirements met: _____ / 20 + Class(es) with appropriate methods and data members _____ / 40 + Output indicates correct results _____ / 8 + Test files [that you made] _____ / 2 Completed rubric _____ / 80 Total _____ Approximate number of hours spent I, (REPLACE WITH YOUR FULL NAME), affirm that the code that I submitted is my own work and that I did not receive help that was not authorized by the instructor.
Copy and paste this rubric into a rubric-project3.txt file (not a .docx, .doc nor .rtf file). Think of this as a checklist to ensure that you receive the maximum points possible. For each grade item, fill in your estimate for the grade you deserve. Additionally, include your estimate of how many hours your spent. Lastly, replace, "(REPLACE WITH YOUR FULL NAME)" with your full name to indicate that what you are submitting is entirely your own work.
javac *.java java ShortestPathsif main() is in a class named ShortestPaths. Otherwise, use:
javac *.java java DigraphIf you're putting your code in a package (or if your IDE is), then
javac *.java -d . java <package_name>.ShortestPathswhere <package_name> is replaced by the package name used. If this doesn't work, then please comment out the package statement.
javac *.java echo "" | java ShortestPaths &> project3Output.txt # echo "" | ... is the same as typing RETURN diff project3-answerKeyA.txt project3Output.txtIf the two files match exactly (which is what you want) then there should be NO output from diff. If diff shows one or more differences, fix them and run it again. To get side-by-side output (with the answer key on the left and your output on the right), replace the last line with:
diff --side-by-side project3-answerKeyA.txt project3Output.txtFor details about interpreting the output of diff, see the Using diff section on the Misc. webpage.