Linear-Time Algorithms for Dominators and Other Path-Evaluation Problems

  • Authors:
  • Adam L. Buchsbaum;Loukas Georgiadis;Haim Kaplan;Anne Rogers;Robert E. Tarjan;Jeffery R. Westbrook

  • Affiliations:
  • alb@adambuchsbaum.com;lgeorg@uowm.gr;haimk@math.tau.ac.il;amr@cs.uchicago.edu;ret@cs.princeton.edu;jwestbrook@acm.org

  • Venue:
  • SIAM Journal on Computing
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present linear-time algorithms for the classic problem of finding dominators in a flowgraph, and for several other problems whose solutions require evaluating a function defined on paths in a tree. Although all these problems had linear-time solutions previously, our algorithms are simpler, in some cases substantially. Our improvements come from three new ideas: a refined analysis of path compression that gives a linear bound if the compressions favor certain nodes; replacement of random-access table look-up by a radix sort; and a more careful partitioning of a tree into easily managed parts. In addition to finding dominators, our algorithms find nearest common ancestors off-line, verify and construct minimum spanning trees, do interval analysis of a flowgraph, and build the component tree of a weighted tree. Our algorithms do not require the power of a random-access machine; they run in linear time on a pointer machine. The genesis of our work was the discovery of a subtle error in the analysis of a previous allegedly linear-time algorithm for finding dominators. That algorithm was an attempt to simplify a more complicated algorithm, which itself was intended to correct errors in a yet earlier algorithm. Our work provides a systematic study of the subtleties in the dominators problem, the techniques needed to solve it in linear time, and the range of application of the resulting methods. We have tried to make our techniques as simple and as general as possible and to understand exactly how earlier approaches to the dominators problem were either incorrect or overly complicated.