Präsentation herunterladen
Die Präsentation wird geladen. Bitte warten
Veröffentlicht von:Philipp Weiss Geändert vor über 9 Jahren
1
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 3 27.04.00 der Algorithmus von Floyd
2
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.002 Übersicht letzte Stunden: –Algorithmus von Dijkstra –alle kürzesten Wege von einem Knoten (1:n) – Datenstrukuren für den Algorithmus von Dijkstra Datenstruktur für Graphen mit Kosten –Adjazenzliste –Adjazenzmatrix Datenstruktur für grüne Knoten Heute: –Algorithmus von Floyd –kürzeste Wege zwischen allen Paaren von Knoten (n:n)
3
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.003 Algorithmus von Floyd Problem: Bestimmung der kürzesten Wege zwischen allen Paaren von Knoten Lösung –iterative Anwendung des Algorithmus von Dijkstra –besser: Algorithmus von Floyd
4
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.004 Algorithmus von Floyd: Idee 20 Do Ha W 15 betrachteter Knoten Vorgänger Nachfolger 35 füge neue direkte Kante ein, wenn noch keine Kante vorhanden oder die neue Kante kürzer ist als eine vorhandene
5
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.005 Algorithmus von Floyd: Idee 20 Do Ha W 15 Für jeden Knoten 35 Für jedes Paar Vorgänger / Nachfolger
6
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.006 20 Do Ha W Du K D 15 80 20 30 15 150 betrachteter Knoten Vorgänger Nachfolger Algorithmus von Floyd (Beispiel)
7
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.007 Do Ha W Du K D 20 15 80 20 30 15 150 Algorithmus von Floyd (Beispiel)
8
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.008 Do Ha W Du K D 20 15 80 20 30 15 150 Knoten besitzt nur Nachfolger Algorithmus von Floyd (Beispiel) fangen wir wieder an mit Dortmund
9
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.009 Do Ha W Du K D 30 150 20 15 80 20 15 Do W 35 Algorithmus von Floyd (Beispiel) als nächstes Hagen
10
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0010 80 Do Ha W Du K D 30 150 20 15 80 20 15 35 Do Ha Du K D Algorithmus von Floyd (Beispiel) Jetzt haben wir 2 Vorgänge und 3 Nachfolger - wie viele Paare also?
11
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0011 65 Do Ha W Du K D 30 150 20 15 80 20 15 35 185 115 45 Algorithmus von Floyd (Beispiel)
12
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0012 115 Do Ha W Du K D 30 150 20 15 80 65 20 15 35 185 45 95 165 Algorithmus von Floyd (Beispiel)
13
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0013 115 Do Ha W Du K D 30 150 20 15 80 65 20 15 35 185 45 95 165 Do Ha WD Algorithmus von Floyd (Beispiel)
14
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0014 115 Do Ha W Du K D 30 150 20 15 80 65 20 15 35 185 45 95 165 Algorithmus von Floyd (Beispiel)
15
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0015 165 85 165 115 Do Ha W Du K D 30 150 20 15 80 65 20 15 35 45 95 Algorithmus von Floyd (Beispiel)
16
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0016 65 150 115 Do Ha W Du K D 30 20 15 80 65 20 15 35 85 45 95 Algorithmus von Floyd (Beispiel) 150
17
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0017 50 115 Do Ha W Du K D 30 20 15 80 65 20 15 35 85 45 95 65 Algorithmus von Floyd (Beispiel)
18
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0018 115 Do Ha W Du K D 30 50 20 15 80 65 20 15 35 85 45 95 65 Do Ha W Du K Algorithmus von Floyd (Beispiel)
19
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0019 115 Do Ha W Du K D 30 50 20 15 80 65 20 15 35 85 45 95 65 Algorithmus von Floyd (Beispiel)
20
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0020 100 95 Do Ha W Du K D 30 50 20 15 80 65 20 15 35 85 45 65 Algorithmus von Floyd (Beispiel) 95
21
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0021 80 100 Do Ha W Du K D 30 50 20 15 65 20 15 35 85 45 65 Algorithmus von Floyd (Beispiel) 80
22
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0022 65 100 Do Ha W Du K D 30 50 20 15 65 20 15 35 85 45 80 65 35 Algorithmus von Floyd (Beispiel)
23
Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0023 100 Do Ha W Du K D 30 50 20 15 65 20 15 35 85 45 80 65 35 Algorithmus von Floyd (Beispiel)
24
Implementierung mit der Kostenmatrix-Darstellung private floyd (float A [n,n], float C [n,n]) {int i, j, k; for(j = 1; j <= n; j++) {for(k = 1; k <=n; k++) //A: Wege { A[j,k] = C[j,k]; } //C: Kanten, ggf. } for(i = 1; i <= n; i++) { for(j = 1; j <= n; j++) { for(k = 1; k <= n; k++) { if(A[j,i] + A[i,k] < A[j,k]) { A[j,k] = A[j,i] + A[i,k]; }}}}} Heute wieder Java! Lutz Plümer - Diskrete Mathematik II - SS 2000 - Vorlesung 3 - 27.04.0024
Ähnliche Präsentationen
© 2024 SlidePlayer.org Inc.
All rights reserved.