11.07.2015 Views

Tema 3 – Algoritmos de encaminamiento

Tema 3 – Algoritmos de encaminamiento

Tema 3 – Algoritmos de encaminamiento

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Re<strong>de</strong>s <strong>–</strong> <strong>Tema</strong> 3: <strong>Algoritmos</strong> <strong>de</strong> <strong>encaminamiento</strong>Algoritmo <strong>de</strong> Floyd WarshallINITIALIZATION1. for all (u,v) in NxN2. d(u,v) = ∞3. pred(u,v) = NIL4. for all no<strong>de</strong>s u in N5. d(u,u) = 06. for each (u,v) in E7. d(u,v) = c(u,v)8. pred(u,v) = uMAIN LOOP9. for k = 1 to N10. for u = 1 to N11. for v = 1 to N12. if d(u,v) > d(u,k) + d(k,v)13. d(u,v) = d(u,k) + d(k,v)14. pred(u,v) = pred(k,v)Ramón Agüero Calvo30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!