// skeleton for X2 import fi.joensuu.cs.tra.*; import java.util.LinkedList; // change class name and file name to your username, all lower case // |||||||||| // vvvvvvvvvv public class CHANGETHIS { // no main program here this time at all // in this class there will be only the algorithm for X2 // and possible help methods // I'll put a separate test program that calls this class // submit only this file // do NOT use package in the final version you submit /** * X2 Cycle with given vertex. * * Write an algorithm that returns a cycle of an undirected graph that * contains a given vertex. Parameters are a graph and vertex v, and the * return value is a list of vertices (LinkedList) of one cycle * that contains vertex v, or null if there is no such cycle. The * elements in the list must be in order of the cycle. The vertex v must thus * be the first and the last element of the list. What is the time * complexity of your algorithm? * * You can make more methods, but DO NOT CHANGE the header of this method. * * @param G the input undirected graph * @param v the vertex that is required to be part of the cycle * @return vertices of one cycle that contains v, or null of no cycle exists **/ public LinkedList cycleWithVertex(Graph G, Vertex v) { // TODO return null; } // cycleWithVertex() } // class