Dominator Certification and Independent Spanning Trees - Springer Link

2 downloads 10707 Views 254KB Size Report
Department of Computer Science, University of Ioannina, Greece [email protected], ... We present the first implementations of certified algorithms for computing ...
Dominator Certification and Independent Spanning Trees: An Experimental Study Loukas Georgiadis1 , Luigi Laura2, Nikos Parotsidis1, and Robert E. Tarjan3 1

3

Department of Computer Science, University of Ioannina, Greece [email protected], [email protected] 2 Dip. di Ingegneria Informatica, Automatica e Gestionale “Sapienza” Universit` a di Roma [email protected] Department of Computer Science, Princeton University, 35 Olden Street, Princeton, NJ, 08540, and Hewlett-Packard Laboratories [email protected]

Abstract. We present the first implementations of certified algorithms for computing dominators, and exhibit their efficiency experimentally on graphs taken from a variety of applications areas. The certified algorithms are obtained by augmenting dominator-finding algorithms to compute a certificate of correctness that is easy to verify. A suitable certificate for dominators is obtained from the concepts of low-high orders and independent spanning trees. Therefore, our implementations provide efficient constructions of these concepts as well, which are interesting in their own right. Furthermore, we present an experimental study of efficient algorithms for computing dominators on large graphs.

1

Introduction

A flow graph is a directed graph with a distinguished start vertex s such that every vertex is reachable from s. Throughout this paper G = (V, A, s) is a flow graph with vertex set V , arc set A, start vertex s, and no arc entering s. (Arcs entering s can be deleted without affecting any of the concepts we study.) We denote the number of vertices by n and the number of arcs by m (m ≥ n − 1). A fundamental concept in flow graphs is that of dominators. A vertex u is a dominator of a vertex v (u dominates v) if every path from s to v contains u; u is a proper dominator of v if u dominates v and u = v. The dominator relation is reflexive and transitive. Its transitive reduction is a rooted tree, the dominator tree D: v dominates w if and only if v is an ancestor of w in D. If v = s, d(v), the parent of v in D, is the immediate dominator of v: it is the unique proper dominator of v that is dominated by all proper dominators of v. Dominators have applications in diverse areas including program optimization and code generation [11], constraint programming [32], circuit testing [4], theoretical biology [2], memory profiling [27], connectivity and path-determination problems [15,16,24], and the analysis of diffusion networks [22]. Allen and Cocke showed that the dominance relation can be computed iteratively from a set of V. Bonifaci et al. (Eds.): SEA 2013, LNCS 7933, pp. 284–295, 2013. c Springer-Verlag Berlin Heidelberg 2013 

Dominator Certification and Independent Spanning Trees

285

data-flow equations [1]. A direct implementation of this method has an O(mn2 ) worst-case time bound, for a flowgraph with n vertices and m edges. Cooper, Harvey, and Kennedy [10] presented a clever tree-based space-efficient implementation of the iterative algorithm. Although it does not improve the O(mn2 ) worst-case time bound, the tree-based version is much more efficient in practice. Purdom and Moore [31] gave an algorithm, based on reachability, with complexity O(mn). Improving on previous work by Tarjan [34], Lengauer and Tarjan [25] gave two near-linear-time algorithms for computing D that run fast in practice and have been used in many of these applications. The simpler of these runs in O(m log(m/n+1) n) time. The other runs in O(mα(m, n)) time, where α is a functional inverse of Ackermann’s function [35]. Subsequently, more-complicated but truly linear-time algorithms were discovered [3,6,7,17]. In [18,19,20] the problem of verifying the dominator tree of a flow graph was considered: we wish for a simple way to verify that the tree produced by one of the fast but complicated dominator-finding algorithms is in fact the dominator tree. The correctness of a simpler but less efficient algorithm for computing dominators has been mechanically verified [37], but to our knowledge none of the fast algorithms has had its correctness mechanically verified. The approach in [19,20] was to augment the dominator-finding algorithm to compute additional information, a certificate of correctness. The verifier uses the certificate to make dominator verification easier. This makes the dominator-finding algorithm a certifying algorithm [28]. A suitable certificate for dominators is that of a low-high order of a flow graph and a rooted tree. Let T be a rooted tree. We denote by t(v) the parent of vertex v; t(v) = null if v is the root of T . If v is an ancestor of w, T [v, w] is the path from v to w. Tree T is flat if its root is the parent of every other vertex. Given a tree T rooted at s with vertex set V (not necessarily a spanning tree of G), a preorder of T is low-high on G if, for all v = s, (t(v), v) ∈ A or there are two arcs (u, v) ∈ A, (w, v) ∈ A such that u is less than v, v is less than w, and w is not a descendant of v. See Figure 1. Low-high orders are related to the notion of independent spanning trees. Two spanning trees B and R rooted at s are independent if for all v, B[s, v] and R[s, v] share only the dominators of v; B and R are strongly independent if for every pair of vertices v and w, either B[s, v] and R[s, w] share only the common dominators of v and w, or B[s, w] and R[s, v] share only the common dominators of v and w. Given a low-high order it is easy to construct in O(n) time two strongly independent spanning trees, and, conversely, given two independent spanning trees we can construct a low-high order in O(n) time [19,20]. These three definitions are interesting in their own right, and have applications in other graph problems [19]. Previously, they were considered only for flow graphs with flat dominator trees [9,23,30,36]. In this work we present efficient implementations of certified, near-linear-time algorithms for computing dominators, based on low-high orders, as described in [19]. 1 This way we also obtain efficient implementations of near-linear-time algorithms for computing a low-high order and two strongly independent spanning 1

We refer to [19] for the complete description of the algorithms and proofs of correctness.

286

L. Georgiadis et al. s[1] a[10]

s[1]

b[3]

c[2]

d[11] e[5] h[9]

g[8]

f [4]

c[2]

b[3]

i[6]

i[6]

j[7]

D

j[7]

a[10]

e[5]

f [4]

g[8]

d[11]

h[9]

G s[1] a[10]

s[1]

b[3]

c[2]

a[10]

b[3]

c[2]

d[11]

e[5]

f [4]

d[11]

e[5]

f [4]

g[8]

h[9]

i[6]

g[8]

h[9]

i[6]

j[7]

j[7] B

R

Fig. 1. A flow graph, its dominator tree with vertices numbered in low-high order (numbers in brackets), and two strongly independent spanning trees B and R.

trees of a given flow graph.2 We exhibit the efficiency of our algorithms experimentally on graphs taken from a variety of applications areas. Furthermore, we present experimental results for various efficient algorithms for computing dominators. A previous experimental study of algorithms for computing dominators was presented in [21], where careful implementations of both versions of the Lengauer-Tarjan algorithm, the iterative algorithm of Cooper, Harvey, and Kennedy, and a new hybrid algorithm (snca) were given. In these experimental results the performance of all these algorithms was similar, but the simple version of the Lengauer-Tarjan algorithm and the hybrid algorithm were most consistently fast, and their advantage increased as the input graph got bigger or more complicated. The graphs used in [21] have moderate size (at most a few thousand vertices and edges) and simple enough structure that they can be efficiently processed by the iterative algorithm. In our experiments we deal with larger and more complicated graphs for which simple iterative algorithms are not competitive with the more sophisticated algorithms based on Lengauer-Tarjan.

2

Dominator Certification

Let T be a rooted tree whose vertex set is V . Tree T has the parent property if for all (v, w) ∈ A, t(w) (the parent of w in T ) is an ancestor of v in T . Since 2

Similarly, we can obtain truly linear-time algorithms by augmenting the linear-time algorithm for computing dominators in [6].

Dominator Certification and Independent Spanning Trees

287

s has no entering arcs, but every other vertex has at least one entering arc (all vertices are reachable from s), the parent property implies that T is rooted at s. Tree T has the sibling property if v does not dominate w for all siblings v and w. The parent and sibling properties are necessary and sufficient for a tree to be the dominator tree. Theorem 1. [19,20] A tree T has the parent and sibling properties if and only if T = D. By Theorem 1, to verify that a tree T is the dominator tree, it suffices to show (1) T is a rooted tree, (2) T has the parent property, and (3) T has the sibling property. It is straightforward to verify (1) and (2) in O(m + n) time as follows. We execute a preorder traversal of T , assigning a preorder number pre(v) from 1 to n to each vertex v, and computing the number of descendants size(v) of v. To verify (1) we simply check if size(s) = n. To verify (2), we use the fact that v is an ancestor of w if and only if pre(v) ≤ pre(w) < pre(v) + size(v) [33]. This takes O(1) time per arc, for a total of O(m) time. If T is given by its parent function, we can number the vertices and compute their sizes by first building a list of children for each vertex and then doing a depth-first traversal, all of which take O(n) time. The hardest step in verification is to show (3), but the use of a low-high order gives a straightforward test. Theorem 2. [19,20] A tree with the parent property has the sibling property, and hence is the dominator tree, if and only if it has a low-high order with respect to G. Given a tree T with the parent property and a preorder ord , we can test the sibling property by performing the following steps. Construct lists of the children of each vertex in T in increasing order with respect to ord . Do a depth-first traversal of T to verify that the preorder generated by the search is the same as ord and to compute the size of each vertex. Check that each vertex has the one or two entering arcs needed to make ord a low-high order, using the numbers and sizes to test the ancestor-descendant relation in O(1) time. Although it is easy to test if a given order is low-high, it is not so easy to test for the existence of a low-high order. Thus we place the burden of constructing such an order on the algorithm that computes the dominator tree, not on the verification algorithm: the order certifies the correctness of the tree. Furthermore, an algorithm that computes the dominator tree and a low-high order does not need to output the low-high order explicitly. It suffices to output the edges of the dominator tree in an order such that an edge (u, v) precedes (u, w) if and only if v is less than w in the low-high order. A verification algorithm can then perform the verification steps (1)-(3) concurrently. In the following section we will refer to this verification algorithm as verify. 2.1

Low-High Orders and Independent Spanning Trees

An efficient way to construct a low-high order of G is via two independent spanning trees. In [18,19] it is shown that two such spanning trees can be computed

288

L. Georgiadis et al.

by a simple extension of the fast algorithms for finding dominators [3,6,25]. This extension requires additional O(n) time and space computations. Let F be a depth-first spanning tree of G rooted at s, with vertices numbered from 1 to n as they are first visited by the search. Identify vertices by number. A path from u to v is high if all its vertices other than u and v are higher than both u and v. If v = s, the semi-dominator of v, sd (v), is the minimum vertex u such that there is a high path from u to v. Vertex sd (v) is the ancestor u of v in F closest to s such that there is a path from u to v avoiding all other vertices on F [u, v] (the path in F from u to v) [25]. Since there is a path from s to v avoiding all vertices on F [sd (v), v] except sd (v) and v, d(v) ≤ sd (v). The relative dominator rd (v) is the vertex x on F (sd (v), v] (the path in F from a child of sd (v) to v) such that sd (x) is minimum, with a tie broken in favor of the smallest x. The algorithm to construct two independent spanning trees, B and R, processes the vertices in increasing order. For each vertex v = s it chooses one of f (v) and g(v) to be the parent b(v) of v in B and the other to be the parent r(v) of v in R, as follows: if sd (v) = sd (rd (v)) or b(rd (v)) = f (rd (v)), set b(v) = g(v) and r(v) = f (v); otherwise, set b(v) = f (v) and r(v) = g(v). We will refer to this algorithm in the next section as sltist. For the computation of a low-high order it is convenient to modify the above construction as follows. For each vertex v = s, if (d(v), v) is an arc of G then replace b(v) and r(v) by d(v). Clearly, B and R remain independent spanning trees of G after this modification. 2.2

Derived Arcs

The next step of the construction is to compute the derived arcs of B and R. Let (v, w) be an arc of G. By the parent property, d(w) is an ancestor of v in D. The derived arc of (v, w) is null if w is an ancestor of v in D, (v  , w) otherwise, where v  = v if v = d(w), v  is the sibling of w that is an ancestor of v if v = d(w). Given a list of arcs L we can compute in O(n + |L|) time the derived arcs of all arcs in L using a three-pass radix sort. See [19] for the details. 2.3

Construction of a Low-High Order

Let B  and R be the graphs formed, respectively, by the derived arcs of B and R. Let G be the union of B  and R . Then, G and G have the same dominator tree, and B  and R are independent spanning trees of G . Given B  , R and G we can compute a low-high order of D as follows. For each v, initialize its list of children C(v) to be empty. Then apply the following reduction step. If G contains only one vertex v = s, insert v anywhere in C(s). Otherwise, let v be a vertex whose in-degree in G exceeds its number of children in B  plus its number of children in R . Assume v is a leaf in R ; proceed symmetrically if v is a leaf in B  . If v is not a leaf in B  , let w be its child in B  , and replace b (w) by b (v). Delete v, and apply the reduction step recursively to insert the remaining vertices other than s into lists of children. If b (v) = d(v), insert v anywhere in C(d(v)); otherwise, insert v just before b (v) in C(d(v)) if

Dominator Certification and Independent Spanning Trees

289

r (v) is before b (v) in C(d(v)), just after b (v) otherwise. After processing all vertices, do a depth-first traversal of D, visiting the children of each vertex v in their order in C(v). Number the vertices from 1 to n as they are visited. The resulting order is low-high on G. In order to implement this algorithm we need to specify how to: (1) perform the insert operations in each list of children, and (2) maintain G , B  and R as the algorithm removes vertices during the reduction step. The first problem is a special case of the dynamic list maintenance problem [5,13], for which a simple solution that supports insertions and order tests in O(1) time is given in [19]. For problem (2), we can maintain the parents in B  and R easily using two arrays that store the corresponding parent functions. Also, instead of storing the adjacency lists of G it is more convenient to store the adjacency lists of B  and R using three integer arrays, each of size n. Consider the structure for B  . The first array, list B  , stores the vertices sorted in increasing order by parent in B  , the second array, first B  , stores the position in list B  of the first child of each vertex, and the third array, position B  , stores the position of each vertex in list B  . Consider vertex v that is removed in an application of the reduction step. If v is a leaf in B  then we set list B  [position B  [v]] = null . Otherwise, let w be the (unique) child of v in B  . To find w, we search for the first (and only) child of v in first B  that is not null. Then we set list B  [position B  [v]] = w and position B  [w] = position B  [v]. The structure for R is updated similarly. Since we search the list of children of a vertex v only once (when v is removed) the total running time for updating B  and R is O(n). In the next section, we will refer to this algorithm as sltcert. 2.4

Alternative Construction of a Low-High Order

In [19] it is conjectured that the spanning trees B and R computed by the algorithm described in Section 2.1 can be generated from some low-high order of D. That is, there is an order of the vertices such that for each vertex v, b(v) < v < r(v) if b(v) = r(v), and b(v) = r(v) = d(v) < v otherwise. This conjecture is supported by our experimental results, but we have no proof. If the conjecture holds, then we can compute a low-high order with the following simpler alternative to the algorithm of Section 2.3. Construct the independent spanning trees B  and R of the derived graph, as in Section 2.2. Form the graph K whose arcs are all those in B  and the reversals of all arcs in R that are not in B  . Find a topological order of K. For each vertex v = s, arrange its children in D in an order consistent with the topological order of K. The preorder on D corresponding to its ordered lists of children will be a low-high order. We will refer to this algorithm in the next section as sltcert-ii.

3

Empirical Analysis

We evaluate the performance of eight algorithms, four to compute dominators (the simple (slt) and the sophisticated (lt) versions of the LengauerTarjan algorithm [25], the hybrid algorithm (snca) of [21], and the iterative

290

L. Georgiadis et al.

algorithm of Cooper, Harvey, and Kennedy (chk) [10]), the simple version of the Lengauer-Tarjan algorithm augmented to compute two independent spanning trees (sltist), two versions of a certified simple version of the Lengauer-Tarjan algorithm (sltcert and sltcert-ii), and the low-high verification algorithm (verify). For the first four algorithms we adapted the implementations from [21]. Our implementations of the independent spanning trees constructions and the certified algorithms are based upon slt which usually performs better than lt in practice and it is easier to code. We made all implementations as efficient and uniform as we could, within reason. (Of course, there might be room for further improvements.) Both certified algorithms compute a low-high order of the dominator tree via two independent spanning trees, which are computed as described in Section 2.1. Then, algorithm sltcert computes a low-high order by applying the method of Section 2.3, while algorithm sltcert-ii applies the method of Section 2.4. The latter construction of a low-high order is simpler than the former, but we have no proof that it is guaranteed to work. The algorithm detects if the construction has succeeded or not; it succeeds if and only if graph K, defined in Section 2.4, is acyclic. Of course, one can combine both methods by applying that of Section 2.3 if the method of Section 2.4 fails. In all the experiments we performed, however, the method of Section 2.4 always succeeded in computing a low-high order. We note that we cannot directly apply these methods to augment snca into a certified algorithm. The reason is that the construction of the two independent spanning trees requires the computation of relative dominators, which are not computed by snca. Experimental Setup. Our implementations have been written in C++, and the code was compiled using g++ v. 4.3.4 with full optimization (flag -O4). The source code is available from the authors upon request. We have tested our code under Windows (Seven), Mac OSX (10.8.2 Mountain Lion), and GNU/Linux Debian (6.06); the behaviour of the code was comparable on all the architectures, and therefore in the following, due to space constraints, we report only the results against the GNU/Linux machine: namely an HP Proliant server 64-bit NUMA machine composed by two AMD Opteron 6174 processors and 32GB of RAM memory. Each processor is equipped with 12 cores that share a 12MB L3 cache, and each core has a 512KB private L2 cache and 2200MHz speed. We report CPU times measured with the getrusage function. All the running times reported in our experiments were averaged over ten different runs. To minimize fluctuations due to external factors, we used the machine exclusively for tests, took each measurement three times, and picked the best. Running times do not include reading the input file (the programs read the input arcs from a text file and store them in an array), but they do include creating the graph (successor and predecessor lists, as required by each algorithm), and allocating and deallocating the arrays used by each algorithm. Instances. We conducted experiments for a collection of (mostly) large graphs, detailed in Table 1, from several distinct application domains. This collection includes road networks taken from the 9th DIMACS Implementation

Dominator Certification and Independent Spanning Trees

291

Table 1. Real-world graphs sorted by file size; n is the number of vertices, m the number of edges, and δavg is the average vertex degree. Graph rome99 s38584 Oracle-16k p2p-gnutella25 soc-Epinions1 USA-road-NY USA-road-BAY Amazon0302 web-NotreDame web-Stanford Amazon0601 wiki-Talk web-BerkStan SAP-4M Oracle-4M Oracle-11M SAP-11M LiveJournal USA road complete SAP-32M SAP-47M SAP-70M SAP-187M

n 3.3k 20.7k 15.6k 22.6k 75.8k 264k 321k 262k 325k 281k 403k 2.3M 685k 4.1M 4.1M 10.7M 11.1M 4.8M 23.9M 32.3M 47.0M 69.7M 186.9M

m 8.8k 34.4k 48.2k 54.7k 508k 733k 800k 1.2M 1.4M 2.3M 3.4M 5.0M 7.6M 12.0M 14.6M 33.9M 36.4M 68.9M 58.3M 81.9M 131.0M 215.7M 556.2M

file size δavg 98k 2.65 434k 1.67 582k 3.08 685k 2.41 5.9M 6.71 11M 2.78 12M 2.49 18M 4.71 22M 4.6 34M 8.2 49M 8.4 69M 2.1 113M 11.09 183M 2.92 246M 3.55 576M 3.18 638M 3.27 1G 14.23 1.1G 2.44 1.5G 2.53 2.2G 2.8 3.7G 3.09 11G 2.98

type road network circuit memory profiling peer2peer social network road network road network product co-purchase web graph web graph product co-purchase social network web graph memory profiling memory profiling memory profiling memory profiling social network road network memory profiling memory profiling memory profiling memory profiling

Challenge website [12], a circuit from VLSI-testing applications [4] obtained from the ISCAS’89 suite [8], graphs taken from applications of dominators in memory profiling (see e.g., [29]), and graphs taken from the Stanford Large Network Dataset Collection [26]. Almost all the graphs considered were completely reachable from the chosen root vertex; only three of them had a reachable fraction of nodes smaller than 90%: soc-Epinions (63%), web-Stanford (77%), and web-BerkStan (67%). Evaluation. We first focus on algorithms for computing dominators, in order to later provide a perspective for the other algorithms we implemented. Dominators computation. In Table 2, we present the results of the four dominatorfinding algorithms (slt, lt, snca, and chk) against small and medium scale graphs. We observe that the iterative algorithm is not competitive with the more sophisticated LT-based algorithms as the graph size increases. Among the LT-based algorithms there is no clear winner. In order to provide a better picture of the overall performances of these three algorithms, Figure 2 gives a plot of their running times in microseconds, normalized to the number of the edges. As we can see, the processing time per edge is almost constant, i.e. the values range in a very small interval. This result is consistent with what observed in [21] and, for large scale graphs, in [14].

292

L. Georgiadis et al.

Table 2. Running times against small and medium graphs, measured in seconds, of the four dominator computation algorithms considered. The best result in each row is marked in bold.

0.40 0.35 0.30 0.25 0.20 0.15 0.10 0.05 0

SAP-187M

SAP-70M

SAP-47M

USA-road LiveJournal SAP-32M

snca chk 0.001 0.003 0.007 0.010 0.003 0.003 0.006 0.006 0.053 0.083 0.061 0.624 0.070 1.130 0.39 0.96 0.10 0.51 0.27 5.68 0.47 1.41 1.14 2.14 0.33 15.64 1.07 1199.08 1.45 6.05 5.16 4583.74

Oracle-11M SAP-11M

SAP-4M Oracle-4M

slt 0.001 0.007 0.006 0.007 0.057 0.066 0.076 0.35 0.09 0.28 0.53 1.38 0.35 1.22 1.63 6.06 web-BerkStan

wiki-Talk

Amazon0601

lt 0.002 0.008 0.004 0.006 0.052 0.072 0.086 0.35 0.10 0.29 0.51 1.44 0.36 1.35 1.77 7.29

web-Stanford

m 8.8k 34.4k 48.2k 54.7k 508k 733k 800k 1.2M 1.4M 2.3M 3.4M 5.0M 7.6M 12.0M 14.6M 33.9M Amazon0302 web-NotreDame

n 3.3k 20.7k 15.6k 22.6k 75.8k 264k 321k 262k 325k 281k 403k 2.3M 685k 4.1M 4.1M 10.7M

soc-Epinions1 USA-road-NY USA-road-BAY

s38584 Oracle-16k p2p-gnutella25

rome99

Graph rome99 s38584 Oracle-16k p2p-gnutella25 soc-Epinions1 USA-road-NY USA-road-BAY Amazon0302 web-NotreDame web-Stanford Amazon0601 wiki-Talk web-BerkStan SAP-4M Oracle-4M Oracle-11M

SLT SNCA LT

0.55 0.50 0.45 0.40 0.35 0.30 0.25 0.20 0.15 0.10 0.05 0

SLT SLTCERT SLTCERT-II VERIFY

1+e4

1+e5

1+e6

1+e7

1+e8

1+e9

Fig. 2. Running times (in microsecs) normalized to the number of edges (shown in logarithmic scale)

Dominators certification. Table 3 shows the running times against medium and large scale graphs for all algorithms except chk. We also provide the running times for executing a DFS traversal of the graphs (including the time to build adjacency lists and other auxiliary arrays used by DFS), which we use as a baseline; the first step of all algorithms considered in this study is to execute a DFS on the input graph, with the exception of verify, which executes a DFS

Dominator Certification and Independent Spanning Trees

293

Table 3. Running times against medium and large graphs, measured in seconds. The best result in each row among the three dominator-finding algorithms, and between the two certified algorithms is marked in bold. Graph Amazon0302 web-NotreDame web-Stanford Amazon0601 wiki-Talk web-BerkStan SAP-4M Oracle-4M Oracle-11M SAP-11M USA road complete LiveJournal SAP-32M SAP-47M SAP-70M SAP-187M

n m dfs 262k 1.2M 0.10 325k 1.4M 0.03 281k 2.3M 0.10 403k 3.4M 0.13 2.3M 5.0M 0.32 685k 7.6M 0.15 4.1M 12.0M 0.38 4.1M 14.6M 0.54 10.7M 33.9M 1.42 10.7M 36.4M 1.27 23.9M 58.3M 3.13 4.8M 68.9M 3.08 32.3M 81.9M 3.13 47.0M 131.0M 5.13 69.7M 215.7M 7.86 186.9M 556.2M 21.44

lt 0.35 0.10 0.29 0.51 1.44 0.36 1.35 1.77 7.30 8.73 7.72 18.09 16.46 20.91 40.47 51.61

slt snca sltcert sltcert-ii verify 0.35 0.39 0.49 0.42 0.13 0.09 0.10 0.18 0.15 0.04 0.28 0.27 0.36 0.33 0.10 0.53 0.47 0.74 0.81 0.19 1.38 1.14 1.97 1.82 0.74 0.35 0.34 0.53 0.59 0.12 1.22 1.07 2.49 2.92 0.67 1.64 1.45 3.03 2.57 0.57 6.06 5.16 9.46 11.13 2.23 6.22 5.30 9.86 11.36 1.81 6.88 6.88 21.59 15.24 2.68 18.52 16.44 21.50 27.64 7.72 9.62 8.77 20.01 16.62 4.53 14.82 15.79 28.77 24.56 6.99 26.95 31.81 55.34 42.11 11.67 43.77 41.95 104.77 93.53 21.38

sltist 0.32 0.09 0.28 0.50 1.36 0.36 1.29 1.70 6.37 6.60 7.92 18.74 11.26 18.29 38.77 46.93

on the input tree. Figure 2 gives the corresponding plot of the running times, normalized to the number of the edges. The results indicate that the certified algorithms perform well in practice even for very large graphs: in all of our tests the running time of sltcert and sltcert-ii is very close to slt, and only for the largest graph they took slightly more than twice its time. With respect to dfs, we see that all algorithms are slower than dfs by a small constant factor. As already mentioned, the correctness of sltcert-ii hinges on a conjecture from [19]. We tested it on several synthetic and real world graphs (not reported in the tables) and, so far, we did not find a counterexample. Dominator tree and low-high order verification. The running time of the verification algorithm, verify, are shown in Table 3, and plotted in Figure 2. As expected, the verification algorithm is very fast, and for some inputs even faster than dfs. Independent spanning trees computation. Finally, in the last column of Table 3 we can see the running times needed to compute two independent spanning trees: the overhead needed by sltist, compared to slt that is based on, is approximately no more than 15-20%, with only one exception (43% more for the sap-70M graph).

4

Conclusion

In light of our experimental results we conclude that the use of the more elaborate algorithms for computing dominators is necessary for applications that deal with very large graphs. This, in turn, advocates for the use of practical dominator verification methods. Here we presented efficient implementations of certified algorithms for computing dominators that make verification straightforward and very fast. In the process, the algorithms compute two independent spanning trees and a low-high order of the input flow graph, which are useful in other graph algorithms. Our algorithms were based on the simple version of the Lengauer-

294

L. Georgiadis et al.

Tarjan algorithm, which is easier to implement compared to the sophisticated version, and usually performs better in practice. Acknowledgements. We thank Bob Foster for bringing to our attention the use of dominators in memory profilers and for providing the “Oracle” graphs, and Andreas Buchen and Krum Tsvetkov for providing the “SAP” graphs. We also thank Alessandro Pellegrini and Francesco Quaglia for providing us the computing infrastructure for our experiments.

References 1. Allen, F.E., Cocke, J.: Graph theoretic constructs for program control flow analysis. Tech. Rep. IBM Res. Rep. RC 3923, IBM T.J. Watson Research Center (1972) 2. Allesina, S., Bodini, A.: Who dominates whom in the ecosystem? Energy flow bottlenecks and cascading extinctions. Journal of Theoretical Biology 230(3), 351–358 (2004) 3. Alstrup, S., Harel, D., Lauridsen, P.W., Thorup, M.: Dominators in linear time. SIAM Journal on Computing 28(6), 2117–2132 (1999) 4. Amyeen, M.E., Fuchs, W.K., Pomeranz, I., Boppana, V.: Fault equivalence identification using redundancy information and static and dynamic extraction. In: Proceedings of the 19th IEEE VLSI Test Symposium (March 2001) 5. Bender, M.A., Cole, R., Demaine, E.D., Farach-Colton, M., Zito, J.: Two simplified algorithms for maintaining order in a list. In: M¨ ohring, R.H., Raman, R. (eds.) ESA 2002. LNCS, vol. 2461, pp. 152–164. Springer, Heidelberg (2002) 6. Buchsbaum, A.L., Georgiadis, L., Kaplan, H., Rogers, A., Tarjan, R.E., Westbrook, J.R.: Linear-time algorithms for dominators and other path-evaluation problems. SIAM Journal on Computing 38(4), 1533–1573 (2008) 7. Buchsbaum, A.L., Kaplan, H., Rogers, A., Westbrook, J.R.: A new, simpler lineartime dominators algorithm. ACM Transactions on Programming Languages and Systems 20(6), 1265–1296 (1998); Corrigendum in 27(3), 383–387 (2005) 8. CAD Benchmarking Lab: ISCAS’89 benchmark information, http://www.cbl.ncsu.edu/www/CBL_Docs/iscas89.html 9. Cheriyan, J., Reif, J.H.: Directed s-t numberings, rubber bands, and testing digraph k-vertex connectivity. Combinatorica, 435–451 (1994), also in SODA 1992 10. Cooper, K.D., Harvey, T.J., Kennedy, K.: A simple, fast dominance algorithm. Software Practice & Experience 4, 110 (2001) 11. Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems 13(4), 451–490 (1991) 12. Demetrescu, C., Goldberg, A., Johnson, D.: 9th DIMACS Implementation Challenge: Shortest Paths (2007), http://www.dis.uniroma1.it/~ challenge9/ 13. Dietz, P., Sleator, D.: Two algorithms for maintaining order in a list. In: Proc. 19th ACM Symp. on Theory of Computing, pp. 365–372 (1987) 14. Firmani, D., Italiano, G.F., Laura, L., Orlandi, A., Santaroni, F.: Computing strong articulation points and strong bridges in large scale graphs. In: Klasing, R. (ed.) SEA 2012. LNCS, vol. 7276, pp. 195–207. Springer, Heidelberg (2012) 15. Georgiadis, L.: Testing 2-vertex connectivity and computing pairs of vertex-disjoint s-t paths in digraphs. In: Abramsky, S., Gavoille, C., Kirchner, C., Meyer auf der Heide, F., Spirakis, P.G. (eds.) ICALP 2010. LNCS, vol. 6198, pp. 738–749. Springer, Heidelberg (2010)

Dominator Certification and Independent Spanning Trees

295

16. Georgiadis, L.: Approximating the smallest 2-vertex connected spanning subgraph of a directed graph. In: Demetrescu, C., Halld´ orsson, M.M. (eds.) ESA 2011. LNCS, vol. 6942, pp. 13–24. Springer, Heidelberg (2011) 17. Georgiadis, L., Tarjan, R.E.: Finding dominators revisited. In: Proc. 15th ACMSIAM Symp. on Discrete Algorithms, pp. 862–871 (2004) 18. Georgiadis, L., Tarjan, R.E.: Dominator tree verification and vertex-disjoint paths. In: Proc. 16th ACM-SIAM Symp. on Discrete Algorithms, pp. 433–442 (2005) 19. Georgiadis, L., Tarjan, R.E.: Dominator tree certification and independent spanning trees. CoRR abs/1210.8303 (2012) (submitted for journal publication) 20. Georgiadis, L., Tarjan, R.E.: Dominators, directed bipolar orders, and independent spanning trees. In: Czumaj, A., Mehlhorn, K., Pitts, A., Wattenhofer, R. (eds.) ICALP 2012, Part I. LNCS, vol. 7391, pp. 375–386. Springer, Heidelberg (2012) 21. Georgiadis, L., Tarjan, R.E., Werneck, R.F.: Finding dominators in practice. Journal of Graph Algorithms and Applications (JGAA) 10(1), 69–94 (2006) 22. Gomez-Rodriguez, M., Sch¨ olkopf, B.: Influence maximization in continuous time diffusion networks. In: 29th International Conference on Machine Learning, ICML (2012) 23. Huck, A.: Independent trees in graphs. Graphs and Combinatorics 10, 29–45 (1994) 24. Italiano, G.F., Laura, L., Santaroni, F.: Finding strong bridges and strong articulation points in linear time. Theoretical Computer Science 447, 74–84 (2012) 25. Lengauer, T., Tarjan, R.E.: A fast algorithm for finding dominators in a flowgraph. ACM Transactions on Programming Languages and Systems 1(1), 121–141 (1979) 26. Leskovec, J.: Stanford large network dataset collection (2009), http://snap.stanford.edu 27. Maxwell, E.K., Back, G., Ramakrishnan, N.: Diagnosing memory leaks using graph mining on heap dumps. In: Proceedings of the 16th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD 2010, pp. 115–124 (2010) 28. McConnell, R.M., Mehlhorn, K., N¨ aher, S., Schweitzer, P.: Certifying algorithms. Computer Science Review 5(2), 119–161 (2011) 29. Mitchell, N.: The runtime structure of object ownership. In: Thomas, D. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 74–98. Springer, Heidelberg (2006) ¨ 30. Plehn, J.: Uber die Existenz und das Finden von Subgraphen. Ph.D. thesis, University of Bonn, Germany (May 1991) 31. Purdom Jr., P.W., Moore, E.F.: Algorithm 430: Immediate predominators in a directed graph. Communications of the ACM 15(8), 777–778 (1972) 32. Quesada, L., Van Roy, P., Deville, Y., Collet, R.: Using dominators for solving constrained path problems. In: Van Hentenryck, P. (ed.) PADL 2006. LNCS, vol. 3819, pp. 73–87. Springer, Heidelberg (2006) 33. Tarjan, R.E.: Depth-first search and linear graph algorithms. SIAM Journal on Computing 1(2), 146–159 (1972) 34. Tarjan, R.E.: Finding dominators in directed graphs. SIAM Journal on Computing 3(1), 62–89 (1974) 35. Tarjan, R.E.: Efficiency of a good but not linear set union algorithm. Journal of the ACM 22(2), 215–225 (1975) 36. Whitty, R.W.: Vertex-disjoint paths and edge-disjoint branchings in directed graphs. Journal of Graph Theory 11, 349–358 (1987) 37. Zhao, J., Zdancewic, S.: Mechanized verification of computing dominators for formalizing compilers. In: Hawblitzel, C., Miller, D. (eds.) CPP 2012. LNCS, vol. 7679, pp. 27–42. Springer, Heidelberg (2012)