Package org.graph4j.hamiltonian
Interface HamiltonianPathAlgorithm
public interface HamiltonianPathAlgorithm
A Hamiltonian path is a path that contains all vertices of the
graph.
- Author:
- Cristian Frăsinaru
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfindPath()findPath(int source, int target) static HamiltonianPathAlgorithmgetInstance(Graph graph)
-
Method Details
-
findPath
Path findPath()- Returns:
- a Hamiltonian path, or
nullif the graph does not contain one or the algorithm is unable to find it.
-
findPath
- Parameters:
source- the first vertex number of the path.target- the last vertex number of the path.- Returns:
- a Hamiltonian path starting in
sourceand ending inpath, ornullif the graph does not contain one or the algorithm is unable to find it.
-
getInstance
- Parameters:
graph- the input graph.- Returns:
- the default implementation of the algorithm.
-