/** * Implementation of Adjacency Matrix Graph representation */ public class UndirectedGraph { /*array to store visited nodes*/ boolean visited[]; /** * Adds an edge to the Adjacency Matrix * @param node1 * @param node2 */ public void AddEdge(int node1, int node2) { } /** * Performs breadth first search * @param start * @param end */ public int[] BreadthSearch(int start, int end) { return null; } /** * Performs Depth first search * @param start * @param end * @return array containing the nodes in sequence, path from start to end node, null if not found */ public int[] DepthSearth(int start, int end) { return null; } /** * Finds a Spanning tree starting at the provided node * @param start * @return array containing the nodes in sequence, path from start to end node, null if not found */ public int[] SpanningTree(int start) { return null; } /** * complete this method to create UndirectedGraph object and perform breadth first/ depth first search, find spanning tree * @param args */ public static void main(String[] args) { /*input data*/ static int[][] input = {{1,2}, {2,4}, {3,2}, {3,4}, {4,5}, {2,6}, {7,18}}; /*instructioins for to do in this section*/ /*create graph object*/ /*load each of above pair to graph*/ /*call breadth first search with appropriate parameters*/ /*call depth first search with appropriate parameters*/ /*find spanning tree with a start node as parameter*/ } }