Randomized Graph Algorithms

Similar documents
Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

Advanced algorithms. topological ordering, minimum spanning tree, Union-Find problem. Jiří Vyskočil, Radek Mařík 2012

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

1 Minimum Spanning Tree (MST)

Introduction to Algorithms

Minimum Spanning Trees My T. UF

Minimum Spanning Trees

Lecture 1: A Monte Carlo Minimum Cut Algorithm

Definition: A graph G = (V, E) is called a tree if G is connected and acyclic. The following theorem captures many important facts about trees.

Introduction to Algorithms

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree

K 4 C 5. Figure 4.5: Some well known family of graphs

Introduction to Algorithms

Chapter 23. Minimum Spanning Trees

CPSC 536N: Randomized Algorithms Term 2. Lecture 10

Algorithms for Minimum Spanning Trees

What is a minimal spanning tree (MST) and how to find one

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

CS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya

Solution for Homework set 3

princeton univ. F 15 cos 521: Advanced Algorithm Design Lecture 2: Karger s Min Cut Algorithm

1 Minimum Spanning Trees (MST) b 2 3 a. 10 e h. j m

Lecture Notes on Karger s Min-Cut Algorithm. Eric Vigoda Georgia Institute of Technology Last updated for Advanced Algorithms, Fall 2013.

Introduction to Randomized Algorithms

[13] D. Karger, \Using randomized sparsication to approximate minimum cuts" Proc. 5th Annual

Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, )

22 Elementary Graph Algorithms. There are two standard ways to represent a

Minimum Spanning Trees

New approach to find minimum spanning tree for undirected graphs

Distributed minimum spanning tree problem

2 A Template for Minimum Spanning Tree Algorithms

The minimum spanning tree problem

Theorem 2.9: nearest addition algorithm

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}.

Minimum-Cost Spanning Tree. Example

Example. Minimum-Cost Spanning Tree. Edge Selection Greedy Strategies. Edge Selection Greedy Strategies

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms

22 Elementary Graph Algorithms. There are two standard ways to represent a

1 Minimum Cut Problem

Announcements Problem Set 5 is out (today)!

CS161 - Minimum Spanning Trees and Single Source Shortest Paths

Design and Analysis of Algorithms (VII)

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Minimum Spanning Trees

Chapter 9 Graph Algorithms

Problem Set 2 Solutions

Minimum Spanning Trees COSC 594: Graph Algorithms Spring By Kevin Chiang and Parker Tooley

6.1 Minimum Spanning Trees

6.856 Randomized Algorithms

Partha Sarathi Manal

CS 561, Lecture 9. Jared Saia University of New Mexico

Minimum spanning trees

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li

Introduction to Optimization

Introduction to Optimization

COMP 355 Advanced Algorithms

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees

Notes on Minimum Spanning Trees. Red Rule: Given a cycle containing no red edges, select a maximum uncolored edge on the cycle, and color it red.

Solutions for the Exam 6 January 2014

Graphs: Introduction. Ali Shokoufandeh, Department of Computer Science, Drexel University

CSE 431/531: Analysis of Algorithms. Greedy Algorithms. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Minimum Spanning Tree (5A) Young Won Lim 5/11/18

Greedy algorithms. Given a problem, how do we design an algorithm that solves the problem? There are several strategies:

Graphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs

23.2 Minimum Spanning Trees

CIS 121 Data Structures and Algorithms Minimum Spanning Trees

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 8 Lecturer: David Wagner February 20, Notes 8 for CS 170

Number Theory and Graph Theory

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

V10 Metabolic networks - Graph connectivity

managing an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm

Greedy Algorithms. At each step in the algorithm, one of several choices can be made.

Minimum Spanning Trees

CSE 521: Design and Analysis of Algorithms I

Week 11: Minimum Spanning trees

2.1 Greedy Algorithms. 2.2 Minimum Spanning Trees. CS125 Lecture 2 Fall 2016

A GRAPH FROM THE VIEWPOINT OF ALGEBRAIC TOPOLOGY

On Covering a Graph Optimally with Induced Subgraphs

Introduction to Graph Theory

Minimum Spanning Trees

Artificial Intelligence

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Representations of Weighted Graphs (as Matrices) Algorithms and Data Structures: Minimum Spanning Trees. Weighted Graphs

Solving problems on graph algorithms

Lecture 8: The Traveling Salesman Problem

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019

The minimum spanning tree and duality in graphs

Minimum Spanning Trees

We ve done. Introduction to the greedy method Activity selection problem How to prove that a greedy algorithm works Fractional Knapsack Huffman coding

Lecture Notes for Chapter 23: Minimum Spanning Trees

Vertex Cover is Fixed-Parameter Tractable

Graph Algorithms Using Depth First Search

Math 443/543 Graph Theory Notes 11: Graph minors and Kuratowski s Theorem

Algorithmic Aspects of Communication Networks

Minimum Spanning Tree

Transcription:

Randomized Graph Algorithms Vasileios-Orestis Papadigenopoulos School of Electrical and Computer Engineering - NTUA papadigenopoulos orestis@yahoocom July 22, 2014 Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 1 / 37

Overview 1 The Min-Cut problem The problem The s-t min-cut problem Min-cut and s-t min-cut problem The Contract algorithm The Contraction algorithm The FastCut algorithm 2 Minimum Spanning Trees The problem Deterministic approaches Bor uvka s algorithm Heavy Edges and MST Verification Random Sampling for MSTs The linear-time MST algorithm Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 2 / 37

The Min-Cut problem Overview 1 The Min-Cut problem The problem The s-t min-cut problem Min-cut and s-t min-cut problem The Contract algorithm The Contraction algorithm The FastCut algorithm 2 Minimum Spanning Trees The problem Deterministic approaches Bor uvka s algorithm Heavy Edges and MST Verification Random Sampling for MSTs The linear-time MST algorithm Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 3 / 37

The Min-Cut problem The problem Min-cut Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 4 / 37

The Min-Cut problem The problem The problem In graph theory, a minimum cut of a graph is a cut (a partition of the vertices of a graph into two disjoint subsets that are joined by at least one edge) whose cut set has the smallest number of edges wikipedia Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 5 / 37

The problem The Min-Cut problem The problem Definition A cut in G is a partition of the vertices V = (C, C) into two non-empty sets Definition Ṭhe value or size of a cut C is the number of edges crossing the cut Definition The min-cut problem is that of finding a cut with minimum size in an input graph G Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 6 / 37

The Min-Cut problem The problem Also Multiple edges Connected graph assumption or else trivially solved with finding connected components Weighted graphs generalization Assuming non-negative edges, or else the problem is NP-complete The max-cut is a special case of it Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 7 / 37

The Min-Cut problem The s-t min-cut problem The s-t min-cut problem Definition The s-t min-cut problem is the min-cut problem with the restriction that two distinguished vertices s and t have the property s C and t C Lemma The value of a maximum s-t flow in a network equals the value of a s-t min-cut Maximum flow duality The s-t min-cut problem can be solved via the maximum flow problem in O(mn log (n 2 /m)) Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 8 / 37

The Min-Cut problem Min-cut and s-t min-cut problem Deterministic approach of min-cut via s-t min-cut Lemma The min-cut problem for a graph G can be solved via polynomial number of invocations of an s-t algorithm applied to the same graph Deterministic complexity It can be shown that n-1 flow computations (s-t min-cut calculations) suffice Since the best deterministic maximum flow algorithm runs in O(mn log (n 2 /m)), this approach will require Ω(mn 2 ) Fortunately, the n-1 maximum flow computations can be implemented in time proportional to the cost of a single maximum flow computation So we can compute a min-cut in time O(mn log (n 2 /m)) Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 9 / 37

The Contract algorithm The Min-Cut problem The Contract algorithm Definition Given an edge (x,y) in a multigraph G(V,E), a contraction of the edge (x,y) corresponds to replacing the vertices x and y by a new vertex z, and for each u / {x, y} replacing the edge (x,u) and (y,u) by the edge (z,u) Any multiple edges created are to be retained The graph obtained by this contraction is denoted by G/(x,y) Definition Given a collection of edges F E, the contracted graph is denoted by G/F The vertex set and the edge set of the graph G/F are denoted by V/F and E/F Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 10 / 37

The Min-Cut problem The Contract algorithm The Contract algorithm Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 11 / 37

The Min-Cut problem The Contract algorithm - Analysis The Contract algorithm Lemma It is possible to keep track of the correspondence between the original graph and the contracted one in O(n) time per contraction Lemma The effect of contracting the edges in F is independent of the order of contraction Lemma The selection of an edge (x,y) uniformly at random from the set of all edges in the graph G can be done in O(n) Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 12 / 37

The Min-Cut problem The Contract algorithm - Analysis The Contract algorithm Theorem The Contract algorithm can be implemented to run in O(n 2 ) time on any n-vertex multigraph G Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 13 / 37

The Min-Cut problem The Contraction algorithm The Contraction algorithm Lemma A cut in C is produced as output by the algorithm Contract iff none of the edges crossing this cut is contracted by the algorithm Let K be the a min-cut in G with size of k Lemma In a n-vertex multigraph G with min-cut value k, no vertex has a degree smaller than k Further, the total number of edges in the graph satisfies m nk/2 Lemma Given an edge (x,y) in a graph G, the min-cut value in G/(x,y) is at least as large as the min-cut value in G Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 14 / 37

The Min-Cut problem The Contraction algorithm The Contraction algorithm The number of vertices in H decreases by one during each iteration of Contract algorithm At the i-th iteration, there are n i = n i + 1 vertices in H Since the number of edges in each step is at least n i k/2 (handshaking lemma), the probability that any edge of K is contracted is at most 2/n i So: Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 15 / 37

The Min-Cut problem The Contraction algorithm The Contraction algorithm Theorem Any specific min-cut K is output by the algorithm Contract with probability Ω(n 2 ) The algorithm The above theorem gives as a Monte Carlo algorithm running in O(n 4 log n), by repeating the algorithm contract O(n 2 log n) times Lemma Suppose the algorithm Contract is terminated when the number of vertices remaining in the contracted graph is exactly t Then any specific min-cut K survives in the resulting contracted graph with probability at least: ( t ) ( 2 / n ) ( 2 = Ω( t ) 2) n Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 16 / 37

The Min-Cut problem The FastCut algorithm The FastCut algorithm At this point, we will modify the implementation of the contraction algorithm to reduce its running time to O(n 2 log n) As the complexity of our general module algorithm contract cannot be less than O(n 2 ), the only way to succeed it is by increasing the probability that a min-cut is produced by the algorithm contract The crucial insight is to use two independent invocations of the contract algorithm itself on the contracted graph with n/ 2 vertices Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 17 / 37

The Min-Cut problem The FastCut algorithm The FastCut algorithm Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 18 / 37

The Min-Cut problem The FastCut algorithm - Analysis The FastCut algorithm Theorem Ạlgorithm FastCut runs in O(n 2 log n) time and O(n 2 ) space Theorem Algorithm FastCut succeeds in finding a min-cut with probability Ω(1/ log n) Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 19 / 37

Minimum Spanning Trees Overview 1 The Min-Cut problem The problem The s-t min-cut problem Min-cut and s-t min-cut problem The Contract algorithm The Contraction algorithm The FastCut algorithm 2 Minimum Spanning Trees The problem Deterministic approaches Bor uvka s algorithm Heavy Edges and MST Verification Random Sampling for MSTs The linear-time MST algorithm Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 20 / 37

Minimum Spanning Trees The problem Minimum Spanning Trees Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 21 / 37

Minimum Spanning Trees The problem The problem Given a connected, undirected graph, a spanning tree of that graph is a subgraph that is a tree and connects all the vertices together A single graph can have many different spanning trees We can also assign a weight to each edge, which is a number representing how unfavourable it is, and use this to assign a weight to a spanning tree by computing the sum of the weights of the edges in that spanning tree A minimum spanning tree (MST) or minimum weight spanning tree is then a spanning tree with weight less than or equal to the weight of every other spanning tree wikipedia Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 22 / 37

Minimum Spanning Trees The problem Also Minimum Spanning Forest Distinct edge weights assumption The exact weight is irrelevant in the unit-cost RAM model Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 23 / 37

Minimum Spanning Trees Deterministic approaches Deterministic approaches Prim s algorithm, greedy with Fibonacci heap O(E + V log V ) Kruskal s algorithm, greedy with union-find O(E log E) Bor uvka s algorithm, O(E log V ) Best-known algorithm runs in O(E log β(e, V )), where β(e, V ) = min {i log (i) V E/V } Unfortunately, the algorithm has a large constant due to its complicated data structures Not applicable in practice Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 24 / 37

Minimum Spanning Trees Bor uvka s algorithm Bor uvka s algorithm At this point, we are going to present the idea behind Bor uvka s algorithm, as it will be useful for the randomized algorithm we are going to create Sequential implementation in O(m log n): Data: A graph G Result: The MST of G initialization; in each phase in time O(m) with two passes of the edges; 1st pass: find the less-weighted edge of each component Consecutive find, the edges of the same component are noted; 2nd pass: include the less-weighted edges in the MST and update the components using union ; Algorithm 1: Bor uvka s algorithm Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 25 / 37

Bor uvka s algorithm Minimum Spanning Trees Bor uvka s algorithm The reasoning of the algorithm is based on the following lemmas: Lemma Let v V be any vertex in G The MST for G must contain the edge (v,w) that is the minimum-weight edge incident on v Lemma Given a graph G with n vertices and m edges, a Bor uvka phase can be implemented in time O(n + m) Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 26 / 37

Bor uvka s algorithm Minimum Spanning Trees Bor uvka s algorithm Lemma The set of edges marked for contraction during a Bor uvka phase induces a forest in G Lemma Let G be the graph obtained from G after a Bor uvka phase The MST of G is the union of the edges marked for contraction with the edges in the MST of G Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 27 / 37

Bor uvka s algorithm Minimum Spanning Trees Bor uvka s algorithm Conclusions: Reduction Bor uvka s algorithm reduces the MST problem in a n-vertex graph with m edges to the MST problem in an (n/2)-vertex graph with at most m edges Bor uvka phase complexity Ịn each Bor uvka phase the time required for the reduction is O(n + m) Bor uvka s running time It follows that the Bor uvka s algorithm worst-case running time is O(m log n) Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 28 / 37

Minimum Spanning Trees Heavy Edges and MST Verification Heavy Edges and MST Verification Now, we are going to touch the subject of MST-Verification problem complexity: The problem Ṭake as input a tree T in a graph G Check if T is an MST of G Definition Fix a forest F in G and consider any pair of vertices u, v V Let w F (u,v) denote the maximum weight of an edge on the (unique) path P(u,v) in F We set w F (u,v)= when u and v are disconnected in G Definition An edge (u, v) E is said to be F-heavy if w(u,v)> w F (u,v) The edge (u,v) is said to be F-light if w(u,v) w F (u,v) Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 29 / 37

Minimum Spanning Trees Heavy Edges and MST Verification Lemma Ạll edges in a forest F must be F-light Heavy Edges and MST Verification Lemma Let F be any forest in G If an edge (u,v) is F-heavy, then it does not lie in the MST for G Existence of MST-verification algorithms There exist linear-time verification algorithms that can also identify all F-heavy and F-light edges with respect to any forest F Theorem Given a graph G and a forest F, all F-heavy edges in G can be identified in time O(n + m) Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 30 / 37

Minimum Spanning Trees Random Sampling for MSTs Random Sampling for MSTs In the MST algorithm we are constructing, the use of randomization is in the use of random sampling to identify and eliminate edges that are guaranteed not to belong to the MST Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 31 / 37

Minimum Spanning Trees Random Sampling for MSTs Random Sampling for MSTs Let G a graph Definition We define as G(p) the random graph obtained by independently including each edge of G in G(p) with probability p Obviously, G(p) is expected to have n vertices and mp edges There is no guarantee, although, that G(p) is connected Let F be the minimum spanning forest for G(p) Then, for reasonably large values of p, F should be a very good approximation to the MST of G We remind the lemma suggesting that F-heavy edges does not lie in the MST for G So we expect very few edges in G to be F-light Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 32 / 37

Minimum Spanning Trees Random Sampling for MSTs Random Sampling for MSTs Lemma Let F be the minimum spanning forest in the random graph G(p) obtained by independently including each edge of G with probability p Then the number of F-light edges in G is stochastically dominated by a random variable X that has a negative binomial distribution with parameters n and p In particular, the expected number of F-light edges in G is at most n/p Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 33 / 37

Minimum Spanning Trees The linear-time MST algorithm The expected linear-time MST algorithm Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 34 / 37

Minimum Spanning Trees The linear-time MST algorithm Properties Correctness In each recursion phase the Bor uvka step includes edges that are in the MST The verification step excludes only F-heavy edges of G that cannot be part of the MST Complexity Recursive relation T (n, m) T (n/8, m/2) + T (n/8, n/4) + c(n + m) leading to expected O(n + m) Worst case analysis Worst runtime is equivalent to the runtime of Bor uvka s algorithm ( Las Vegas algorithm) Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 35 / 37

References References Rajeev Motwani & Prabhakar Raghavan Randomized Algorithms Karger David, (1993) Global Min-cuts in RNC and Other Ramifications of a Simple Mincut Algorithm Karger, David R; Klein, Philip N; Tarjan, Robert E (1995) A randomized linear-time algorithm to find minimum spanning trees Thomas H Cormen, Charles E Leiserson, Ronald L Rivest, and Clifford Stein Introduction to Algorithms VK Balakrishnan Schaum s Outline of Theory and Problems of Combinatorics Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 36 / 37

References End Vasileios-Orestis Papadigenopoulos (NTUA) Randomized Graph Algorithms July 22, 2014 37 / 37