Graph Algorithms Graph Algorithms a Brief Introduction 3 References 高晓沨 ((( Xiaofeng Gao )))
Total Page:16
File Type:pdf, Size:1020Kb
目录 1 Graph and Its Applications 2 Introduction to Graph Algorithms Graph Algorithms A Brief Introduction 3 References 高晓沨 ((( Xiaofeng Gao ))) Department of Computer Science Shanghai Jiao Tong Univ. 2015/5/7 Algorithm--Xiaofeng Gao 2 Konigsberg Once upon a time there was a city called Konigsberg in Prussia The capital of East Prussia until 1945 GRAPH AND ITS APPLICATIONS Definitions and Applications Centre of learning for centuries, being home to Goldbach, Hilbert, Kant … 2015/5/7 Algorithm--Xiaofeng Gao 3 2015/5/7 Algorithm--Xiaofeng Gao 4 Position of Konigsberg Seven Bridges Pregel river is passing through Konigsberg It separated the city into two mainland area and two islands. There are seven bridges connecting each area. 2015/5/7 Algorithm--Xiaofeng Gao 5 2015/5/7 Algorithm--Xiaofeng Gao 6 Seven Bridge Problem Euler’s Solution A Tour Question: Leonhard Euler Solved this Can we wander around the city, crossing problem in 1736 each bridge once and only once? Published the paper “The Seven Bridges of Konigsbery” Is there a solution? The first negative solution The beginning of Graph Theory 2015/5/7 Algorithm--Xiaofeng Gao 7 2015/5/7 Algorithm--Xiaofeng Gao 8 Representing a Graph More Examples Undirected Graph: Train Maps G=(V, E) V: vertex E: edges Directed Graph: G=(V, A) V: vertex A: arcs 2015/5/7 Algorithm--Xiaofeng Gao 9 2015/5/7 Algorithm--Xiaofeng Gao 10 More Examples (2) More Examples (3) Chemical Models 2015/5/7 Algorithm--Xiaofeng Gao 11 2015/5/7 Algorithm--Xiaofeng Gao 12 More Examples (4) More Examples (5) Family/Genealogy Tree Airline Traffic 2015/5/7 Algorithm--Xiaofeng Gao 13 2015/5/7 Algorithm--Xiaofeng Gao 14 Icosian Game Icosian Game In 1859, Sir William Rowan Hamilton Examples developed the Icosian Game. Traverse the edges of an dodecahedron, i.e., a path such that every vertex is visited a single time, no edge is visited twice, and the ending point is the same as the starting point. Also refer as Hamiltonian Game . 3D3D3D-3D ---DemoDemo http://mathworld.wolfram.com/IcosianGame.html 2015/5/7 Algorithm--Xiaofeng Gao 15 2015/5/7 Algorithm--Xiaofeng Gao 16 Four Color Theorem Four Color Theorem The four color theorem was stated, but not The theorem asserts that four colors are proved, in 1853 by Francis Guthrie. enough to color any geographical map in such a way that no neighboring two countries are of the same color. 2015/5/7 Algorithm--Xiaofeng Gao 17 2015/5/7 Algorithm--Xiaofeng Gao 18 Snark Graph Petersen Family Each point has degree 3 Y-Δ Strong connectivity (breaking any three edges will not violating the connectivity of the graph) Single Star Snark Double Star Snark (Petersen Graph) http://en.wikipedia.org/wiki/Petersen_graph 2015/5/7 Algorithm--Xiaofeng Gao 19 2015/5/7 Algorithm--Xiaofeng Gao 20 Snark Family Well-Known Results Complete Graph Kn Bipartite Graph Km,n Star K1,n K r-Partite Graph K r(m) 1,7 Subgraph H⊆⊆⊆G Spanning/Induced Subgraph Handshaking Theorem ∑ d(v) = 2 E ∈Vv K4(3) http://en.wikipedia.org/wiki/Snark_(graph_theory) 2015/5/7 Algorithm--Xiaofeng Gao 21 2015/5/7 Algorithm--Xiaofeng Gao 22 Algorithms on Graphs Elementary Graph Algorithms Breadth-First Search Depth-First Search Minimum Spanning Tree Shortest Path Problem Single-Source Shortest Path INTRODUCTION TO GRAPH ALGORITHMS All-Pairs Shortest Path Three Categories Maximum Flow Max-Flow vs Min-Cut Applications 2015/5/7 Algorithm--Xiaofeng Gao 23 2015/5/7 Algorithm--Xiaofeng Gao 24 Breadth-First Search Depth-First Search Basic Strategy Basic Strategy visit and inspect a node Starts at arbitrary root of a graph Explores as far as possible gain access to visit the along each branch before nodes that neighbor the backtracking currently visited node Applications and Theories Applications and Theories Finding (strong) connected components Find nodes within one connected component Topological sorting Find shortest path between two nodes u and v Solving mazes puzzles with only one solution Ford-Fulkerson method for computing the parenthesis theorem maximum flow in a flow network 2015/5/7 Algorithm--Xiaofeng Gao 25 2015/5/7 Algorithm--Xiaofeng Gao 26 Minimum Spanning Tree Single-Source Shortest Path Classical Algorithms Dijkstra’s Algorithm Prim: maintain an optimal subtree Greedy Approach Kruskal: maintain min-weight acyclic edge set Graph with positive weights Reverse-Delete: circle-deletion Borüvka Algorithm Bellman-Ford Algorithm Fundamental Results Dynamic Programming All greedy Approach with exchange property Graph with negative weights (without Correctness proof: cycle/cut property negative-cycle) Efficiency: time complexity heap 2015/5/7 Algorithm--Xiaofeng Gao 27 2015/5/7 Algorithm--Xiaofeng Gao 28 All-Pair Shortest Path Maximum Flow Problem Basic Dynamic Programming Maximum Flow and Minimum Cut Matrix multiplication Max-Flow Min-Cut Theorem: The value of the Time Complexity: Θ(n3 lg n). max flow is equal to the value of the min cut Floyd-Warshall algorithm Ford-Fulkerson Algorithm Also dynamic programming, but faster Find s-t flow of maximum value Time Complexity: Θ(n3) Augmenting Path Algorithm Johnson ’s algorithm Augmenting path theorem. Flow f is a max flow For sparse graph iff there are no augmenting paths Time Complexity: O(VE + V2 lg V). 2015/5/7 Algorithm--Xiaofeng Gao 29 2015/5/7 Algorithm--Xiaofeng Gao 30 References (1) Title: Algorithms Author : S. Dasgupta, C. Papadimitriou, U. Vazirani REFERENCES Publisher: McGraw-Hill, 2007. Berkeley, Princeton, Cornell, MIT 2015/5/7 Algorithm--Xiaofeng Gao 31 2015/5/7 Algorithm--Xiaofeng Gao 32 Reference (2) Reference (3) Title: Algorithms Author : Robert Sedgewick, Title: Algorithm Design Kevin Wayne Author : J. Kleinberg Publisher: Addison-Wesley E. Tardos Professional, 2011 Publisher: Addison Wesley, Edition: 4th Edition 2005. (First Edition was published in 1983) 2015/5/7 Algorithm--Xiaofeng Gao 33 2015/5/7 Algorithm--Xiaofeng Gao 34 Reference (4) Title: Introduction to Algorithms Author : T. Cormen, C. Leiserson, R. Rivest, C. Stein Publisher: The MIT Press, 2009 ISBN-10: 0262033844 ISBN-13: 978-0262033848 Edition: Third Edition Xiaofeng Gao (First Edition was published in 1990) 2015/5/7 Algorithm--Xiaofeng Gao 35.