/** * The Hamilton class contains static methods to find Hamiltonian circuits in Graph objects. * This class cannot be instantiated. *
THIS CLASS SHOULD BE MODIFIED * @author Sophie Quigley * @author PUT YOUR NAMES HERE * */ public class Hamilton { /** * Stops class from being instantiated. */ private Hamilton() {} /** * graph for which a Hamiltonian circuit is sought */ private static Graph g = null; /** * Total number of vertices in graph */ private static int totalV; /** * Hamiltonian circuit being built */ private static Walk hamiltonian = null; /** * Finds a Hamiltonian circuit in graph if there is one. *
DO NOT MODIFY THE METHOD SIGNATURE AND RETURN TYPE OF THIS METHOD * @param graph graph for which a Hamiltonian circuit is sought * @return A Hamiltonian circuit for the graph if there is one, or null otherwise. */ public static Walk getHamiltonian(Graph graph) { // Store static information g = graph; totalV = g.getTotalVertices(); hamiltonian = new Walk(totalV+1); // Continue the Implementation } /** * Finds a Hamiltonian circuit in graph if there is one. * @param vertex current vertex in the circuit * @param totalvisited total number of vertices visited so far in the graph * @return true if a Hamiltonian path for the graph has been found * starting at the current vertex and returning to the first vertex in the walk */ private static boolean foundHamiltonian(int vertex, int totalvisited) { } }