Question: Do not cut and paste method prototypes from the javadoc into Eclipse. Your code may not compile in the submit server. This has to do
Do not cut and paste method prototypes from the javadoc into Eclipse. Your code may not compile in the submit server. This has to do with character sets.
If you see in the submit server the error "missingcomponent", the problem is that you are missing a required classmethod You can also get this error if you are not defining a generic class correctly. Submit often so you can identify problems immediately.
Feel free to use code we have provided in lecture.
If you have a problem with your code and need assistance during office hours, you need to have a stu dent tests that illustrates the problem you are experiencing. See Student Tests for information regarding the implementation of student tests.
This project has two main tasks: implementing a graph representation and implementing the BFSDF SDijkstras algorithms. The Graph class is a generic class whose type parameter represents the elements of the graph we are defining eg Graph, Graph, etc. In order to represent the adja cency properties and the graph data we will use the following maps:
HashMap adjacencyMap; HashMap dataMap;
TheactualmethodsyouneedtoimplementaredescribedatJavadoc.Youwillfindintheimplementation package an interface named CallBack. A class implementing this interface represents a class that will process a vertex. An example of such a class is PrintCallBack which you will find in the implementation package This class is used to generate the string that represents the path we follow when performing a breadthfirst search or a depthfirst search. Each time we reach a vertex, the implementation of DFS and BFS is expected to call the processVertex method to apply whatever processing needs to be done to the vertex. We have implemented PrintCallBack for you dont modify it
ThemethodgetCostreturnsthecostofthedirectededgethatexistbetweenstartVertexandendVertex. You can assume that endVertex is adjacent to startVertex. This method is NOT computing the cost betweenanytwovertices.Forthismethodignorethe@throws IllegalArgumentExceptioninformation provided in the javadoc.
If your doDepthFirstSearch and doBreadthFirstSearch methods work in Eclipse, but not in the submit server, your problem might be that you are defining the callback parameter as PrintCallBack instead of Callback. The submit server expects Callback.
Do not implement DFS using a recursive approach; implement DFS using an explicit stack as described in lecture.
If no path is found while executing Dijkstras algorithm, the ArrayList representing the path will have the entry "None". The doDijkstras method will return in this case.
Process adjacent vertices in alphabetical order. This means that when processing a node you will add adjacent elements to a stack or queue by selecting adjacent nodes in alphabetical order. It does not mean the DFS or BFS result will show the nodes in alphabetical order. For example, if node B has nodes E and D as adjacents, we will add D to the stackqueue first, followed by tt E
Style will not be graded for this project. Your grade will be based on submit server results.
For this project it could be the case that you pass your tests in Eclipse and not in the submit server due to some class definition. Make sure you submit early and often so you can verify your project works in the submit server. No extensions will be granted because you did not check your project results in the submit server.
Youcanactuallyimplementtheprojectwithoutusingaparticularmaximum.IncaseInteger.MAXVALUE is not working for you, you can assume an edge cost will not exceed
Adding private methods is fine.
Do you know you can make a TreeMap out of a HashMap? You can have the efficiency of HashMaps, but when you need to process data in sorted order you can turn a HashMap into a TreeMap by using the TreeMapconstructoregnew TreeMapmyHashMap
When multiple nodes have the same cost choosing any one is fine.
You can use classes we have gone over in class TreeSet PriorityQueue, etc.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
