new_path = []
i = 0
while True:
    elem = path[i]
new_path.append(elem)
if i + 1 == len(path):
    break
j = len(path) - 1
while True:
    future_elem = path[j]
if adjacent(elem, future_elem):
    break
j -= 1
i = j
print(new_path)
Shorten a list of tuples by cutting out loops?