Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. def is_hamiltonian(path, v, n):
  2. """
  3. :param path: a list nodes in path
  4. :param v: current head
  5. :param n: total number of nodes in the graph
  6. :return: True if it's a hamiltonian path False otherwise
  7. """
  8. if path[0] == v and len(path) == n:
  9. return True
  10. else:
  11. return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement