Class HamiltonianCycleAlgorithmBase<V,E>
java.lang.Object
org.jgrapht.alg.tour.HamiltonianCycleAlgorithmBase<V,E>
- Type Parameters:
V- the graph vertex typeE- the graph edge type
- All Implemented Interfaces:
HamiltonianCycleAlgorithm<V,E>
- Direct Known Subclasses:
ChristofidesThreeHalvesApproxMetricTSP, GreedyHeuristicTSP, HeldKarpTSP, NearestInsertionHeuristicTSP, NearestNeighborHeuristicTSP, PalmerHamiltonianCycle, RandomTourTSP, TwoApproxMetricTSP, TwoOptHeuristicTSP
public abstract class HamiltonianCycleAlgorithmBase<V,E>
extends Object
implements HamiltonianCycleAlgorithm<V,E>
Base class for TSP solver algorithms.
This class provides implementations of utilities for TSP solver classes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckGraph(Graph<V, E> graph) Checks that graph is undirected, complete, and non-emptyTransform from a closed List representation (first and last vertex element are the same) to a graph path.Transform from a Set representation to a graph path.getSingletonTour(Graph<V, E> graph) Creates a tour for a graph with 1 vertexprotected voidrequireNotEmpty(Graph<V, E> graph) Checks that graph is not emptyTransform from a List representation to a graph path.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HamiltonianCycleAlgorithm
getTour
-
Constructor Details
-
HamiltonianCycleAlgorithmBase
public HamiltonianCycleAlgorithmBase()
-
-
Method Details
-
vertexListToTour
-
closedVertexListToTour
-
edgeSetToTour
-
getSingletonTour
-
checkGraph
Checks that graph is undirected, complete, and non-empty- Parameters:
graph- the graph- Throws:
IllegalArgumentException- if graph is not undirectedIllegalArgumentException- if graph is not completeIllegalArgumentException- if graph contains no vertices
-
requireNotEmpty
Checks that graph is not empty- Parameters:
graph- the graph- Throws:
IllegalArgumentException- if graph contains no vertices
-