Master Computers and Technology with Fun Quizzes & Brain Teasers!
Java Language need help on implementing Breadth-First Search, Depth-First Search, and Dijkstra's algorithms. Need implementing in the graph.java with all the bold methods and look at the requirement for more information on the implementation. Match the test output result. Thank you i will thumbs up, comment if you need more information or confused.RequirementThis project has two main tasks: implementing a graph representation and implementing the BFS/DFS/Dijkstra's algorithms. The Graph class is a generic class whose type parameter represents the elements of the graph we are defining (e.g., Graph, Graph, etc.). In order to represent the adjacency properties and the graph data we will use the following maps: HashMap> adjacencyMap; HashMap dataMap;The method getCost returns the cost of the directed edge that exist between startVertex and endVertex. You can assume that endVertex is adjacent to startVertex. This method is NOT computing the cost between any two vertices.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.Do not implement DFS using a recursive approach;If no path is found while executing Dijkstra's algorithm, the ArrayList representing the path will have the entry "None". The doDijkstras method will return -1 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 stack/queue first, followed by E.Adding private methods is fine.Graph.Javapublic class Graph {/* You must use the following maps in your implementation */private HashMap> adjacencyMap;private HashMap dataMap;/** Adds a vertex to the graph by adding to the adjacency map an entry for the vertex.* This entry will be an empty map. An entry in the dataMap will store the provided data.*/public void addVertex(String vertexName, E data) {}/** Adds or updates a directed edge with the specified cost.*/public void addDirectedEdge(String startVertexName, String endVertexName, int cost) {}