Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. def rotate(path, j):
  2. """
  3. rotate list of vertices at vertex j
  4. :param path: a list of nodes
  5. :param j: vertex to perform rotation at
  6. :return: rotated path
  7. """
  8. if j in path:
  9. i = path.index(j)
  10. newpath = path[:i + 1]
  11. return newpath + list(reversed((path[i + 1:])))
  12. else:
  13. return None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement