Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_hamiltonian(path, v, n):
- """
- :param path: a list nodes in path
- :param v: current head
- :param n: total number of nodes in the graph
- :return: True if it's a hamiltonian path False otherwise
- """
- if path[0] == v and len(path) == n:
- return True
- else:
- return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement