SHARE
TWEET

recEuler

Daboposki May 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def recEuler(lista, principio, fin):
  2.     recorrido = [principio]
  3.     return recEulerInm(recorrido, lista, fin)
  4. def recEulerInm(recorrido, lista, fin):
  5.     if fin==recorrido[-1] and len(lista)==0:
  6.         return recorrido
  7.     else:
  8.         i = 0
  9.         while i<len(lista):
  10.             if(recorrido[-1]==lista[i][0] or recorrido[-1]==lista[i][1]):
  11.                 aux = lista[i]
  12.                 lista.remove(aux)
  13.                 if(aux[0]==recorrido[-1]):
  14.                     recorrido.append(aux[1])
  15.                     return recEulerInm(recorrido,lista, fin)
  16.                     recorrido.remove(recorrido[-1])
  17.                 elif (aux[1]==recorrido[-1]):
  18.                     recorrido.append(aux[0])
  19.                     return recEulerInm(recorrido,lista, fin)
  20.                     recorrido.remove(recorrido[-1])
  21.                 lista.insert(i,aux)
  22.             i = i + 1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top