Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rotate(path, j):
- """
- rotate list of vertices at vertex j
- :param path: a list of nodes
- :param j: vertex to perform rotation at
- :return: rotated path
- """
- if j in path:
- i = path.index(j)
- newpath = path[:i + 1]
- return newpath + list(reversed((path[i + 1:])))
- else:
- return None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement