SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Resolución   BUENO CALDERON JORGE EDUARDO
             GONZÁLEZ IÑIGUEZ OCTAVIO

ejemplo 2    JEREZ DE LA CRUZ RICARDO
Enunciado
•   Una compañía de turismo transporta a personas a través de 7
    destinos turísticos, la compañía desea poder agilizar el tiempo
    de transporte y minimizar el gasto de gasolina, se muestra la
    red de carreteras para llegar a
    cada destino, calcular la ruta
    mas corta entre cada par de
    destinos turísticos.
Red
Creación de matrices
• La red la pasamos a una matriz C colocando infinitos donde no
  existe una conexión y ceros en los puntos donde i=j y una matriz Z
  formada por los nodos antecesores de J en la ruta de i a J, ambas
  de N X N
                     0 ∞ 1 2 ∞ ∞ ∞                1 1 1 1 1 1 1
                     3 0 1 ∞ 5 ∞ ∞                2 2 2 2 2 2 2
                     ∞ ∞ 0 ∞ 4 ∞ ∞                3 3 3 3 3 3 3
                     ∞ ∞ 1 0 ∞ ∞ ∞                4 4 4 4 4 4 4
             C =                            Z =
                     ∞ ∞ ∞ 2 0 2 1                5 5 5 5 5 5 5
                     ∞ 2 ∞ ∞ ∞ 0 3                6 6 6 6 6 6 6
                     ∞ ∞ ∞ 1 ∞ ∞ 0                7 7 7 7 7 7 7
Primera iteración K=1
De la tabla C se escoge la fila y la columna k la cual marcaremos para
   sacar los valores de i y de j
Elegimos la posición de los números de la columna k diferentes de ∞ y
   que no estén en la diagonal principal como i y lo números de la fila k
   como j
                                                      0 ∞ 1 2 ∞ ∞ ∞
i= 2 , 3       j= 2
                                                        3 0 1 ∞ 5 ∞ ∞
Después se crea la combinación de las Cij para así
buscar que:                                             ∞ ∞ 0 ∞ 4 ∞ ∞
Cij = Min{Cij , Cik + Cij} y en dado caso de haber un   ∞ ∞ 1 0 ∞ ∞ ∞
cambio en Cij también deberá cambiarse la matriz Z
                                                        ∞ ∞ ∞ 2 0 2 1
como: Zij = Zkj
                                                        ∞ 2 ∞ ∞ ∞ 0 3
                                                        ∞ ∞ ∞ 1 ∞ ∞ 0
Primer iteración K=1
               continuación…..
C23 = min{1 , 3+1=4} = 0
C24 = min{∞ , 3+2=5} = 5 → Z24 = Z14 = 1
hubo cambios en C24 por lo tanto hay que actualizar la tabla

                      0 ∞ 1 2 ∞ ∞ ∞               1 1 1 1 1 1 1
                      3 0 1 5 5 ∞ ∞               2 2 2 1 2 2 2
                      ∞ ∞ 0 ∞ 4 ∞ ∞               3 3 3 3 3 3 3
                      ∞ ∞ 1 0 ∞ ∞ ∞               4 4 4 4 4 4 4
                      ∞ ∞ ∞ 2 0 2 1               5 5 5 5 5 5 5
                      ∞ 2 ∞ ∞ ∞ 0 3               6 6 6 6 6 6 6
                      ∞ ∞ ∞ 1 ∞ ∞ 0               7 7 7 7 7 7 7
Segunda iteración k=2
i=6           j= 1 , 3 , 4 , 5
                                                 0 ∞ 1 2 ∞ ∞ ∞
C61 = min{∞ , 2+3=5} = 5 →       Z61 = Z21 = 2
                                                 3 0 1 5 5 ∞ ∞
C63 = min{∞ , 2+1=3} = 3 →       Z63 = Z23 = 2
                                                 ∞ ∞ 0 ∞ 4 ∞ ∞
C64 = min{∞ , 2+5=7} = 7 →       Z64 = Z24 = 1
                                                 ∞ ∞ 1 0 ∞ ∞ ∞
C65 = min{∞ , 2+5=7} = 7 →       Z65 = Z25 = 2
                                                 ∞ ∞ ∞ 2 0 2 1

Hubo cambios en C61 , C63 , C64 , C65 por lo tanto ∞ 2 ∞ ∞ ∞ 0 3
                                                   ∞ ∞ ∞ 1 ∞ ∞ 0
Hay que actualizar la tabla
Segunda iteración K=2
           continuación….
      0 ∞ 1 2 ∞ ∞ ∞            1 1 1 1 1 1 1
      3 0 1 5 5 ∞ ∞            2 2 2 1 2 2 2
      ∞ ∞ 0 ∞ 4 ∞ ∞            3 3 3 3 3 3 3
      ∞ ∞ 1 0 ∞ ∞ ∞            4 4 4 4 4 4 4
      ∞ ∞ ∞ 2 0 2 1            5 5 5 5 5 5 5
      5 2 3 7 7 0 3            2 6 2 1 2 6 6
      ∞ ∞ ∞ 1 ∞ ∞ 0            7 7 7 7 7 7 7

                 después de actualizar las tablas pasamos a

k=3
Tercera iteración k=3
i=1,2,4,6              j= 5                     0 ∞ 1 2 ∞ ∞ ∞
C15 = min{∞ , 1+4=5} = 5 →     Z15 = Z35 = 3    3 0 1 5 5 ∞ ∞
C25 = min{5 , 1+4=5} = 5                        ∞ ∞ 0 ∞ 4 ∞ ∞
C45 = min{∞ , 1+4=5} = 5 →     Z45 = Z35 = 3    ∞ ∞ 1 0 ∞ ∞ ∞
C65 = min{7 , 3+4=7} = 7                        ∞ ∞ ∞ 2 0 2 1
                                                5 2 3 7 7 0 3
Hay cambios en C15 y C45 por lo tanto hay que   ∞ ∞ ∞ 1 ∞ ∞ 0
Actualizar la s tablas
Tercera iteración K=3
    continuación…..
0 ∞ 1 2 5 ∞ ∞                   1 1 1 1 3 1 1
3 0 1 5 5 ∞ ∞                   2 2 2 1 2 2 2
∞ ∞ 0 ∞ 4 ∞ ∞                   3 3 3 3 3 3 3
∞ ∞ 1 0 5 ∞ ∞                   4 4 4 4 3 4 4
∞ ∞ ∞ 2 0 2 1                   5 5 5 5 5 5 5
5 2 3 7 7 0 3                   2 6 2 1 2 6 6
∞ ∞ ∞ 1 ∞ ∞ 0                   7 7 7 7 7 7 7

  después de actualizar las tablas pasamos a k=4
Cuarta iteración k=4
i=1,2,5,6,7               j= 3 , 5
C13 = min{1 , 2+1=3} = 1                             0 ∞ 1 2 5 ∞       ∞
C15 = min{5 , 2+5=7} = 5                             3 0 1 5 5 ∞       ∞
C23 = min{1 , 5+1=6} = 1                             ∞ ∞ 0 ∞ 4 ∞       ∞
C25 = min{5 , 5+5=10} =5                             ∞ ∞ 1 0 5 ∞       ∞
C53 = min{∞ , 2+1=3} = 3 → Z53 = Z43 = 4             ∞ ∞ ∞ 2 0 2       1
C55 = min{0 , 2+5=7} = 0                             5 2 3 7 7 0       3
C63 = min{3 , 7+1=8} = 3                             ∞ ∞ ∞ 1 ∞ ∞       0
C65 = min{7 , 7+5=12} = 7
                     C73 = min{∞ , 1+1=2} = 2 → Z73 = Z43 = 4
                     C75 = min{∞ , 1+5=6} = 6 → Z75 = Z45 = 4
•                        hay cambios en C53 , C73 y C75 por lo tanto
                         hay que actualizar la tabla
Cuarta iteración K=4
     continuación…..
0 ∞ 1 2 5 ∞ ∞                  1 1 1 1 3 1 1
3 0 1 5 5 ∞ ∞                  2 2 2 1 2 2 2
∞ ∞ 0 ∞ 4 ∞ ∞                  3 3 3 3 3 3 3
∞ ∞ 1 0 5 ∞ ∞                  4 4 4 4 3 4 4
∞ ∞ 3 2 0 2 1                  5 5 4 5 5 5 5
5 2 3 7 7 0 3                  2 6 2 1 2 6 6
∞ ∞ 2 1 6 ∞ 0                  7 7 4 7 4 7 7
     después de actualizar las tablas pasamos a k=5
Quinta iteración K=5
i=1,2,3,4,6,7              j= 3 , 4 , 6 , 7
                                               0 ∞ 1 2 5 ∞ ∞
C13 = min{1 , 5+3=8} = 1
                                               3 0 1 5 5 ∞ ∞
C14 = min{2 , 5+2=7} = 2
                                               ∞ ∞ 0 ∞ 4 ∞ ∞
C16 = min{∞ , 5+2=7} = 7   →   Z16 = Z56 = 5
                                               ∞ ∞ 1 0 5 ∞ ∞
C17 = min{∞ , 5+1=6} = 6   →   Z17 = Z56 = 5
                                               ∞ ∞ 3 2 0 2 1
C23 = min{1 , 5+3=8} = 1
                                               5 2 3 7 7 0 3
C24 = min{5 , 5+2=7} = 5
                                               ∞ ∞ 2 1 6 ∞ 0
C26 = min{∞ , 5+2=7} = 7   →   Z26 = Z56 = 5
C27 = min{∞ , 5+1=6} = 7   →   Z27 = Z57 = 5
C33 = min{0 , 4+3=7} = 0
Quinta iteración K=5
C34
                 continuación…..
   = min{∞ , 4+2=6} = 6 → Z = Z = 5
                                 34    54

C36 = min{∞ , 4+2=6} = 6    →   Z36 = Z56 = 5
C37 = min{∞ , 4+1=5} = 5    →   Z37 = Z57 = 5
C43 = min{1 , 5+3=8} = 1
C44 = min{0 , 5+2=7} = 0
C46 = min{∞ , 5+2=7} = 7    →   Z46 = Z56 = 5
C47 = min{∞ , 5+1=6} = 6    →   Z47 = Z57 = 5
C63 = min{3 , 7+3=10} = 3
C64 = min{7 , 7+2=9} = 7
C66 = min{0 , 7+2=9} = 0
Quinta iteración k=5
              continuación…..
C67 = min{3 , 7+1=6} = 3
C73 = min{2 , 6+3=9} = 2
C74 = min{1 , 6+2=8} = 1
C76 = min{∞ , 6+2=8} = 8   →   Z76 = Z56 = 5
C77 = min{0 , 6+1=7} = 0

Hay cambios en C16 , C17 , C26 , C27 , C34 , C36 ,
               C37 , C46 , C47 y C76 por lo tanto hay que actualizar
  las tablas
Quinta iteración K=5
              continuación…..
     0 ∞ 1 2 5 7 6                      1 1 1 1 3 5 5
     3 0 1 5 5 7 7                      2 2 2 1 2 5 5
    ∞ ∞ 0 6 4 6 5                       3 3 3 5 3 5 5
    ∞ ∞ 1 0 5 7 6                       4 4 4 4 3 5 5
    ∞ ∞ 3 2 0 2 1                       5 5 4 5 5 5 5
     5 2 3 7 7 0 3                      2 6 2 1 2 6 6
    ∞ ∞ 2 1 6 8 0                       7 7 4 7 4 5 7
Después de actualizar las tablas pasamos a k=6
Sexta iteración K=6
i=1,2,3,4,5,7          j=1,2,3,4,5,7
                                                      0 ∞ 1 2 5 7 6
C12 = min{∞ , 7+2=9} = 3 → Z12 = Z62 = 6
                                                      3 0 1 5 5 7 7
C31 = min{∞ , 6+5=11} = 11 → Z31 = Z61 = 2
                                                      ∞ ∞ 0 6 4 6 5
C32 = min{∞ , 6+2=8} = 8 → Z32 = Z62 = 6
                                                      ∞ ∞ 1 0 5 7 6
C41 = min{∞ , 7+5=12} = 12 → Z41 = Z61 = 2
                                                      ∞ ∞ 3 2 0 2 1
C42 = min{∞ , 7+2=9} = 9 → Z42 = Z62 = 6
                                                      5 2 3 7 7 0 3
C51 = min{∞ , 2+5=7} = 7 → Z51 = Z61 = 2
                                                      ∞ ∞ 2 1 6 8 0
C52 = min{∞ , 2+2=4} = 4 → Z52 = Z62 = 6
C71 = min{∞ , 8+5=13} = 13 → Z71 = Z61 = 2
C72 = min{∞ , 8+2=10} = 10 → Z72 = Z62 = 6
                      por cuestiones de lo grande
                       del ejercicio solo se pondrá
                       los Cij que cambian en la
                        tabla
Sexta iteración k=6
                  continuación…..
        0    3    1   2   5   7   6          1 6 1 1 3 5 5
        3    0    1   5   5   7   7          2 2 2 1 2 5 5
        11   8    0   6   4   6   5          2 6 3 5 3 5 5
        12   9    1   0   5   7   6          2 6 4 4 3 5 5
        7    4    3   2   0   2   1          2 6 4 5 5 5 5
        5    2    3   7   7   0   3          2 6 2 1 2 6 6
        13 10     2   1   6   8   0          2 6 4 7 4 5 7

Después de actualizar las tablas vamos con k=7
Ultima iteración K=7
I = 1, 2, 3, 4, 5, 6       j= 1, 2, 3, 4, 5, 6
                                                 0    3   1   2   5   7   6
C64 = min{7 , 3+1=4} = 4 → Z64 = Z74 = 7
                                                 3    0   1   5   5   7   7
Igual que en la iteración pasada solo se
                                                 11   8   0   6   4   6   5
pondrán los Cij que cambian debido
                                                 12   9   1   0   5   7   6
a lo grande del problema
                                                 7    4   3   2   0   2   1
                                                 5    2   3   7   7   0   3
                                                 13 10    2   1   6   8   0
Tablas actualizadas e
                  interpretación
      0    3   1    2    5   7    6                 1   6   1    1   3   5    5
      3    0   1    5    5   7    7                 2   2   2    1   2   5    5
      11   8   0    6    4   6    5                 2   6   3    5   3   5    5
C = 12 9       1    0    5   7    6          Z=     2   6   4    4   3   5    5
      7    4   3    2    0   2    1                 2   6   4    5   5   5    5
      5    2   3    4    7   0    3                 2   6   2    7   2   6    6
     13 10 2 1 6 8 0                                2 6 4 7 4 5 7
Ejemplo de aplicación saber cual es la ruta mas corta del destino turístico 1 al
   destino turístico 6:
Elegimos en la matriz Z el dato(1,6), es 5 por lo tanto el destino anterior a 6 es
                        5, después escogemos el (1,5), es 3 por lo tanto el
                         destino anterior es 3, ahora escogemos el (1,3), es 1
                         por lo tanto ya hemos llegado
                             y en la matriz C escogemos el dato (1,6) es la
                            distancia total 7
                              1→3→5→6
Referencias
•   Imagenes
•   "Ranking De Latinoamérica: México, Brasil Y Dominicana Lideran La
    Recepción De turistas." Invertir En Dominicana's Blog. N.p., n.d. Web.
    13 Oct. 2012.
    http://invertirend.wordpress.com/2012/05/17/ranking-de-latinoamerica-mexic
•   Pagina de subida de presentacion
•   "Comercialice Mejor Su Contenido Con Las Caracteristicas PRO."
    Cargar Y Compartir Presentaciones En Powerpoint Y Documentos.
    N.p., n.d. Web. 08 Oct. 2012. http://es.slideshare.net/

•   Software de grafos
•   "Software – Grafos - Software Para La Construccion, Edicion Y
    Analisis De Grafos." Software – Grafos. N.p., n.d. Web. 08 Oct. 2012.
    <http://arodrigu.webs.upv.es/grafos/doku.php?id=software>.
Agradecimientos
Creadores:
Bueno Calderón Jorge Eduardo
González Iñiguez Octavio
Jerez de la Cruz Ricardo

Profesora:
Guadalupe del Carmen Rodríguez Moreno

Weitere ähnliche Inhalte

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Ejemplo 2 de floyd warshall

  • 1. Resolución BUENO CALDERON JORGE EDUARDO GONZÁLEZ IÑIGUEZ OCTAVIO ejemplo 2 JEREZ DE LA CRUZ RICARDO
  • 2. Enunciado • Una compañía de turismo transporta a personas a través de 7 destinos turísticos, la compañía desea poder agilizar el tiempo de transporte y minimizar el gasto de gasolina, se muestra la red de carreteras para llegar a cada destino, calcular la ruta mas corta entre cada par de destinos turísticos.
  • 3. Red
  • 4. Creación de matrices • La red la pasamos a una matriz C colocando infinitos donde no existe una conexión y ceros en los puntos donde i=j y una matriz Z formada por los nodos antecesores de J en la ruta de i a J, ambas de N X N 0 ∞ 1 2 ∞ ∞ ∞ 1 1 1 1 1 1 1 3 0 1 ∞ 5 ∞ ∞ 2 2 2 2 2 2 2 ∞ ∞ 0 ∞ 4 ∞ ∞ 3 3 3 3 3 3 3 ∞ ∞ 1 0 ∞ ∞ ∞ 4 4 4 4 4 4 4 C = Z = ∞ ∞ ∞ 2 0 2 1 5 5 5 5 5 5 5 ∞ 2 ∞ ∞ ∞ 0 3 6 6 6 6 6 6 6 ∞ ∞ ∞ 1 ∞ ∞ 0 7 7 7 7 7 7 7
  • 5. Primera iteración K=1 De la tabla C se escoge la fila y la columna k la cual marcaremos para sacar los valores de i y de j Elegimos la posición de los números de la columna k diferentes de ∞ y que no estén en la diagonal principal como i y lo números de la fila k como j 0 ∞ 1 2 ∞ ∞ ∞ i= 2 , 3 j= 2 3 0 1 ∞ 5 ∞ ∞ Después se crea la combinación de las Cij para así buscar que: ∞ ∞ 0 ∞ 4 ∞ ∞ Cij = Min{Cij , Cik + Cij} y en dado caso de haber un ∞ ∞ 1 0 ∞ ∞ ∞ cambio en Cij también deberá cambiarse la matriz Z ∞ ∞ ∞ 2 0 2 1 como: Zij = Zkj ∞ 2 ∞ ∞ ∞ 0 3 ∞ ∞ ∞ 1 ∞ ∞ 0
  • 6. Primer iteración K=1 continuación….. C23 = min{1 , 3+1=4} = 0 C24 = min{∞ , 3+2=5} = 5 → Z24 = Z14 = 1 hubo cambios en C24 por lo tanto hay que actualizar la tabla 0 ∞ 1 2 ∞ ∞ ∞ 1 1 1 1 1 1 1 3 0 1 5 5 ∞ ∞ 2 2 2 1 2 2 2 ∞ ∞ 0 ∞ 4 ∞ ∞ 3 3 3 3 3 3 3 ∞ ∞ 1 0 ∞ ∞ ∞ 4 4 4 4 4 4 4 ∞ ∞ ∞ 2 0 2 1 5 5 5 5 5 5 5 ∞ 2 ∞ ∞ ∞ 0 3 6 6 6 6 6 6 6 ∞ ∞ ∞ 1 ∞ ∞ 0 7 7 7 7 7 7 7
  • 7. Segunda iteración k=2 i=6 j= 1 , 3 , 4 , 5 0 ∞ 1 2 ∞ ∞ ∞ C61 = min{∞ , 2+3=5} = 5 → Z61 = Z21 = 2 3 0 1 5 5 ∞ ∞ C63 = min{∞ , 2+1=3} = 3 → Z63 = Z23 = 2 ∞ ∞ 0 ∞ 4 ∞ ∞ C64 = min{∞ , 2+5=7} = 7 → Z64 = Z24 = 1 ∞ ∞ 1 0 ∞ ∞ ∞ C65 = min{∞ , 2+5=7} = 7 → Z65 = Z25 = 2 ∞ ∞ ∞ 2 0 2 1 Hubo cambios en C61 , C63 , C64 , C65 por lo tanto ∞ 2 ∞ ∞ ∞ 0 3 ∞ ∞ ∞ 1 ∞ ∞ 0 Hay que actualizar la tabla
  • 8. Segunda iteración K=2 continuación…. 0 ∞ 1 2 ∞ ∞ ∞ 1 1 1 1 1 1 1 3 0 1 5 5 ∞ ∞ 2 2 2 1 2 2 2 ∞ ∞ 0 ∞ 4 ∞ ∞ 3 3 3 3 3 3 3 ∞ ∞ 1 0 ∞ ∞ ∞ 4 4 4 4 4 4 4 ∞ ∞ ∞ 2 0 2 1 5 5 5 5 5 5 5 5 2 3 7 7 0 3 2 6 2 1 2 6 6 ∞ ∞ ∞ 1 ∞ ∞ 0 7 7 7 7 7 7 7 después de actualizar las tablas pasamos a k=3
  • 9. Tercera iteración k=3 i=1,2,4,6 j= 5 0 ∞ 1 2 ∞ ∞ ∞ C15 = min{∞ , 1+4=5} = 5 → Z15 = Z35 = 3 3 0 1 5 5 ∞ ∞ C25 = min{5 , 1+4=5} = 5 ∞ ∞ 0 ∞ 4 ∞ ∞ C45 = min{∞ , 1+4=5} = 5 → Z45 = Z35 = 3 ∞ ∞ 1 0 ∞ ∞ ∞ C65 = min{7 , 3+4=7} = 7 ∞ ∞ ∞ 2 0 2 1 5 2 3 7 7 0 3 Hay cambios en C15 y C45 por lo tanto hay que ∞ ∞ ∞ 1 ∞ ∞ 0 Actualizar la s tablas
  • 10. Tercera iteración K=3 continuación….. 0 ∞ 1 2 5 ∞ ∞ 1 1 1 1 3 1 1 3 0 1 5 5 ∞ ∞ 2 2 2 1 2 2 2 ∞ ∞ 0 ∞ 4 ∞ ∞ 3 3 3 3 3 3 3 ∞ ∞ 1 0 5 ∞ ∞ 4 4 4 4 3 4 4 ∞ ∞ ∞ 2 0 2 1 5 5 5 5 5 5 5 5 2 3 7 7 0 3 2 6 2 1 2 6 6 ∞ ∞ ∞ 1 ∞ ∞ 0 7 7 7 7 7 7 7 después de actualizar las tablas pasamos a k=4
  • 11. Cuarta iteración k=4 i=1,2,5,6,7 j= 3 , 5 C13 = min{1 , 2+1=3} = 1 0 ∞ 1 2 5 ∞ ∞ C15 = min{5 , 2+5=7} = 5 3 0 1 5 5 ∞ ∞ C23 = min{1 , 5+1=6} = 1 ∞ ∞ 0 ∞ 4 ∞ ∞ C25 = min{5 , 5+5=10} =5 ∞ ∞ 1 0 5 ∞ ∞ C53 = min{∞ , 2+1=3} = 3 → Z53 = Z43 = 4 ∞ ∞ ∞ 2 0 2 1 C55 = min{0 , 2+5=7} = 0 5 2 3 7 7 0 3 C63 = min{3 , 7+1=8} = 3 ∞ ∞ ∞ 1 ∞ ∞ 0 C65 = min{7 , 7+5=12} = 7 C73 = min{∞ , 1+1=2} = 2 → Z73 = Z43 = 4 C75 = min{∞ , 1+5=6} = 6 → Z75 = Z45 = 4 • hay cambios en C53 , C73 y C75 por lo tanto hay que actualizar la tabla
  • 12. Cuarta iteración K=4 continuación….. 0 ∞ 1 2 5 ∞ ∞ 1 1 1 1 3 1 1 3 0 1 5 5 ∞ ∞ 2 2 2 1 2 2 2 ∞ ∞ 0 ∞ 4 ∞ ∞ 3 3 3 3 3 3 3 ∞ ∞ 1 0 5 ∞ ∞ 4 4 4 4 3 4 4 ∞ ∞ 3 2 0 2 1 5 5 4 5 5 5 5 5 2 3 7 7 0 3 2 6 2 1 2 6 6 ∞ ∞ 2 1 6 ∞ 0 7 7 4 7 4 7 7 después de actualizar las tablas pasamos a k=5
  • 13. Quinta iteración K=5 i=1,2,3,4,6,7 j= 3 , 4 , 6 , 7 0 ∞ 1 2 5 ∞ ∞ C13 = min{1 , 5+3=8} = 1 3 0 1 5 5 ∞ ∞ C14 = min{2 , 5+2=7} = 2 ∞ ∞ 0 ∞ 4 ∞ ∞ C16 = min{∞ , 5+2=7} = 7 → Z16 = Z56 = 5 ∞ ∞ 1 0 5 ∞ ∞ C17 = min{∞ , 5+1=6} = 6 → Z17 = Z56 = 5 ∞ ∞ 3 2 0 2 1 C23 = min{1 , 5+3=8} = 1 5 2 3 7 7 0 3 C24 = min{5 , 5+2=7} = 5 ∞ ∞ 2 1 6 ∞ 0 C26 = min{∞ , 5+2=7} = 7 → Z26 = Z56 = 5 C27 = min{∞ , 5+1=6} = 7 → Z27 = Z57 = 5 C33 = min{0 , 4+3=7} = 0
  • 14. Quinta iteración K=5 C34 continuación….. = min{∞ , 4+2=6} = 6 → Z = Z = 5 34 54 C36 = min{∞ , 4+2=6} = 6 → Z36 = Z56 = 5 C37 = min{∞ , 4+1=5} = 5 → Z37 = Z57 = 5 C43 = min{1 , 5+3=8} = 1 C44 = min{0 , 5+2=7} = 0 C46 = min{∞ , 5+2=7} = 7 → Z46 = Z56 = 5 C47 = min{∞ , 5+1=6} = 6 → Z47 = Z57 = 5 C63 = min{3 , 7+3=10} = 3 C64 = min{7 , 7+2=9} = 7 C66 = min{0 , 7+2=9} = 0
  • 15. Quinta iteración k=5 continuación….. C67 = min{3 , 7+1=6} = 3 C73 = min{2 , 6+3=9} = 2 C74 = min{1 , 6+2=8} = 1 C76 = min{∞ , 6+2=8} = 8 → Z76 = Z56 = 5 C77 = min{0 , 6+1=7} = 0 Hay cambios en C16 , C17 , C26 , C27 , C34 , C36 , C37 , C46 , C47 y C76 por lo tanto hay que actualizar las tablas
  • 16. Quinta iteración K=5 continuación….. 0 ∞ 1 2 5 7 6 1 1 1 1 3 5 5 3 0 1 5 5 7 7 2 2 2 1 2 5 5 ∞ ∞ 0 6 4 6 5 3 3 3 5 3 5 5 ∞ ∞ 1 0 5 7 6 4 4 4 4 3 5 5 ∞ ∞ 3 2 0 2 1 5 5 4 5 5 5 5 5 2 3 7 7 0 3 2 6 2 1 2 6 6 ∞ ∞ 2 1 6 8 0 7 7 4 7 4 5 7 Después de actualizar las tablas pasamos a k=6
  • 17. Sexta iteración K=6 i=1,2,3,4,5,7 j=1,2,3,4,5,7 0 ∞ 1 2 5 7 6 C12 = min{∞ , 7+2=9} = 3 → Z12 = Z62 = 6 3 0 1 5 5 7 7 C31 = min{∞ , 6+5=11} = 11 → Z31 = Z61 = 2 ∞ ∞ 0 6 4 6 5 C32 = min{∞ , 6+2=8} = 8 → Z32 = Z62 = 6 ∞ ∞ 1 0 5 7 6 C41 = min{∞ , 7+5=12} = 12 → Z41 = Z61 = 2 ∞ ∞ 3 2 0 2 1 C42 = min{∞ , 7+2=9} = 9 → Z42 = Z62 = 6 5 2 3 7 7 0 3 C51 = min{∞ , 2+5=7} = 7 → Z51 = Z61 = 2 ∞ ∞ 2 1 6 8 0 C52 = min{∞ , 2+2=4} = 4 → Z52 = Z62 = 6 C71 = min{∞ , 8+5=13} = 13 → Z71 = Z61 = 2 C72 = min{∞ , 8+2=10} = 10 → Z72 = Z62 = 6 por cuestiones de lo grande del ejercicio solo se pondrá los Cij que cambian en la tabla
  • 18. Sexta iteración k=6 continuación….. 0 3 1 2 5 7 6 1 6 1 1 3 5 5 3 0 1 5 5 7 7 2 2 2 1 2 5 5 11 8 0 6 4 6 5 2 6 3 5 3 5 5 12 9 1 0 5 7 6 2 6 4 4 3 5 5 7 4 3 2 0 2 1 2 6 4 5 5 5 5 5 2 3 7 7 0 3 2 6 2 1 2 6 6 13 10 2 1 6 8 0 2 6 4 7 4 5 7 Después de actualizar las tablas vamos con k=7
  • 19. Ultima iteración K=7 I = 1, 2, 3, 4, 5, 6 j= 1, 2, 3, 4, 5, 6 0 3 1 2 5 7 6 C64 = min{7 , 3+1=4} = 4 → Z64 = Z74 = 7 3 0 1 5 5 7 7 Igual que en la iteración pasada solo se 11 8 0 6 4 6 5 pondrán los Cij que cambian debido 12 9 1 0 5 7 6 a lo grande del problema 7 4 3 2 0 2 1 5 2 3 7 7 0 3 13 10 2 1 6 8 0
  • 20. Tablas actualizadas e interpretación 0 3 1 2 5 7 6 1 6 1 1 3 5 5 3 0 1 5 5 7 7 2 2 2 1 2 5 5 11 8 0 6 4 6 5 2 6 3 5 3 5 5 C = 12 9 1 0 5 7 6 Z= 2 6 4 4 3 5 5 7 4 3 2 0 2 1 2 6 4 5 5 5 5 5 2 3 4 7 0 3 2 6 2 7 2 6 6 13 10 2 1 6 8 0 2 6 4 7 4 5 7 Ejemplo de aplicación saber cual es la ruta mas corta del destino turístico 1 al destino turístico 6: Elegimos en la matriz Z el dato(1,6), es 5 por lo tanto el destino anterior a 6 es 5, después escogemos el (1,5), es 3 por lo tanto el destino anterior es 3, ahora escogemos el (1,3), es 1 por lo tanto ya hemos llegado y en la matriz C escogemos el dato (1,6) es la distancia total 7 1→3→5→6
  • 21. Referencias • Imagenes • "Ranking De Latinoamérica: México, Brasil Y Dominicana Lideran La Recepción De turistas." Invertir En Dominicana's Blog. N.p., n.d. Web. 13 Oct. 2012. http://invertirend.wordpress.com/2012/05/17/ranking-de-latinoamerica-mexic • Pagina de subida de presentacion • "Comercialice Mejor Su Contenido Con Las Caracteristicas PRO." Cargar Y Compartir Presentaciones En Powerpoint Y Documentos. N.p., n.d. Web. 08 Oct. 2012. http://es.slideshare.net/ • Software de grafos • "Software – Grafos - Software Para La Construccion, Edicion Y Analisis De Grafos." Software – Grafos. N.p., n.d. Web. 08 Oct. 2012. <http://arodrigu.webs.upv.es/grafos/doku.php?id=software>.
  • 22. Agradecimientos Creadores: Bueno Calderón Jorge Eduardo González Iñiguez Octavio Jerez de la Cruz Ricardo Profesora: Guadalupe del Carmen Rodríguez Moreno