An O(n log n)-Time Algorithm for the k-Center Problem in Trees

Slides:



Advertisements
Similar presentations
Chapter 4 Partition I. Covering and Dominating.
Advertisements

Bart Jansen 1.  Problem definition  Instance: Connected graph G, positive integer k  Question: Is there a spanning tree for G with at least k leaves?
Minimum Clique Partition Problem with Constrained Weight for Interval Graphs Jianping Li Department of Mathematics Yunnan University Jointed by M.X. Chen.
Comments We consider in this topic a large class of related problems that deal with proximity of points in the plane. We will: 1.Define some proximity.
Lecture 3: Parallel Algorithm Design
Dynamic Planar Convex Hull Operations in Near- Logarithmic Amortized Time TIMOTHY M. CHAN.
Greedy Algorithms Greed is good. (Some of the time)
© The McGraw-Hill Companies, Inc., Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Steps in DP: Step 1 Think what decision is the “last piece in the puzzle” –Where to place the outermost parentheses in a matrix chain multiplication (A.
Chapter 3 The Greedy Method 3.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Data Transmission and Base Station Placement for Optimizing Network Lifetime. E. Arkin, V. Polishchuk, A. Efrat, S. Ramasubramanian,V. PolishchukA. EfratS.
Totally Unimodular Matrices Lecture 11: Feb 23 Simplex Algorithm Elliposid Algorithm.
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
Chapter 4: Divide and Conquer The Design and Analysis of Algorithms.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
1 Shortest Path Calculations in Graphs Prof. S. M. Lee Department of Computer Science.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.
Design Techniques for Approximation Algorithms and Approximation Classes.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
UNC Chapel Hill M. C. Lin Linear Programming Reading: Chapter 4 of the Textbook Driving Applications –Casting/Metal Molding –Collision Detection Randomized.
1 Minimum Cost Flows Goal: Minimize costs to meet all demands in a network subject to capacities (combines elements of both shortest path and max flow.
Fundamentals of Algorithms MCS - 2 Lecture # 7
A Clustering Algorithm based on Graph Connectivity Balakrishna Thiagarajan Computer Science and Engineering State University of New York at Buffalo.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
OR Chapter 8. General LP Problems Converting other forms to general LP problem : min c’x  - max (-c)’x   = by adding a nonnegative slack variable.
UNC Chapel Hill M. C. Lin Computing Voronoi Diagram For each site p i, compute the common inter- section of the half-planes h(p i, p j ) for i  j, using.
CSE554Contouring IISlide 1 CSE 554 Lecture 5: Contouring (faster) Fall 2013.
Common Intersection of Half-Planes in R 2 2 PROBLEM (Common Intersection of half- planes in R 2 ) Given n half-planes H 1, H 2,..., H n in R 2 compute.
AS Decision Maths Tips for each Topic. Kruskal and Prim What examiner’s are looking for A table of values in the order that they are added and the total.
CMPS 3130/6130 Computational Geometry Spring 2017
CSE 554 Lecture 5: Contouring (faster)
Computational Geometry
Lap Chi Lau we will only use slides 4 to 19
CS1022 Computer Programming & Principles
Topics in Algorithms Lap Chi Lau.
Paweł Gawrychowski, Nadav Krasnopolsky, Shay Mozes, Oren Weimann
Fill Area Algorithms Jan
Haim Kaplan and Uri Zwick
COMP 6/4030 ALGORITHMS Prim’s Theorem 10/26/2000.
KD Tree A binary search tree where every node is a
Chapter 5. Optimal Matchings
Types of Algorithms.
Orthogonal Range Searching and Kd-Trees
Bart M. P. Jansen June 3rd 2016, Algorithms for Optimization Problems
Efficient Algorithms for the Weighted k-Center Problem on a Real Line
Dynamic Data Structures for Simplicial Thickness Queries
Locating an Obnoxious Line among Planar Objects
Quickest Visibility Queries in Polygonal Domains
Chapter 11 Limitations of Algorithm Power
Covering Uncertain Points in a Tree
On the Geodesic Centers of Polygonal Domains
Minimizing the Aggregate Movements for Interval Coverage
Approximating Points by A Piecewise Linear Function: I
Chapter 15 Graphs © 2006 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.
Haitao Wang Utah State University WADS 2017, St. John’s, Canada
Optimal Point Movement for Covering Circular Regions
Range Queries on Uncertain Data
Joseph S.B. Mitchell, Stony Brook University
Danny Z. Chen1, Yan Gu2, Jian Li2, and Haitao Wang1
Aggregate-Max Nearest Neighbor Searching in the Plane
Haitao Wang Utah State University SoCG 2017, Brisbane, Australia
Danny Z. Chen and Haitao Wang University of Notre Dame Indiana, USA
Lecture 19 Linear Program
The Greedy Approach Young CS 530 Adv. Algo. Greedy.
Given a list of n  8 integers, what is the runtime bound on the optimal algorithm that sorts the first eight? O(1) O(log n) O(n) O(n log n) O(n2)
INTRODUCTION A graph G=(V,E) consists of a finite non empty set of vertices V , and a finite set of edges E which connect pairs of vertices .
Presentation transcript:

An O(n log n)-Time Algorithm for the k-Center Problem in Trees Haitao Wang, Utah State University Jingru Zhang, University of Texas Rio Grande Valley SoCG 2018, Budapest

The k-center problem in a tree Input: a tree T of n vertices and each vertex 𝒗 𝒊 has a weight 𝒘 𝒊 ≥ 0 Goal: find a set Q of k centers on T to minimized the maximum weighted distance from each vertex to its closest center max 1≤𝑖≤𝑛 𝑤 𝑖 d 𝑣 𝑖 ,𝑄 where 𝑑 𝑣 𝑖 ,𝑄 = min 𝑞∈𝑄 𝑑( 𝑣 𝑖 ,𝑞) A center can be in the interior of an edge 𝑣 2 𝑣 5 𝑣 10 𝑇 𝑣 1 𝑞 1 𝑞 2 𝑣 9 𝑣 4 𝑣 7 𝑣 12 𝑣 3 𝑣 8 𝑄= 𝑞 1 , 𝑞 2 𝑣 6 𝑣 11 λ*: The optimal objective value

Previous work and our result O(n2 log n), Kariv and Hakimi (1979) O(nk log n), Jeger and Kariv (1985) O(n log2 n loglog n), Meggido and Tamir (1983) O(n log2 n), Cole’s parametric search (1987) Open problem: Is the problem solvable in O(n log n) time? Banik et al. (2016) 𝑂 𝑛 log 𝑛 +𝑘 ( log 𝑛 ) 2 log (𝑛 𝑘 ) Our result: 𝑶(𝒏 𝐥𝐨𝐠 𝒏 ) time

The decision problem λ*: The optimal objective value Given a value 𝜆, determine whether λ ≥ λ* if yes, λ is a feasible value O(n) time, Kariv and Hakimi (1979)

Previous techniques Form sorted matrices on candidate values for λ* Apply the sorted matrix searching technique by using the O(n)-time decision algorithm, Frederickson and Johnson (1984) Parametric search, Cole (1987) The difficulty: The weights on the vertices If no weights, O(n) time, Frederickson (1991) Three schemes: O(n (loglog n)2) time O(n log* n) time O(n) time

Our techniques Sorted matrices searching 2D sublist linear programming queries Reducing the problem to searching vertices in a line arrangement Three phases: Phase 0: Reducing the number of leaves to 2𝑛 (log 𝑛 ) 2 Phase 1: Computing data structures to solve the decision problem in sub-linear time, O( 𝑛 (log 𝑛 ) 2 log log 𝑛 3 ) Phase 2: Solve the problem using the sub-linear decision algorithm

An O(n)-time decision algorithm Given λ, determine whether λ ≥ λ*? Find a set Q of a minimum number of centers on T such that max 1≤𝑖≤𝑛 𝑤 𝑖 d( 𝑣 𝑖 ,𝑄)≤𝜆 |𝑄 |≤𝑘 ? Yes No 𝜆≥ 𝜆 ∗ 𝜆< 𝜆 ∗

An O(n)-time decision algorithm Place centers on 𝑇 from bottom to top in a greedy manner: place centers as high as possible 𝑣 15 𝑣 8 𝑣 14 𝑣 3 𝑣 7 𝑣 13 𝑞 1 𝑣 9 𝑣 4 𝑣 1 𝑣 2 𝑣 5 𝑣 6 𝑣 10 𝑣 11 𝑣 12

Phase 0: Reducing the number of leaves to 2n/r, with r = log2n A path partition: Partition the edges of T into paths where a vertex v is an endpoint of a path if the degree of v is not 2 v A leaf path: a path with a leaf as an endpoint

Phase 0 S: the set of all leaf paths of lengths at most r Form sorted matrices on S Consisting of all candidate values for λ* on the paths of S

A matrix element A matrix element: Given i and j, the 𝑣 6 A matrix element: Given i and j, the optimal objective value for using one center to cover all vertices vi,vi+1,…,vj 𝑣 5 𝑣 4 𝑣 3 𝑣 2 𝑣 1

Phase 0 S: the set of all leaf paths of lengths at most r Form sorted matrices on S Run matrix searching algorithm to obtain a range (λ1,λ2) λ1 < λ* ≤ λ2 Only need to consider feasible values in (λ1,λ2) in future Some leaf paths of S become “inactive”: their matrices do not contain any value in (λ1,λ2) Process the inactive paths: placing centers there by running the decision algorithm using any value λ in (λ1,λ2) Observation: If λ* is in (λ1,λ2), then the decision algorithm would behave combinatorially the same with λ = λ*

Processing an inactive leaf path Run the decision algorithm in a bottom-up manner 𝑣 6 Remove the last center, but keep a dominating vertex v with an edge connecting v6, such that if a center in the path that can cover v also covers all other vertices (v4 and v5) 𝑣 5 The path is replaced by a twig which is an (artificial) edge from the top vertex to the dominating vertex v 𝑣 4 𝑣 4 𝑣 3 We will need to place a center on the twig in the future algorithm 𝑣 2 𝑣 1

Processing an inactive leaf path (the second case): the last center is outside the path Remove the last center, but keep a dominating vertex v with an edge connecting v6, such that if a center outside the path that can cover v also covers all other vertices (v4 and v5) 𝑣 6 The path is replaced by a thorn which is an (artificial) edge from the top vertex to the dominating vertex 𝑣 5 𝑣 4 𝑣 4 The difference between a twig and a thorn: In the future algorithm, a center will be placed at a twig while this may not be true for a thorn 𝑣 3 𝑣 2 𝑣 1

Phase 0 After processing all inactive leaf paths, if the number of leaves at the new tree is still more than 2n/r Run the same algorithm again but need to take care of the twigs and thorns Compute a path partition of the new tree without twigs and thorns Each path, along with all attached twigs and thorn, is called a stem A stem-partition of the tree A leaf-stem: if the path has a leaf

A stem 𝑣 6 a thorn 𝑣 5 a twig 𝑣 4 𝑣 3 𝑣 2 𝑣 1

Phase 0 S: the set of all leaf stems of lengths at most r Form matrices on S Need to consider all thorns and twigs

A matrix element Given i and j, a matrix element is the optimal objective value of one of the following one center problems: All path vertices and thorn vertices from vi to vj The twig vertex at vi, in addition to all path vertices and thorn vertices from vi to vj 𝑣 𝑗 𝑣 𝑖 twigs thorns

Phase 0 S: the set of all leaf stems of lengths at most r Form matrices on S Need to consider all thorns and twigs Run matrix searching algorithm to update (shrink) the range (λ1,λ2) Some leaf stems of S become “inactive” Process the inactive stems: Replace each of them by a thorn or twig Run the algorithm recursively until the new tree has at most 2n/r leaves

Phase 1: a sub-linear decision algorithm Perform a stem partition Partition stems into substems of size r

Phase 1: an sublinear decision algorithm Build a stem tree: each substem defines a vertex and the edges follow their adjacent positions in the original tree stem tree original tree (excluding twigs and thorns)

Phase 1: Building a data structure on substems Based on the top center at the lower stem, we can determine the top center at the upper stem in sub-linear time The data structure provides an interface between two adjacent stems Twigs and thorns A sub-linear decision algorithm O( 𝑛 (log 𝑛 ) 2 log log 𝑛 3 ) time

Phase 2: Compute 𝜆 ∗ using the sub-linear decision algorithm T is a single stem? Yes No Compute λ* on the single stem Do a stem-partition Search the stems by using sub-linear decision algorithm and shrink ( 𝜆 1 , 𝜆 2 ) Processing each inactive leaf stem: replace it by a thorn or a twig

The discrete case Centers are required to be at vertices of T Previous work O(n log2 n) time (Megiddo, Tamir, Zemel, Chandrasekaran, 1981) Our result: O(n log n) time Similar techniques

Thank you for your attention!

Computing a matrix element A matrix element: Given i and j, the optimal objective value for using one center to cover all vertices vi,vi+1,…,vj 𝑣 6 w2 -w2 𝑣 5 𝑣 1 𝑣 2 𝑣 3 𝑣 4 𝑣 5 𝑣 6 x 𝑣 4 Define two upper half-planes for each vertex vi, whose bounding lines have slopes wi and –wi, respectively 𝑣 3 The optimal objective value corresponds to the lowest point in the common intersection of the half-planes from vi to vj The 2D sublist LP queries: Given m half-planes 𝐻={ ℎ 1 , ℎ 2 ,, . . . , ℎ 𝑚 } and two indices i and j, a 2D sublist LP query asks for the lowest point in the common intersection of half-planes ℎ 𝑖 , ℎ 𝑖+1 ,, . . . , ℎ 𝑖 𝑣 2 𝑣 1 Preprocessing: O(n log n) time; query: (log2 n) time

Phase 0: a summary T has > 2𝑛 𝑟 vertices? Phase 1 No Phase 1 Yes Do a stem-partition; form matrices Search matrices and shrink ( 𝜆 1 , 𝜆 2 ) Process inactive leaf-stems: Replace each of them by a thorn or a twig Eliminate redundant twigs and thorns such that every vertex has at most one twig and at most one thorn

Observations Under 𝜆 ∗ Vertices covered by each center leads a connected subtree of T. 𝑣 15 𝑤 2 𝑑(𝑣 2 ,𝑞)= 𝑤 8 𝑑 𝑣 8 ,𝑞 = 𝜆 ∗ 𝑣 8 𝑣 14 𝑣 3 𝑣 7 𝑣 13 𝑣 9 𝑣 4 𝑣 1 𝑣 2 𝑣 5 𝑣 6 𝑣 10 𝑣 11 𝑣 12

Phase 0: Place centers under 𝜆 ∗ Observation: under 𝜆 ∗ , this path are divided into connected subtrees. For every connected subtrees, consider the one-center problem and one 𝜆 could be 𝜆 ∗ . Observations: Solve the one-center on every connected subtree and each give us a 𝜆 value For every 𝜆, do a feasibility test by the decision algorithm and get a range ( 𝜆 1 , 𝜆 2 ] which contains 𝜆 ∗ but no other 𝜆 values 𝑣 1 For any 𝜆∈( 𝜆 1 , 𝜆 2 ], the decision algorithm will partition this paths into same subtrees.

Phase 0: Replacing a leaf-path Replace a leaf-path by a thorn or a twig Stem: paths where each vertex is allowed to have twigs or thorns but no backbone (normal vertex). A leaf Stem

Phase 0: Replacing leaf-stems 𝑣 6 𝑢 5 𝑣 5 𝑣 1 𝑣 2 𝑣 3 𝑣 4 𝑣 5 𝑤 5 𝑤 5 𝑣 4 𝑢 4 𝑢 3 𝑢 4 𝑢 5 𝑣 3 𝑢 3 The center covering π( 𝑣 3 , 𝑣 5 ) is determined by 𝑤 5 and a backbone or a thorn below 𝑣 5 . 𝑤 2 𝑣 2 The 2D sublist LP queries: The optimal 𝜆 is the y-coordinate of the lowest common intersections of half-planes. 𝑣 1

Phase 1: a sub-linear decision algorithm Perform a stem partition Partition stems into substems of size r

Phase 1: an 𝑂( 𝑛 𝑟 log 𝑟 3 ) decision algorithm 𝑂 𝑛 log 𝑛 Preprocessing work: Compute half-planes as described in phase 0 Test 𝜆 values of sub-stems until 𝑂( (log 𝑛 ) 2 ) remains Build data structures for sub-stems whose all 𝜆 values have been tested. With those data structures, the feasibility test of any value can be done in on this stem tree in 𝑂( 𝑛 𝑟 log 𝑟 3 ) time.

An O(n)-time decision algorithm Place centers on 𝑇 from bottom to top in a greedy manner 𝑣 15 If 𝑤 1 𝑑 𝑣 1 , 𝑣 3 ≥𝜆, place a center at 𝑞 1 on edge (v1,v3) Otherwise, do not place a center 𝑣 8 𝑣 14 At every vertex 𝑣, maintain two values sup⁡(𝑣) and dem⁡(𝑣) 𝑣 3 𝑣 7 𝑣 13 𝑞 1 𝑣 9 𝑣 4 𝑣 1 𝑣 2 𝑣 5 𝑣 6 𝑣 10 𝑣 11 𝑣 12 𝑤 1 𝑑 𝑞 1 , 𝑣 1 =𝜆 --- 𝑞 1 is the furthest center covering v 1

An O(n)-time decision algorithm For any vertex 𝑣 𝑖 , e.g., 𝑣 8 If sup 𝑣 8 <dem⁡( 𝑣 8 ), place a center at a distance of dem⁡( 𝑣 8 ) from 𝑣 8 on the edge (v8,v15); otherwise, all vertices in the subtree of v8 are covered. 𝑣 15 𝑞 𝑇( 𝑣 8 ) 𝑣 8 𝑣 14 𝑣 3 𝑣 7 𝑣 13 𝑣 9 𝑣 4 𝑣 1 𝑣 2 𝑣 5 𝑣 6 𝑣 10 𝑣 11 𝑣 12 Note 𝑞 is the furthest center covering all vertices in the subtree of 𝑣 8