Institute of Operating Systems and Computer Networks Algorithms Group Network Algorithms Tutorial 1: Flashback and Fast Forward Christian Rieck—April 24, 2017 Staff Lecture: Dr. Christian Scheffer scheff[email protected] Room: IZ 331 Tutorial: Christian Rieck [email protected] Room: IZ 314 Hiwi: Jakob Keller [email protected] Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 2 Homework and exam There will be five homework assignment sheets. You have to get at least 50% of the points in total. You have to pass a written exam at the end of the lecture, probably at August, 7th. Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 3 Extra points You can earn extra points for your homework! ‣ find a mistake in the slides ‣ improve the tutorial by a better example ‣ improve the tutorial by ideas on new interesting stuff ‣ … Please send an email or something and I will think about it. Usually the amount of extra points is in some way related to the improvement and is a fraction of my room number π. Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 4 (preliminary) Schedule Semesterplan Netzwerkalgorithmen Sommer’17 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Woche (ab 3.4.) (ab 10.4.) (ab 17.4.) (ab 24.4.) (ab 1.5.) (ab 8.5.) (ab 15.5.) (ab 22.5.) (ab 29.5.) (ab 5.6.) (ab 12.6.) (ab 19.6.) (ab 26.6.) (ab 3.7.) (ab 10.7.) Vorlesung (Do.) 1 2 3 4 5 6 Christi Himmelfahrt 7 Gr. Übung (Mo.) Kl. Übung (Do.) HA Rückgabe HA Ausgabe HA Abgabe (Mo.) (Mo. bis 11:30 Uhr) (in kl. Übung) HA1 1 HA2 2 1 HA1 HA3 3 2* HA1 HA2 Christi Himmelfahrt 8 4 9 10 5 11 12 6 *: Die zweite kleine Übung wird HA4 Exkursionswoche HA3 3 HA2* HA3 HA5 HA4 4 HA4 HA5 5 auf den Slot der großen Übung verschoben! Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 HA5 5 (preliminary) Schedule Semesterplan Netzwerkalgorithmen Sommer’17 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Woche (ab 3.4.) (ab 10.4.) (ab 17.4.) (ab 24.4.) (ab 1.5.) (ab 8.5.) (ab 15.5.) (ab 22.5.) (ab 29.5.) (ab 5.6.) (ab 12.6.) (ab 19.6.) (ab 26.6.) (ab 3.7.) (ab 10.7.) Vorlesung (Do.) 1 2 3 4 5 6 Gr. Übung (Mo.) Kl. Übung (Do.) HA Rückgabe HA Ausgabe HA Abgabe (Mo.) (Mo. bis 11:30 Uhr) (in kl. Übung) HA1 1 HA2 HA1 2 1 There is a calendar on the webpage which will HA3 HA2 3 be up-to-date! 7 2* HA4 HA3 Christi Himmelfahrt HA1 Christi Himmelfahrt HA2* Exkursionswoche 8 4 9 10 5 11 12 6 *: Die zweite kleine Übung wird 3 HA3 HA5 HA4 4 HA4 HA5 5 auf den Slot der großen Übung verschoben! Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 HA5 5 Mailing list There is a mailing list for this lecture. https://mail.ibr.cs.tu-bs.de/mailman/listinfo/na We will distribute several announcements via this list. So, please subscribe. Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 6 Webpage There is a webpage for this lecture. https://www.ibr.cs.tu-bs.de/courses/ss17/na/index.html There is all the stuff like the slides of the tutorials, the homework assignment sheets, the schedule of the lecture, informations regarding the exam,… Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 7 Questions? Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 8 Previously in *… Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 9 Graphs A graph is an ordered pair G=(V,E) comprising a set V of vertices together with a set E of edges, which are 2-element subsets of V. We normally consider simple graphs, i.e., there is at most one edge between two specific vertices and there are no edges connecting a vertex with itself. Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 10 Digraphs A digraph is an ordered pair D=(V,A) comprising a set V of vertices together with a set A of arcs (edges), which are ordered pairs of vertices. Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 11 Data structures There are several ways to represent graphs, e.g., ‣ adjacency list ‣ adjacency matrix ‣ incidence matrix Please make yourself familiar with these data structures. A good reference is the seventh lecture on algorithms and data structures. https://www.ibr.cs.tu-bs.de/courses/ws1617/aud/webpages/skript/VL7a.pdf Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 12 Data structures Stack ‣ last in, first out (LIFO) ‣ push ‣ pop Queue ‣ first in, first out (FIFO) ‣ enqueue ‣ dequeue Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 13 Breadth-First-Search v2 v1 procedure BFS(G,v) let Q be a queue Q.enqueue(v) while Q is not empty v = Q.dequeue() for each edge e incident to v let w be the other endpoint of e if w is not marked mark w Q.enqueue(w) v3 v0 v10 v11 v5 v6 v9 v7 v4 v8 v2 v1 v3 v0 v10 v9 v7 Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 v11 v5 v6 v4 v12 v12 v8 14 Depth-First-Search v2 v1 procedure DFS(G,v) let S be a stack S.push(v) while S is not empty v = S.pop() if v is not labeled as discovered label v as discovered for all edges from v to w S.push(w) v3 v0 v10 v11 v5 v6 v9 v7 v4 v8 v2 v1 v3 v0 v10 v9 v7 Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 v11 v5 v6 v4 v12 v12 v8 15 Walk, path, trail,… Kantenfolge: Alternating sequence of vertices and edges. Weg: Kantenfolge + no repeating edges Pfad: Kantenfolge + no repeating vertices Tour: Weg + same start and end vertex Kreis: Pfad + same start and end vertex Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 16 Big O-Notation ‣ describes the limiting behavior of a function when the argument tends towards infinity ‣ is used to classify algorithms according to their running time O( f ) = { g : N ! R + | 9c 2 R >0 9n0 2 N 8n 2 N g(n) 2 O( f (n)) n0 : g(n) c · f (n)} f (n) g(n) n0 Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 17 Big O-Notation f ( x ) = 6x4 2x3 + 42 Show: f ( x ) 2 O( x4 ) |6x4 2x3 + 42| 6x4 + |2x3 | + 42 6x4 + 2x4 + 42x4 = 4 50x Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 18 Other Landau symbols There are some other notations for analyzing the running time and space requirements of algorithms, e.g., small-o, big-Omega,… Please make yourself familiar with these notations. Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 19 Soon in network algorithms… Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 20 Minimum-cost problems Minimum Spanning Tree Given: A graph G=(V,E) with edge weights Wanted: A tree T of minimum cost that spans the graph 7 5 1 9 3 3 6 8 5 2 4 7 7 11 1 7 5 1 6 2 5 G Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 6 3 3 4 2 2 1 5 T 21 Minimum-cost problems Minimum Spanning Tree Given: A graph G=(V,E) with edge weights Wanted: A tree T of minimum cost that spans the graph A geometric generalisation is the Minimum Steiner Tree Problem. One can also ask for a spanning tree where the longest edge is as short as 7possible—the Minimum Bottleneck Spanning 7 Tree! 6 6 7 spanning tree where each vertex degrees 7 are Or we5want a 8minimum 5 1 5 1 bounded, or 11 satisfy some other constraints. 9 3 3 6 2 2 4them are really hard, e.g., the Steiner problems. 4 Some of 3 3 1 2 5 G Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 1 2 5 T 21 Shortest-path problems Single source shortest paths Given: A graph G=(V,E) with edge weights, and a vertex s Wanted: A shortest path tree T routed in s 7 5 1 9 3 3 6 8 5 2 4 7 7 11 1 5 1 6 2 7 s 9 5 G Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 3 3 6 2 1 2 5 T 22 Shortest-path problems Single source shortest paths Given: A graph G=(V,E) with edge weights, and a vertex s Wanted: A shortest path tree T routed in s There are many related problems, e.g., Longest Path, Hamiltonian Path, 7 tour problems like the Traveling Salesman 7 Problem, … several 6 5 1 9 5 3 8 7 5 1 Almost all of them are NP-hard! 11 3 3 s 9 6 2 4 3 1 2 2 5 G Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 7 6 2 1 5 T 22 Flows Maximum Flow Given: A digraph D=(V,A) with edge weights, and vertices s and t Wanted: A maximum flow F starting from s to t 7 5 9 1 8 5 7 3 4 3 2 6 2 1 11 5 6 5 s 99 1 5 D Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 57 5 8 5 33 3 26 72 11 11 6 2 2 1 1 4 2 11 F t 15 23 Flows Maximum Flow Given: A digraph D=(V,A) with edge weights, and vertices s and t Wanted: A maximum flow F starting from s to t A fundamental theorem is the MaxFlow-MinCut-Theorem of Ford and Fulkerson that shows that a MaxFlow is equal to a MinCut 26 7 6 of a flow network.5 7 5 8 5 7 5 5 8 5 72 t There1 are polynomial-time algorithms for5solving 1 such flow problems. 11 11 11 3 3 But there are many related problems, and some of them3 are NP-hard. 6 s 6 99 9 2 2 4 3 2 1 3 5 D Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 2 1 4 2 11 F 1 15 23 Matchings Maximum Matching Given: A graph G=(V,E) Wanted: A maximum set M of pairwise non-adjacent edges G Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 M 24 Matchings Maximum Matching Given: A graph G=(V,E) There many different of the matching problem, e.g., Wanted: A are maximum set variants M of pairwise non-adjacent edges Perfect Matching Minimum Cost Perfect Matching Maximal Matching Matching in bipartite Graphs … G Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 M 24 Questions? Network Algorithms—Tutorial 1: Flashback and Fast Forward April 24, 2017 25
© Copyright 2025 Paperzz