Java Programming Assignment Dealing with Directed Graphs. $30 USD due Friday

// You MAY additional methods and classes of your own, but you must ensure that they are in your git repository on Bitbucket (if not, the non-compilation policy applies). // An easy way to do this is to put all new methods classes within this source code file. // // Complete the methods of this class so that it passes the tests.

import algs4.Digraph; import java.util.LinkedList; import java.util.Queue;

public class Graphs { // EXERCISE 1: Perform a depth first search and return the preorder traversal (from initial vertex s) of the vertices as a LinkedList. // You should only search vertices that are reachable from s. public static LinkedList<Integer> dfsPreorder (Digraph g, int s) { // TODO: Complete this method. return null; }

// EXERCISE 2: Perform a depth first search and return the postorder traversal (from initial vertex s) of the vertices as a LinkedList. // You should only search vertices that are reachable from s. public static LinkedList<Integer> dfsPostorder (Digraph g, int s) { // TODO: Complete this method. return null; }

// EXERCISE 3: Perform a breadth first search and return the preorder traversal (from initial vertex s) of the vertices as a LinkedList. // You should only search vertices that are reachable from s. public static LinkedList<Integer> bfsPreorder (Digraph g, int s) { // TODO: Complete this method. return null; }

// EXERCISE 4: Return an array with the distances of each vertex v from an initial vertex s. Hint: use breadth first search. // You should only search vertices that are reachable from s. For a vertex v that is not reachable from s, the resulting array // should have -1 at that entry. public static int[] distanceTo (Digraph g, int s) { // TODO: Complete this method. return null; } }

/r/DoMyHomework Thread Parent