A new approach to incremental topological ordering

  • Authors:
  • Michael A. Bender;Jeremy T. Fineman;Seth Gilbert

  • Affiliations:
  • Stony Brook University;CSAIL, MIT;EPFL

  • Venue:
  • SODA '09 Proceedings of the twentieth Annual ACM-SIAM Symposium on Discrete Algorithms
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

Let G = (V, E) be a directed acyclic graph (dag) with n = |V| and m = |E|. We say that a total ordering ≺ on vertices V is a topological ordering if for every edge (u, v) ∈ E, we have u ∈ v. In this paper, we consider the problem of maintaining a topological ordering subject to dynamic changes to the underlying graph. That is, we begin with an empty graph G = (V, ø) consisting of n nodes. The adversary adds m edges to the graph G, one edge at a time. Throughout this process, we maintain an online topological ordering of the graph G. In this paper, we present a new algorithm that has a total cost of O(n2logn) for maintaining the topological ordering throughout all the edge additions. At the heart of our algorithm is a new approach for maintaining the ordering. Instead of attempting to place the nodes in an ordered list, we assign each node a label that is consistent with the ordering, and yet can be updated efficiently as edges are inserted. When the graph is dense, our algorithm is more efficient than existing algorithms. By way of contrast, the best known prior algorithms achieve only O(min(m1.5, n2.5)) cost.