Advertisement
Guest User

stocking

a guest
Jun 9th, 2011
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. private boolean caminos(Vertice<V> origen, Vertice<V> destino,
  2.         TDALista<Vertice<V>> camino, TDALista<TDALista<Vertice<V>>> caminos) {
  3.     try {
  4.         camino.addLast(origen);
  5.  
  6.         if (origen == destino) {
  7.             return true;
  8.         } else {
  9.             visitados.put(origen, true);
  10.  
  11.             for (Arco<A> a : incidentEdges(origen)) {
  12.                 Vertice<V> w = opposite(origen, a);
  13.                 if (!visitados.get(w)) {
  14.                     boolean encontre = caminos(w, destino, camino, caminos);
  15.                     if (encontre) {
  16.                         TDALista<Vertice<V>> unCamino = new TDALista<Vertice<V>>();
  17.                         for (Vertice<V> v : camino) {
  18.                             unCamino.addLast(v);
  19.                         }
  20.                         caminos.addLast(unCamino);
  21.                     }
  22.                     camino.remove(camino.last());
  23.                 }
  24.             }
  25.  
  26.             visitados.put(origen, false);
  27.         }
  28.     } catch (InvalidKeyException e) {
  29.     } catch (InvalidPositionException e) {
  30.     } catch (EmptyListException e) {
  31.     }
  32.     return false;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement