Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung der Algorithmus von Floyd
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Ü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)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung 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
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung 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
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Algorithmus von Floyd: Idee 20 Do Ha W 15 Für jeden Knoten 35 Für jedes Paar Vorgänger / Nachfolger
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D betrachteter Knoten Vorgänger Nachfolger Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Knoten besitzt nur Nachfolger Algorithmus von Floyd (Beispiel) fangen wir wieder an mit Dortmund
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Do W 35 Algorithmus von Floyd (Beispiel) als nächstes Hagen
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Do Ha Du K D Algorithmus von Floyd (Beispiel) Jetzt haben wir 2 Vorgänge und 3 Nachfolger - wie viele Paare also?
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Do Ha WD Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel) 150
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Do Ha W Du K Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel) 95
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel) 80
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel)
Lutz Plümer - Diskrete Mathematik II - SS Vorlesung Do Ha W Du K D Algorithmus von Floyd (Beispiel)
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 Vorlesung