I have a SimpleGraph
in JGraphT and want to know if there is
a Hamiltonian path
a Hamiltonian cycle
And if one exists I'd also like to get it.
I only found TwoApproxMetricTSP
and HamiltonianCycle
.
But both require complete graphs.
One obvious solution is to add edges to my graph and make it a weighted graph with the weight of the added edges so high that they won't get used in the path.
But that would add lots of edges, which I'd like to avoid.
Is there a better way to get a Hamiltonian path/cycle without implementing an algorithm on my own?