SlideShare a Scribd company logo
1 of 5
Download to read offline
Algoritmo de Bellman-Ford

        Ejemplo




   Ejemplo
                                   D1k  0
                                   D2 1  min( d 21  D1n , d 23  D3n )  min(1  D1n ,2  D3n )
                                    n

               1
                                   D3n 1  min( d 31  D1n , d 32  D2n )  min( 4  D1n ,1  D2n )
    d31=4            d21=1         D4 1  min( d 45  D5n , d 42  D2n )  min( 4  D5n ,8  D2n )
                                    n



             d32=1                 D5n 1  min( d 53  D3n , d 54  D4n )  min( 2  D3n ,2  D4n )

        3              2
             d23=2
                                         destino
d53=2
                                                           1      2      3      4       5
                           d42=8         origen 
             d54=2                          1              0         
        5              4                    2              1      0 2  
             d45=4                            3           4 1 0  
                                              4            8  0 4
                                              5             2 2 0




                                                                                                       1
D1                D2                           D3                          D4                          D5

                  n        d 21  D1n       d 23  D3n   d31  D1n               n
                                                                          d32  D2           n
                                                                                     d 45  D5                n
                                                                                                      d 42  D2          n
                                                                                                                  d53  D3               n
                                                                                                                                  d54  D4


                  0   0                                                                                                   
        1                    1+0             2+          4+0            1+         4+              8+         2+            2+ 
                  1   0
    4       1                  1                           4                                                                  
        1                    1+0              2+4         4+0             1+1        4+              8+1          2+4           2+ 
3           2     2   0
        2                      1                6           4               2                          9            6             
                             1+0              2+2         4+0             1+1         4+6             8+1          2+2            2+9
2               8 3   0
                               1                4           4               2           10              9            4            11
        2
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+9
5           4     4   0
                               1                4           4               2            8              9            4            11
        4
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+8
                  5   0
                               1                4           4               2            8              9            4            10




                      D1                D2                           D3                          D4                          D5

                  n        d 21  D1n       d 23  D3n   d31  D1n               n
                                                                          d32  D2           n
                                                                                     d 45  D5                n
                                                                                                      d 42  D2          n
                                                                                                                  d53  D3               n
                                                                                                                                  d54  D4


                  0   0                                                                                                   
        1                    1+0             2+          4+0            1+         4+              8+         2+            2+ 
                  1   0
    4       1                  1                           4                                                                  
        1                    1+0              2+4         4+0             1+1        4+              8+1          2+4           2+ 
3           2     2   0
        2                      1                6           4               2                          9            6             
                             1+0              2+2         4+0             1+1         4+6             8+1          2+2            2+9
2               8 3   0
                               1                4           4               2           10              9            4            11
        2
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+9
5           4     4   0
                               1                4           4               2            8              9            4            11
        4
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+8
                  5   0
                               1                4           4               2            8              9            4            10




                                                                                                                                             2
D1                D2                           D3                          D4                          D5

                  n        d 21  D1n       d 23  D3n   d31  D1n               n
                                                                          d32  D2           n
                                                                                     d 45  D5                n
                                                                                                      d 42  D2          n
                                                                                                                  d53  D3               n
                                                                                                                                  d54  D4


                  0   0                                                                                                   
        1                    1+0             2+          4+0            1+         4+              8+         2+            2+ 
                  1   0
    4       1                  1                           4                                                                  
        1                    1+0              2+4         4+0             1+1        4+              8+1          2+4           2+ 
3           2     2   0
        2                      1                6           4               2                          9            6             
                             1+0              2+2         4+0             1+1         4+6             8+1          2+2            2+9
2               8 3   0
                               1                4           4               2           10              9            4            11
        2
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+9
5           4     4   0
                               1                4           4               2            8              9            4            11
        4
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+8
                  5   0
                               1                4           4               2            8              9            4            10




                      D1                D2                           D3                          D4                          D5

                  n        d 21  D1n       d 23  D3n   d31  D1n               n
                                                                          d32  D2           n
                                                                                     d 45  D5                n
                                                                                                      d 42  D2          n
                                                                                                                  d53  D3               n
                                                                                                                                  d54  D4


                  0   0                                                                                                   
        1                    1+0             2+          4+0            1+         4+              8+         2+            2+ 
                  1   0
    4       1                  1                           4                                                                  
        1                    1+0              2+4         4+0             1+1        4+              8+1          2+4           2+ 
3           2     2   0
        2                      1                6           4               2                          9            6             
                             1+0              2+2         4+0             1+1         4+6             8+1          2+2            2+9
2               8 3   0
                               1                4           4               2           10              9            4            11
        2
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+9
5           4     4   0
                               1                4           4               2            8              9            4            11
        4
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+8
                  5   0
                               1                4           4               2            8              9            4            10




                                                                                                                                             3
D1                D2                           D3                          D4                          D5

                  n        d 21  D1n       d 23  D3n   d31  D1n               n
                                                                          d32  D2           n
                                                                                     d 45  D5                n
                                                                                                      d 42  D2          n
                                                                                                                  d53  D3               n
                                                                                                                                  d54  D4


                  0   0                                                                                                   
        1                    1+0             2+          4+0            1+         4+              8+         2+            2+ 
                  1   0
    4       1                  1                           4                                                                  
        1                    1+0              2+4         4+0             1+1        4+              8+1          2+4           2+ 
3           2     2   0
        2                      1                6           4               2                          9            6             
                             1+0              2+2         4+0             1+1         4+6             8+1          2+2            2+9
2               8 3   0
                               1                4           4               2           10              9            4            11
        2
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+9
5           4     4   0
                               1                4           4               2            8              9            4            11
        4
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+8
                  5   0
                               1                4           4               2            8              9            4            10




                      D1                D2                           D3                          D4                          D5

                  n        d 21  D1n       d 23  D3n   d31  D1n               n
                                                                          d32  D2           n
                                                                                     d 45  D5                n
                                                                                                      d 42  D2          n
                                                                                                                  d53  D3               n
                                                                                                                                  d54  D4


                  0   0                                                                                                   
        1                    1+0             2+          4+0            1+         4+              8+         2+            2+ 
                  1   0
    4       1                  1                           4                                                                  
        1                    1+0              2+4         4+0             1+1        4+              8+1          2+4           2+ 
3           2     2   0
        2                      1                6           4               2                          9            6             
                             1+0              2+2         4+0             1+1         4+6             8+1          2+2            2+9
2               8 3   0
                               1                4           4               2           10              9            4            11
        2
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+9
5           4     4   0
                               1                4           4               2            8              9            4            11
        4
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+8
                  5   0
                               1                4           4               2            8              9            4            10




                                                                                                                                             4
D1                D2                           D3                          D4                          D5

                  n        d 21  D1n       d 23  D3n   d31  D1n               n
                                                                          d32  D2           n
                                                                                     d 45  D5                n
                                                                                                      d 42  D2          n
                                                                                                                  d53  D3               n
                                                                                                                                  d54  D4


                  0   0                                                                                                   
        1                    1+0             2+          4+0            1+         4+              8+         2+            2+ 
                  1   0
    4       1                  1                           4                                                                  
        1                    1+0              2+4         4+0             1+1        4+              8+1          2+4           2+ 
3           2     2   0
        2                      1                6           4               2                          9            6             
                             1+0              2+2         4+0             1+1         4+6             8+1          2+2            2+9
2               8 3   0
                               1                4           4               2           10              9            4            11
        2
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+9
5           4     4   0
                               1                4           4               2            8              9            4            11
        4
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+8
                  5   0
                               1                4           4               2            8              9            4            10




                      D1                D2                           D3                          D4                          D5

                  n        d 21  D1n       d 23  D3n   d31  D1n               n
                                                                          d32  D2           n
                                                                                     d 45  D5                n
                                                                                                      d 42  D2          n
                                                                                                                  d53  D3               n
                                                                                                                                  d54  D4


                  0   0                                                                                                   
        1                    1+0             2+          4+0            1+         4+              8+         2+            2+ 
                  1   0
            1                  1                           4                                                                  
        1                    1+0              2+4         4+0             1+1        4+              8+1          2+4           2+ 
3           2     2   0
                               1                6           4               2                          9            6             
                             1+0              2+2         4+0             1+1         4+6             8+1          2+2            2+9
2                 3   0
                               1                4           4               2           10              9            4            11
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+9
5           4     4   0
                               1                4           4               2            8              9            4            11
        4
                             1+0              2+2         4+0             1+1         4+4             8+1          2+2            2+8
                  5   0
                               1                4           4               2            8              9            4            10




                                                                                                                                             5

More Related Content

Viewers also liked

Formato Sena EspañOl E Ingles
Formato Sena EspañOl E InglesFormato Sena EspañOl E Ingles
Formato Sena EspañOl E Inglesguestd34ebd44
 
Gilad Sasson - How to Build Links to a non existing site or service, Sphincon...
Gilad Sasson - How to Build Links to a non existing site or service, Sphincon...Gilad Sasson - How to Build Links to a non existing site or service, Sphincon...
Gilad Sasson - How to Build Links to a non existing site or service, Sphincon...Gilad Sasson
 
Ancient Indus
Ancient IndusAncient Indus
Ancient IndusEthan
 
Foro romano
Foro romanoForo romano
Foro romanomfierro1
 
ROCK THIS CITY 1 - PTR. ALVIN GUTIERREZ - 10AM MORNING SERVICE
ROCK THIS CITY 1 - PTR. ALVIN GUTIERREZ - 10AM MORNING SERVICEROCK THIS CITY 1 - PTR. ALVIN GUTIERREZ - 10AM MORNING SERVICE
ROCK THIS CITY 1 - PTR. ALVIN GUTIERREZ - 10AM MORNING SERVICEFaithworks Christian Church
 
Forever kingdom-group
Forever kingdom-groupForever kingdom-group
Forever kingdom-groupjimlarsen
 
Utopia presentation
Utopia presentationUtopia presentation
Utopia presentationsmito113
 
Reclaiming the Gospel of Peace gathering slides
Reclaiming the Gospel of Peace gathering slidesReclaiming the Gospel of Peace gathering slides
Reclaiming the Gospel of Peace gathering slidesYourMediaDirector
 

Viewers also liked (16)

El cuervo
El cuervoEl cuervo
El cuervo
 
Evaluation q2
Evaluation q2Evaluation q2
Evaluation q2
 
Formato Sena EspañOl E Ingles
Formato Sena EspañOl E InglesFormato Sena EspañOl E Ingles
Formato Sena EspañOl E Ingles
 
Gilad Sasson - How to Build Links to a non existing site or service, Sphincon...
Gilad Sasson - How to Build Links to a non existing site or service, Sphincon...Gilad Sasson - How to Build Links to a non existing site or service, Sphincon...
Gilad Sasson - How to Build Links to a non existing site or service, Sphincon...
 
Ancient Indus
Ancient IndusAncient Indus
Ancient Indus
 
Comunicação 07 12-13
Comunicação 07 12-13Comunicação 07 12-13
Comunicação 07 12-13
 
Foro romano
Foro romanoForo romano
Foro romano
 
ROCK THIS CITY 1 - PTR. ALVIN GUTIERREZ - 10AM MORNING SERVICE
ROCK THIS CITY 1 - PTR. ALVIN GUTIERREZ - 10AM MORNING SERVICEROCK THIS CITY 1 - PTR. ALVIN GUTIERREZ - 10AM MORNING SERVICE
ROCK THIS CITY 1 - PTR. ALVIN GUTIERREZ - 10AM MORNING SERVICE
 
Genesis nollywood services slide
Genesis nollywood services slideGenesis nollywood services slide
Genesis nollywood services slide
 
Forever kingdom-group
Forever kingdom-groupForever kingdom-group
Forever kingdom-group
 
Spiritual aaptvani 09 03 pg 89 to 170
Spiritual aaptvani 09 03 pg 89 to 170Spiritual aaptvani 09 03 pg 89 to 170
Spiritual aaptvani 09 03 pg 89 to 170
 
Health Start Game Rules
Health Start Game RulesHealth Start Game Rules
Health Start Game Rules
 
Utopia presentation
Utopia presentationUtopia presentation
Utopia presentation
 
Reclaiming the Gospel of Peace gathering slides
Reclaiming the Gospel of Peace gathering slidesReclaiming the Gospel of Peace gathering slides
Reclaiming the Gospel of Peace gathering slides
 
Eli
EliEli
Eli
 
Women of Wisdom Book: TOC
Women of Wisdom Book: TOCWomen of Wisdom Book: TOC
Women of Wisdom Book: TOC
 

More from grupo6tic

More from grupo6tic (20)

Huffman 2
Huffman 2Huffman 2
Huffman 2
 
Ejemplo+Huffman
Ejemplo+HuffmanEjemplo+Huffman
Ejemplo+Huffman
 
Grafos+2+Parte 2
Grafos+2+Parte 2Grafos+2+Parte 2
Grafos+2+Parte 2
 
Bellman Ford1
Bellman Ford1Bellman Ford1
Bellman Ford1
 
Bellman Ford
Bellman FordBellman Ford
Bellman Ford
 
Automata3
Automata3Automata3
Automata3
 
Automata2
Automata2Automata2
Automata2
 
Flyd+Warshall
Flyd+WarshallFlyd+Warshall
Flyd+Warshall
 
Bellman Ford1
Bellman Ford1Bellman Ford1
Bellman Ford1
 
Bellman Ford1
Bellman Ford1Bellman Ford1
Bellman Ford1
 
Bellman Ford1
Bellman Ford1Bellman Ford1
Bellman Ford1
 
Bellman Ford1
Bellman Ford1Bellman Ford1
Bellman Ford1
 
Bellman Ford1
Bellman Ford1Bellman Ford1
Bellman Ford1
 
Automata2
Automata2Automata2
Automata2
 
Bellman Ford
Bellman FordBellman Ford
Bellman Ford
 
Automata3
Automata3Automata3
Automata3
 
Automata3
Automata3Automata3
Automata3
 
Automata2
Automata2Automata2
Automata2
 
Automata3
Automata3Automata3
Automata3
 
Automata2
Automata2Automata2
Automata2
 

Bellman Ford1

  • 1. Algoritmo de Bellman-Ford Ejemplo Ejemplo D1k  0 D2 1  min( d 21  D1n , d 23  D3n )  min(1  D1n ,2  D3n ) n 1 D3n 1  min( d 31  D1n , d 32  D2n )  min( 4  D1n ,1  D2n ) d31=4 d21=1 D4 1  min( d 45  D5n , d 42  D2n )  min( 4  D5n ,8  D2n ) n d32=1 D5n 1  min( d 53  D3n , d 54  D4n )  min( 2  D3n ,2  D4n ) 3 2 d23=2 destino d53=2 1 2 3 4 5 d42=8 origen d54=2 1 0     5 4 2 1 0 2   d45=4 3 4 1 0   4  8  0 4 5   2 2 0 1
  • 2. D1 D2 D3 D4 D5 n d 21  D1n d 23  D3n d31  D1n n d32  D2 n d 45  D5 n d 42  D2 n d53  D3 n d54  D4 0 0     1 1+0 2+ 4+0 1+  4+  8+  2+  2+  1 0 4 1 1  4      1 1+0 2+4 4+0 1+1 4+  8+1 2+4 2+  3 2 2 0 2 1 6 4 2  9 6  1+0 2+2 4+0 1+1 4+6 8+1 2+2 2+9 2 8 3 0 1 4 4 2 10 9 4 11 2 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+9 5 4 4 0 1 4 4 2 8 9 4 11 4 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+8 5 0 1 4 4 2 8 9 4 10 D1 D2 D3 D4 D5 n d 21  D1n d 23  D3n d31  D1n n d32  D2 n d 45  D5 n d 42  D2 n d53  D3 n d54  D4 0 0     1 1+0 2+ 4+0 1+  4+  8+  2+  2+  1 0 4 1 1  4      1 1+0 2+4 4+0 1+1 4+  8+1 2+4 2+  3 2 2 0 2 1 6 4 2  9 6  1+0 2+2 4+0 1+1 4+6 8+1 2+2 2+9 2 8 3 0 1 4 4 2 10 9 4 11 2 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+9 5 4 4 0 1 4 4 2 8 9 4 11 4 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+8 5 0 1 4 4 2 8 9 4 10 2
  • 3. D1 D2 D3 D4 D5 n d 21  D1n d 23  D3n d31  D1n n d32  D2 n d 45  D5 n d 42  D2 n d53  D3 n d54  D4 0 0     1 1+0 2+ 4+0 1+  4+  8+  2+  2+  1 0 4 1 1  4      1 1+0 2+4 4+0 1+1 4+  8+1 2+4 2+  3 2 2 0 2 1 6 4 2  9 6  1+0 2+2 4+0 1+1 4+6 8+1 2+2 2+9 2 8 3 0 1 4 4 2 10 9 4 11 2 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+9 5 4 4 0 1 4 4 2 8 9 4 11 4 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+8 5 0 1 4 4 2 8 9 4 10 D1 D2 D3 D4 D5 n d 21  D1n d 23  D3n d31  D1n n d32  D2 n d 45  D5 n d 42  D2 n d53  D3 n d54  D4 0 0     1 1+0 2+ 4+0 1+  4+  8+  2+  2+  1 0 4 1 1  4      1 1+0 2+4 4+0 1+1 4+  8+1 2+4 2+  3 2 2 0 2 1 6 4 2  9 6  1+0 2+2 4+0 1+1 4+6 8+1 2+2 2+9 2 8 3 0 1 4 4 2 10 9 4 11 2 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+9 5 4 4 0 1 4 4 2 8 9 4 11 4 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+8 5 0 1 4 4 2 8 9 4 10 3
  • 4. D1 D2 D3 D4 D5 n d 21  D1n d 23  D3n d31  D1n n d32  D2 n d 45  D5 n d 42  D2 n d53  D3 n d54  D4 0 0     1 1+0 2+ 4+0 1+  4+  8+  2+  2+  1 0 4 1 1  4      1 1+0 2+4 4+0 1+1 4+  8+1 2+4 2+  3 2 2 0 2 1 6 4 2  9 6  1+0 2+2 4+0 1+1 4+6 8+1 2+2 2+9 2 8 3 0 1 4 4 2 10 9 4 11 2 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+9 5 4 4 0 1 4 4 2 8 9 4 11 4 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+8 5 0 1 4 4 2 8 9 4 10 D1 D2 D3 D4 D5 n d 21  D1n d 23  D3n d31  D1n n d32  D2 n d 45  D5 n d 42  D2 n d53  D3 n d54  D4 0 0     1 1+0 2+ 4+0 1+  4+  8+  2+  2+  1 0 4 1 1  4      1 1+0 2+4 4+0 1+1 4+  8+1 2+4 2+  3 2 2 0 2 1 6 4 2  9 6  1+0 2+2 4+0 1+1 4+6 8+1 2+2 2+9 2 8 3 0 1 4 4 2 10 9 4 11 2 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+9 5 4 4 0 1 4 4 2 8 9 4 11 4 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+8 5 0 1 4 4 2 8 9 4 10 4
  • 5. D1 D2 D3 D4 D5 n d 21  D1n d 23  D3n d31  D1n n d32  D2 n d 45  D5 n d 42  D2 n d53  D3 n d54  D4 0 0     1 1+0 2+ 4+0 1+  4+  8+  2+  2+  1 0 4 1 1  4      1 1+0 2+4 4+0 1+1 4+  8+1 2+4 2+  3 2 2 0 2 1 6 4 2  9 6  1+0 2+2 4+0 1+1 4+6 8+1 2+2 2+9 2 8 3 0 1 4 4 2 10 9 4 11 2 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+9 5 4 4 0 1 4 4 2 8 9 4 11 4 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+8 5 0 1 4 4 2 8 9 4 10 D1 D2 D3 D4 D5 n d 21  D1n d 23  D3n d31  D1n n d32  D2 n d 45  D5 n d 42  D2 n d53  D3 n d54  D4 0 0     1 1+0 2+ 4+0 1+  4+  8+  2+  2+  1 0 1 1  4      1 1+0 2+4 4+0 1+1 4+  8+1 2+4 2+  3 2 2 0 1 6 4 2  9 6  1+0 2+2 4+0 1+1 4+6 8+1 2+2 2+9 2 3 0 1 4 4 2 10 9 4 11 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+9 5 4 4 0 1 4 4 2 8 9 4 11 4 1+0 2+2 4+0 1+1 4+4 8+1 2+2 2+8 5 0 1 4 4 2 8 9 4 10 5