BreadthFirstSearch in Java Paper
Description
You need to build an application that will print out the breadth first search route between designated vertices in a user supplied graph. Your code will be compiled from the command line with the following command: javac BFS.java It will be run from the command line with the following command:
java BFS <graphFileName> <startVertex> <endVertex>
Where <graphFileName> is the file name for a text file describing a graph (details later) kept in the same location as the source code, <startVertex> is the starting vertex, and<endVertex> is the destination vertex. For example: java BFS graph.txt 0 5
The graph file needs to formatted as:
<numVertices>
<firstVertexInEdge1>,<secondVertexInEdge1>
<firstVertexInEdge2>,<secondVertexInEdge2>
<firstVertexInEdge3>,<secondVertexInEdge3>
…<and so on>
An example can be found here in the starter code discussed below. The output of your code will be the path found in a breadth first fashion between the start vertex and the end vertex.An example run is:
src % javac BFS.java
src % java BFS graph.txt 0 5
Route: 0 -> 2 -> 5
src %
Start with the code supplied here: down below You can see how the arguments (graph file name and start/end vertices) can be accessed. I also put in some comments where you may want to add some code to accomplish the tasks.
Submit your source code (.java files) in a single zip file.
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."