Class HamiltonianCycleAlgorithmBase<V,​E>

    • Constructor Detail

      • HamiltonianCycleAlgorithmBase

        public HamiltonianCycleAlgorithmBase()
    • Method Detail

      • vertexListToTour

        protected GraphPath<V,​E> vertexListToTour​(java.util.List<V> tour,
                                                        Graph<V,​E> graph)
        Transform from a List representation to a graph path.
        Parameters:
        tour - a list containing the vertices of the tour
        graph - the graph
        Returns:
        a graph path
      • edgeSetToTour

        protected GraphPath<V,​E> edgeSetToTour​(java.util.Set<E> tour,
                                                     Graph<V,​E> graph)
        Transform from a Set representation to a graph path.
        Parameters:
        tour - a set containing the edges of the tour
        graph - the graph
        Returns:
        a graph path
      • getSingletonTour

        protected GraphPath<V,​E> getSingletonTour​(Graph<V,​E> graph)
        Creates a tour for a graph with 1 vertex
        Parameters:
        graph - The graph
        Returns:
        A tour with a single vertex
      • checkGraph

        protected void checkGraph​(Graph<V,​E> graph)
        Checks that graph is undirected, complete, and non-empty
        Parameters:
        graph - the graph
        Throws:
        java.lang.IllegalArgumentException - if graph is not undirected
        java.lang.IllegalArgumentException - if graph is not complete
        java.lang.IllegalArgumentException - if graph contains no vertices