Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private boolean caminos(Vertice<V> origen, Vertice<V> destino,
- TDALista<Vertice<V>> camino, TDALista<TDALista<Vertice<V>>> caminos) {
- try {
- camino.addLast(origen);
- if (origen == destino) {
- return true;
- } else {
- visitados.put(origen, true);
- for (Arco<A> a : incidentEdges(origen)) {
- Vertice<V> w = opposite(origen, a);
- if (!visitados.get(w)) {
- boolean encontre = caminos(w, destino, camino, caminos);
- if (encontre) {
- TDALista<Vertice<V>> unCamino = new TDALista<Vertice<V>>();
- for (Vertice<V> v : camino) {
- unCamino.addLast(v);
- }
- caminos.addLast(unCamino);
- }
- camino.remove(camino.last());
- }
- }
- visitados.put(origen, false);
- }
- } catch (InvalidKeyException e) {
- } catch (InvalidPositionException e) {
- } catch (EmptyListException e) {
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement