Diskrete Mathematik II

Slides:



Advertisements
Ähnliche Präsentationen
Grundlagen des A*-Algorithmus und Anwendung in der Routenplanung
Advertisements

Algorithm Engineering
3.2 Subtraktion, Multiplikation, ALU
Multiplizierer Gesucht: Schaltkreis zur Multiplikation zweier Binärzahlen , Beispiel: RW-Systemarchitektur Kap. 3.
Vorlesung Informatik 2 Algorithmen und Datenstrukturen (26-Graphenalgorithmen: Wiederholung und Übung) Prof. Th. Ottmann.
LS 2 / Informatik Datenstrukturen, Algorithmen und Programmierung 2 (DAP2)
LS 2 / Informatik Datenstrukturen, Algorithmen und Programmierung 2 (DAP2)
WS Algorithmentheorie 02 - Polynomprodukt und Fast Fourier Transformation Prof. Dr. Th. Ottmann.
Vorlesung Informatik 2 Algorithmen und Datenstrukturen (27 – Kürzeste Wege) Prof. Th. Ottmann.
1 Vorlesung Informatik 2 Algorithmen und Datenstrukturen (21 – Kürzeste Wege) T. Lauer.
Diskrete Mathe II Übung
Diskrete Mathematik I Vorlesung Arrays-
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Übung Diskrete Mathematik SS 2003 Segmentschnitt I.
Institut für Kartographie und Geoinformation Dipl.-Ing. J. Schmittwilken Diskrete Mathe II Übung
Klausur „Diskrete Mathematik II“
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik I Vorlesung Listen-
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation II Vorlesung In welcher Masche liegt der Punkt p?
Prof. Dr. Bernhard Wasmayr VWL 2. Semester
Vortrag über Graphen Von Jörg Hendricks.
Diskrete Mathe 9 Vorlesung 9 SS 2001
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 1 SS 2001 Algorithmus von Dijkstra.
Datenstrukturen für Landkarten
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation II Vorlesung 10 SS 2000 Quadtrees.
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation I Vorlesung 11 WS 2000/2001 Gerhard Gröger Einführung in ArcInfo 8 -
Diskrete Mathematik II
Geoinformation I Vorlesung 8 WS 2000/2001 Graphen.
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation II Vorlesung 8 SS 2000 Punkt-in-Polygon-Verfahren II (Trapezkarte)
Geoinformation II Vorlesung 2 SS 2001 AVL-Bäume.
Geoinformation II Vorlesung 4 SS 2001 Voronoi-Diagramme.
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Objektorientierte Konzepte/UML Geoinformation I Vorlesung 2 WS 2000/2001.
Konstruktion der Voronoi-Diagramme II
Geoinformation II (6. Semester)
Geoinformation II Vorlesung 3 SS 2001 Polygon Overlay.
Diskrete Mathematik II
Diskrete Mathematik II
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 5 SS 2001 Segmentschnitt II (n Segmente)
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation II Vorlesung 9 SS 2000 Punkt-in-Polygon-Verfahren III (R/R + -Baum)
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation II Vorlesung 7 SS 2000 Punkt-in-Polygon-Verfahren I (Trapezkarte)
Effiziente Algorithmen Hartmut Klauck Universität Frankfurt SS
Effiziente Algorithmen
Konstruktion der Voronoi-Diagramme I
P e r m Willkommen in Perm ! Заварзина Галина Васильевна,
Vorlesung Mai 2000 Konstruktion des Voronoi-Diagramms II
Übergang in die Schule der Sekundarstufe I
MINDREADER Ein magisch - interaktives Erlebnis mit ENZO PAOLO
Gruppe: 31 Grundlagen wissenschaftlichen Arbeitens Algorithmen und Datenstrukturen Iris Studeny.
Geoinformation I Vorlesung 9 WS 2000/2001 DGM (Dreiecksnetze)
Folie Beispiel für eine Einzelauswertung der Gemeindedaten (fiktive Daten)
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation III Vorlesung 1 WS 2001/02 Punkt-in-Landkarte I (Streifenkarte)
Diskrete Mathematik II
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung 6 SS 2001 Segmentschnitt III.

Diskrete Mathematik II
Folie Einzelauswertung der Gemeindedaten
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation II 6. Sem. Vorlesung Mai 2000 Konstruktion des Voronoi-Diagramms.
Übergang in die (Schulen der) Sekundarstufe I
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung
Vorlesung Einführendes Beispiel-
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung der Algorithmus von Floyd Foliendesign:
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation II 6. Sem. Vorlesung April 2000 AVL-Bäume.
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung Datenstrukturen für den Algorithmus von.
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation II Vorlesung 4 WS 01/02 Quadtrees.
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung Suche des kürzesten Weges in einem Netz.
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Foliendesign: Jörg Steinrücken & Tobias Kahn Vorlesung
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung Voronoi-Diagramme.
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Diskrete Mathematik II Vorlesung der Algorithmus von Floyd.
Diskrete Mathe II Übung IKG - Übung Diskrete Mathe II – Jörg Schmittwilken 2 Hinweis Heutige Übung zum Thema Floyd Donnerstag keine Vorlesung.
Institut für Kartographie und Geoinformation Prof. Dr. Lutz Plümer Geoinformation II 6. Sem. Vorlesung 4 4. Mai 2000 Voronoi-Diagramm.
Diskrete Mathematik II
 Präsentation transkript:

Diskrete Mathematik II Vorlesung 3 SS 2001 Algorithmus von Floyd

Übersicht letzte Stunden: Heute: 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 - 2. Semester - SS 2001 - Vorlesung 3

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 - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd: Idee Do Vorgänger 20 35 füge neue direkte Kante ein, wenn noch keine Kante vorhanden oder die neue Kante kürzer ist als eine vorhandene Ha betrachteter Knoten 15 W Nachfolger Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd: Idee Do 20 Für jedes Paar Vorgänger / Nachfolger 35 Ha 15 Für jeden Knoten W Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) Do 80 Vorgänger Du 20 30 Ha 20 betrachteter Knoten 15 D W 150 15 80 Nachfolger K Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) Do Ha W Du K D 20 15 80 30 150 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) fangen wir wieder an mit Dortmund Do Ha W Du K D 20 15 80 30 150 Knoten besitzt nur Nachfolger Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) als nächstes Hagen Do Ha W Du K D 30 150 20 15 80 Do 35 W Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) Jetzt haben wir 2 Vorgänger und 3 Nachfolger - wie viele Paare also? Do Ha W Du K D 30 150 20 15 80 35 Do 80 80 Du Ha D K Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) Do Ha W Du K D 30 150 20 15 80 35 185 65 115 45 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) 115 Do Ha W Du K D 30 150 20 15 80 65 35 185 45 165 95 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) 115 Do Ha W Du K D 30 150 20 15 80 65 35 185 45 95 165 Do Ha D W Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) 115 Do Ha W Du K D 30 150 20 15 80 65 35 185 45 95 165 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) 115 Do Ha W Du K D 30 150 20 15 80 65 35 45 95 85 165 165 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) 115 Do Ha W Du K D 30 20 15 80 65 35 85 45 95 65 150 150 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) 115 Do Ha W Du K D 30 20 15 80 65 35 85 45 95 50 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) 115 Do Ha W Du K D 30 50 20 15 80 65 35 85 45 95 Do Du Ha W K Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) Do Ha W Du K D 30 50 20 15 80 65 35 85 45 95 115 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) Do Ha W Du K D 30 50 20 15 80 65 35 85 45 95 95 100 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) 100 Do Ha W Du K D 30 50 20 15 65 35 85 45 80 80 80 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) 100 Do Ha W Du K D 30 50 20 15 65 35 85 45 80 35 65 Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Algorithmus von Floyd (Beispiel) Do 65 20 35 85 45 Du Ha 30 65 20 15 D W 50 35 80 100 15 65 K Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

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(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 - 2. Semester - SS 2001 - Vorlesung 3

Floyd-Erweiterung: Mitführung der kürzesten Wege private floyd (float A[n,n], float C[n,n], int W[n,n]) { int i, j, k; for(j = 1; j <= n; j++) {for(k = 1; k <=n; k++) { A[j,k] = C[j,k]; W[j,k] = } } for(i = 1; i <= n; i++) { 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]; W[j,k] = i; }}}}} Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Floyd (3) Beachten Sie: Übung: Die Ausgabeprozedur setzt voraus, daß ein Weg zwischen 2 Knoten x und y existiert Übung: Wie sehen Sie der Matrix A an, ob ein Weg zwischen 2 Knoten existiert allgemeiner: Wie sehen Sie der Matrix A an, ob der Graph zusammenhängend ist der Graph ist zusammenhängend, wenn zwischen jedem Paar (a,b) von Knoten ein Weg existiert beachten Sie, dass wir von gerichteten Graphen sprechen, also (a,b)  (b,a) Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3

Ausgabe des kürzesten Weges public weg(int[][] W,int X,int Y) //gibt kürzesten Weg von X nach Y aus { weg_rekursiv(X,Y); gib Y aus; } private weg_rekursiv(int[][] W,int X,int Y) if( W[X,Y] =  ) then gib X aus; else { Z = W[X,Y]; weg_rekursiv(W,X,Z); weg_rekursiv(W,Z,Y); }} Lutz Plümer - Diskrete Mathematik - 2. Semester - SS 2001 - Vorlesung 3