Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to extract list of vertices of Hamiltonian path

G = graphs.Grid2dGraph(5,5)
hp=G.hamiltonian_path(algorithm="backtrack")
hp.show()
list(hp)

How do I extract list of vertices from hp as they go along the path. list(hp) seems to output some random list of all vertices (not along the found path).