## Incremental Topological Ordering and Strong Component Maintenance (2008)

Citations: | 3 - 1 self |

### BibTeX

@MISC{Haeupler08incrementaltopological,

author = {Bernhard Haeupler and Siddhartha Sen and Robert E. Tarjan},

title = {Incremental Topological Ordering and Strong Component Maintenance},

year = {2008}

}

### OpenURL

### Abstract

Abstract. We present an on-line algorithm for maintaining a topological order of a directed acyclic graph as arcs are added, and detecting a cycle when one is created. Our algorithm takes O(m 1/2) amortized time per arc, where m is the total number of arcs. For sparse graphs, this bound improves the best previous bound by a logarithmic factor and is tight to within a constant factor for a natural class of algorithms that includes all the existing ones. Our main insight is that the bidirectional search method of previous algorithms does not require an ordered search, but can be more general. This allows us to avoid the use of heaps (priority queues) entirely. Instead, the deterministic version of our algorithm uses (approximate) median-finding. The randomized version of our algorithm avoids this complication, making it very simple. We extend our topological ordering algorithm to give the first detailed algorithm for maintaining the strong components of a directed graph, and a topological order of these components, as arcs are added. This extension also has an amortized time bound of O(m 1/2) per arc. 1

### Citations

992 | Depth first search and linear graph algorithms
- Tarjan
- 1972
(Show Context)
Citation Context ... topologically ordered. Given a fixed n-vertex, m-arc graph, a topological order can be found in O(n + m) time by either of two algorithms: repeated deletion of sources [17, 18] or depth-first search =-=[33]-=-. The former method extends to the enumeration of all possible topological orderings. Strong components, and a topological order of them, can also be found in O(n+m) time by depth-first search, either... |

706 |
Data Structures and Algorithms
- Aho, Hopcroft, et al.
- 1983
(Show Context)
Citation Context ...he enumeration of all possible topological orderings. Strong components, and a topological order of them, can also be found in O(n+m) time by depth-first search, either one-way [33, 7, 10] or two-way =-=[1, 32]-=-. In some applications, the graph is not fixed but changes over time. The incremental topological ordering problem is that of maintaining a topological order of a directed graph as arcs are added, sto... |

603 | Data Structures and Network Algorithms - Tarjan - 1983 |

369 | Time bounds for selection
- Blum, Floyd, et al.
- 1973
(Show Context)
Citation Context ...ny element that is no less than ɛg and no greater than ɛg of the elements, for some constant ɛ > 0. The median is a 1/2-approximate median. Finding the median or an approximate median takes O(g) time =-=[6, 31]-=-. An alternative is to choose the soft threshold uniformly at random from the appropriate set. This gives a very simple yet efficient randomized algorithm. Lemma 4. If each soft threshold is an ɛ-appr... |

332 |
The Art of Computer Programming, volume 1: Fundamental Algorithms
- Knuth
- 1973
(Show Context)
Citation Context ...lic; thus the components can be topologically ordered. Given a fixed n-vertex, m-arc graph, a topological order can be found in O(n + m) time by either of two algorithms: repeated deletion of sources =-=[17, 18]-=- or depth-first search [33]. The former method extends to the enumeration of all possible topological orderings. Strong components, and a topological order of them, can also be found in O(n+m) time by... |

254 |
Efficiency of a good but not linear set union algorithm
- Tarjan
(Show Context)
Citation Context ...ives correctness. Before analyzing the running time of the algorithm, we fill in some implementation details. We represent the vertex sets of the strong components using a disjoint set data structure =-=[34, 36]-=-. Each set has a distinguished vertex, defined by the data structure, that represents the set. Two operations are possible: – find(x): return the representative of the set containing x; – link(x, y): ... |

199 |
Design and implementation of an efficient priority queue
- BOAS, KAAS, et al.
- 1977
(Show Context)
Citation Context ...1. 3 Compatible Search via a Soft Threshold The running time of an ordered search can be reduced further, even for sparse graphs, by using a faster heap implementation, such as those of van Emde Boas =-=[39, 38]-=-, Thorup [37], and Han and Thorup [11]. But we can do even better, avoiding the use of heaps entirely, by exploiting the flexibility of compatible search. What we need is a way to find a pair of candi... |

155 |
Two algorithms for maintaining order in a list
- Dietz, Sleator
(Show Context)
Citation Context ...or two vertices x and y takes O(1) time, as does deleting a vertex from the order and reinserting it just before or just after another vertex. The dynamic ordered list structures of Dietz and Sleator =-=[8]-=- and Bender et al. [5] meet these requirements: their structures take O(1) time worst-case for an order query or a deletion, and O(1) time for an insertion, amortized or worst-case depending on the st... |

120 |
Structured Models: An Introduction to the Theory of Directed Graphs
- Norman, Cartwright
- 1965
(Show Context)
Citation Context ... of a directed graph is a total order of the vertices such that for every arc (v, w), O(v) < O(w). A directed graph has a topological order (and in general more than one) if and only if it is acyclic =-=[12]-=-. A directed graph is strongly connected if, for each pair of vertices v and w, there is a path from v to w. The strongly connected components of a directed graph are its maximal strongly connected in... |

112 | Partial online cycle elimination in inclusion constraint graphs
- Fahndrich, Foster, et al.
- 1998
(Show Context)
Citation Context ..., and a different algorithm with an amortized time bound per arc addition of O(n 2.5 /m). The problem of maintaining strong components incrementally has received much less attention. Fähndrich et al. =-=[9]-=- gave an algorithm that searches for the possible new strong component after each arc addition; their algorithm does not maintain a topological order of components. Pearce [23] and Pearce et al. [24] ... |

112 |
Emde Boas. Preserving order in a forest in less than logarithmic time and linear space
- van
- 1978
(Show Context)
Citation Context ...1. 3 Compatible Search via a Soft Threshold The running time of an ordered search can be reduced further, even for sparse graphs, by using a faster heap implementation, such as those of van Emde Boas =-=[39, 38]-=-, Thorup [37], and Han and Thorup [11]. But we can do even better, avoiding the use of heaps entirely, by exploiting the flexibility of compatible search. What we need is a way to find a pair of candi... |

109 |
Leeuwen. Worst-case analysis of set union algorithms
- Tarjan, van
(Show Context)
Citation Context ...ives correctness. Before analyzing the running time of the algorithm, we fill in some implementation details. We represent the vertex sets of the strong components using a disjoint set data structure =-=[34, 36]-=-. Each set has a distinguished vertex, defined by the data structure, that represents the set. Two operations are possible: – find(x): return the representative of the set containing x; – link(x, y): ... |

71 |
Incremental evaluation of computational circuits
- Alpern, Hoover, et al.
- 1990
(Show Context)
Citation Context ...ering problem is that of maintaining a topological order of a directed graph as arcs are added, stopping when addition of an arc creates a cycle. This problem arises in incremental circuit evaluation =-=[3]-=-, pointer analysis [26], management of compilation dependencies [20, 22],s2 and deadlock detection [4]. In some applications cycles are not fatal; strong components, and a topological order of them, m... |

64 |
Finding the median
- SCHONHAGE, PATERSON, et al.
- 1976
(Show Context)
Citation Context ...ny element that is no less than ɛg and no greater than ɛg of the elements, for some constant ɛ > 0. The median is a 1/2-approximate median. Finding the median or an approximate median takes O(g) time =-=[6, 31]-=-. An alternative is to choose the soft threshold uniformly at random from the appropriate set. This gives a very simple yet efficient randomized algorithm. Lemma 4. If each soft threshold is an ɛ-appr... |

61 | Two simplified algorithms for maintaining order in a list
- Bender, Cole, et al.
- 2002
(Show Context)
Citation Context ...y takes O(1) time, as does deleting a vertex from the order and reinserting it just before or just after another vertex. The dynamic ordered list structures of Dietz and Sleator [8] and Bender et al. =-=[5]-=- meet these requirements: their structures take O(1) time worst-case for an order query or a deletion, and O(1) time for an insertion, amortized or worst-case depending on the structure. For us an amo... |

34 |
A Strong-connectivity Algorithm and Its Applications in Data Flow Analysis
- Sharir
- 1981
(Show Context)
Citation Context ...he enumeration of all possible topological orderings. Strong components, and a topological order of them, can also be found in O(n+m) time by depth-first search, either one-way [33, 7, 10] or two-way =-=[1, 32]-=-. In some applications, the graph is not fixed but changes over time. The incremental topological ordering problem is that of maintaining a topological order of a directed graph as arcs are added, sto... |

30 | Path-based depth-first search for strong and biconnected components
- Gabow
- 2000
(Show Context)
Citation Context ...mer method extends to the enumeration of all possible topological orderings. Strong components, and a topological order of them, can also be found in O(n+m) time by depth-first search, either one-way =-=[33, 7, 10]-=- or two-way [1, 32]. In some applications, the graph is not fixed but changes over time. The incremental topological ordering problem is that of maintaining a topological order of a directed graph as ... |

29 |
Integer sorting in O(n √ log log n) expected time and linear space
- Han, Thorup
- 2002
(Show Context)
Citation Context ...d The running time of an ordered search can be reduced further, even for sparse graphs, by using a faster heap implementation, such as those of van Emde Boas [39, 38], Thorup [37], and Han and Thorup =-=[11]-=-. But we can do even better, avoiding the use of heaps entirely, by exploiting the flexibility of compatible search. What we need is a way to find a pair of candidate vertices for a traversal step: an... |

29 | Improved dynamic reachability algorithms for directed graphs. FOCS 2002. Liam Roditty and Uri
- Zwick
(Show Context)
Citation Context ... topological order of strong components. In this problem, arc deletions are harder to handle, since one arc deletion can cause a strong component to split into several smaller ones. Roditty and Zwick =-=[29]-=- presented a randomized algorithm for maintaining strong components under 11s12 representative incoming (non-loop) arc incoming loop arc local pointer global (representative) pointer x Fig. 3. Data st... |

27 | Integer priority queues with decrease key in constant time and the single source shortest paths problem
- Thorup
(Show Context)
Citation Context ...earch via a Soft Threshold The running time of an ordered search can be reduced further, even for sparse graphs, by using a faster heap implementation, such as those of van Emde Boas [39, 38], Thorup =-=[37]-=-, and Han and Thorup [11]. But we can do even better, avoiding the use of heaps entirely, by exploiting the flexibility of compatible search. What we need is a way to find a pair of candidate vertices... |

27 | A fully dynamic reachability algorithm for directed graphs with an almost linear update time
- Roditty, Zwick
- 2004
(Show Context)
Citation Context ...ch graph change, even for the simplest problem, that of cycle detection. There has been quite a bit of work on the harder problem of maintaining full reachability information for a dynamic graph. See =-=[29, 30]-=-. For the incremental topological ordering problem there are a couple of lower bounds, but there are large gaps between the existing lower bounds and the upper bounds. Ramalingam and Reps [28] gave a ... |

25 |
Persistent lists with catenation via recursive slow-down
- Kaplan, Tarjan
- 1995
(Show Context)
Citation Context ...B indicates the first vertex on F , this pointer is moved to the back, and l and s are updated. A deque R that operates in the same way stores the backward vertices. Both F and R are actually steques =-=[13]-=- (stack-ended queues or output-restricted deques [17]), since deletions are only from the front. Thus each can be implemented as an array or as a singly-linked, possibly circular list. The dynamic ord... |

22 |
A structured program to generate all topological sorting arrangements
- Knuth, Szwarcfiter
- 1974
(Show Context)
Citation Context ...lic; thus the components can be topologically ordered. Given a fixed n-vertex, m-arc graph, a topological order can be found in O(n + m) time by either of two algorithms: repeated deletion of sources =-=[17, 18]-=- or depth-first search [33]. The former method extends to the enumeration of all possible topological orderings. Strong components, and a topological order of them, can also be found in O(n+m) time by... |

22 |
Maintaining a topological order under edge insertions
- Marchetti-Spaccamela, Nanni, et al.
- 1996
(Show Context)
Citation Context ...dition, but this would require O(n+m) time per arc. Our goal is to do better. The incremental topological ordering problem has received much attention, especially recently. MarchettiSpaccamela et al. =-=[21]-=- gave an algorithm that takes O(n) amortized time per arc addition. Alpern et al. [3] gave an algorithm that handles batched arc additions and has a good time bound in an incremental model of computat... |

21 | Online cycle detection and difference propagation for pointer analysis
- Pearce, Kelly, et al.
- 2003
(Show Context)
Citation Context ...of maintaining a topological order of a directed graph as arcs are added, stopping when addition of an arc creates a cycle. This problem arises in incremental circuit evaluation [3], pointer analysis =-=[26]-=-, management of compilation dependencies [20, 22],s2 and deadlock detection [4]. In some applications cycles are not fatal; strong components, and a topological order of them, must be maintained. For ... |

19 | Online graph algorithms for incremental compilation
- Marchetti-Spaccamela, Nanni, et al.
- 1993
(Show Context)
Citation Context ...ted graph as arcs are added, stopping when addition of an arc creates a cycle. This problem arises in incremental circuit evaluation [3], pointer analysis [26], management of compilation dependencies =-=[20, 22]-=-,s2 and deadlock detection [4]. In some applications cycles are not fatal; strong components, and a topological order of them, must be maintained. For example, pointer analysis can optimize work based... |

19 |
On the Computational Complexity of Incremental Algorithms
- Ramalingam, Reps
- 1991
(Show Context)
Citation Context ...ernatively a tighter analysis of their algorithm. We have used amortized running time as our measure of efficiency. An alternative way to measure efficiency is to use an incremental competitive model =-=[27]-=-, in which the time spent to handle an arc addition is compared against the minimum work that must be done by any algorithm, given the same current topological order and the same arc addition. The min... |

17 | Algorithms for dense graphs and networks on the random access computer
- Cheriyan, Mehlhorn
- 1996
(Show Context)
Citation Context ...mer method extends to the enumeration of all possible topological orderings. Strong components, and a topological order of them, can also be found in O(n+m) time by depth-first search, either one-way =-=[33, 7, 10]-=- or two-way [1, 32]. In some applications, the graph is not fixed but changes over time. The incremental topological ordering problem is that of maintaining a topological order of a directed graph as ... |

17 |
Online topological ordering
- Katriel, Bodlaender
- 2005
(Show Context)
Citation Context ...s O(n) amortized time per arc addition. Alpern et al. [3] gave an algorithm that handles batched arc additions and has a good time bound in an incremental model of computation. Katriel and Bodlaender =-=[15]-=- showed that a variant of the algorithm of Alpern et al. takes O(min{m 1/2 log n, m 1/2 +(n 2 log n)/m}) amortized time per arc addition. Liu and Chao [19] tightened this analysis to Θ(m 1/2 + n 1/2 l... |

16 | A dynamic topological sort algorithm for directed acyclic graphs
- Pearce, Kelly
(Show Context)
Citation Context ...f Alpern et al. takes O(min{m 1/2 log n, m 1/2 +(n 2 log n)/m}) amortized time per arc addition. Liu and Chao [19] tightened this analysis to Θ(m 1/2 + n 1/2 log n) per arc addition. Pearce and Kelly =-=[25]-=- gave an algorithm with an inferior asymptotic time bound that they claimed was fast in practice on sparse graphs. Ajwani et al. [2] gave an algorithm with an amortized time per arc addition of O(n 2.... |

15 |
On competitive on-line algorithms for the dynamic priorityordering problem
- Ramalingam, Reps
- 1994
(Show Context)
Citation Context ...See [29, 30]. For the incremental topological ordering problem there are a couple of lower bounds, but there are large gaps between the existing lower bounds and the upper bounds. Ramalingam and Reps =-=[28]-=- gave a class of examples in which n − 1 arc additions force Ω(n log n) vertices to be reordered, no matter what topological order is maintained. This is the only general lower bound. Katriel [14] con... |

12 | An efficient deadlock avoidance technique - Belik - 1990 |

12 |
The sather language compiler/debugger implementation
- Omohundro, Lim, et al.
- 1992
(Show Context)
Citation Context ...ted graph as arcs are added, stopping when addition of an arc creates a cycle. This problem arises in incremental circuit evaluation [3], pointer analysis [26], management of compilation dependencies =-=[20, 22]-=-,s2 and deadlock detection [4]. In some applications cycles are not fatal; strong components, and a topological order of them, must be maintained. For example, pointer analysis can optimize work based... |

10 | Some directed graph algorithms and their application to pointer analysis
- Pearce
- 2005
(Show Context)
Citation Context ...ention. Fähndrich et al. [9] gave an algorithm that searches for the possible new strong component after each arc addition; their algorithm does not maintain a topological order of components. Pearce =-=[23]-=- and Pearce et al. [24] mention extending the topological ordering algorithm of Pearce and Kelly and that of Marchetti-Spaccamela et al. to the strong components problem, but they provide very few det... |

9 | An O(n 2.75 ) algorithm for online topological ordering
- Ajwani, Friedrich, et al.
(Show Context)
Citation Context ...lysis to Θ(m 1/2 + n 1/2 log n) per arc addition. Pearce and Kelly [25] gave an algorithm with an inferior asymptotic time bound that they claimed was fast in practice on sparse graphs. Ajwani et al. =-=[2]-=- gave an algorithm with an amortized time per arc addition of O(n 2.75 /m), which for dense graphs is better than the bound of Liu and Chao. Finally, Kavitha and Mathew [16] improved the results of bo... |

9 |
On algorithms for online topological ordering and sorting
- Katriel
- 2004
(Show Context)
Citation Context ...eps [28] gave a class of examples in which n − 1 arc additions force Ω(n log n) vertices to be reordered, no matter what topological order is maintained. This is the only general lower bound. Katriel =-=[14]-=- considered what she called the topological sorting problem, in which the topological order must be maintained as an explicit map between the vertices and the integers between 1 and n. For algorithms ... |

8 |
A tight analysis of the katriel–bodlaender algorithm for online topological ordering
- Liu, Chao
(Show Context)
Citation Context ...model of computation. Katriel and Bodlaender [15] showed that a variant of the algorithm of Alpern et al. takes O(min{m 1/2 log n, m 1/2 +(n 2 log n)/m}) amortized time per arc addition. Liu and Chao =-=[19]-=- tightened this analysis to Θ(m 1/2 + n 1/2 log n) per arc addition. Pearce and Kelly [25] gave an algorithm with an inferior asymptotic time bound that they claimed was fast in practice on sparse gra... |

7 | Online algorithms for topological order and strongly connected components, tech. report
- Pearce, Kelly
- 2003
(Show Context)
Citation Context ...n [4]. In some applications cycles are not fatal; strong components, and a topological order of them, must be maintained. For example, pointer analysis can optimize work based on cyclic relationships =-=[24]-=-. In considering the incremental topological ordering and strong components problems, we shall assume that the vertex set is fixed and specified initially, and that the arc set is initially empty. One... |

5 | Faster algorithms for online topological ordering
- Kavitha, Mathew
- 2007
(Show Context)
Citation Context ...parse graphs. Ajwani et al. [2] gave an algorithm with an amortized time per arc addition of O(n 2.75 /m), which for dense graphs is better than the bound of Liu and Chao. Finally, Kavitha and Mathew =-=[16]-=- improved the results of both Liu and Chao and Ajwani et al. by presenting another variant of the algorithm of Alpern et al. with an amortized time bound per arc addition of O(m 1/2 + (n log n)/m 1/2 ... |