Shared-Memory Exact Minimum Cuts ∗
Total Page:16
File Type:pdf, Size:1020Kb
Shared-memory Exact Minimum Cuts ∗ Monika Henzinger y Alexander Noe z Christian Schulzx Abstract disconnect the network; in VLSI design [21], a minimum The minimum cut problem for an undirected edge- cut can be used to minimize the number of connections weighted graph asks us to divide its set of nodes into between microprocessor blocks; and it is further used two blocks while minimizing the weight sum of the cut as a subproblem in the branch-and-cut algorithm for edges. In this paper, we engineer the fastest known solving the Traveling Salesman Problem and other exact algorithm for the problem. combinatorial problems [27]. State-of-the-art algorithms like the algorithm of As the minimum cut problem has many applications Padberg and Rinaldi or the algorithm of Nagamochi, and is often used as a subproblem for complex problems, Ono and Ibaraki identify edges that can be contracted it is highly important to have algorithms that are able to reduce the graph size such that at least one mini- solve the problem in reasonable time on huge data sets. mum cut is maintained in the contracted graph. Our As data sets are growing substantially faster than pro- algorithm achieves improvements in running time over cessor speeds, a good way to achieve this is efficient par- these algorithms by a multitude of techniques. First, allelization. While there is a multitude of algorithms, we use a recently developed fast and parallel inexact which solve the minimum cut problem exactly on a sin- minimum cut algorithm to obtain a better bound for gle core [12, 14, 17, 24], to the best of our knowledge, the problem. Then we use reductions that depend on there exists only one parallel exact algorithm for the this bound, to reduce the size of the graph much faster minimum cut problem: Karger and Stein [17] present than previously possible. We use improved data struc- a parallel variant for their random contraction algo- tures to further improve the running time of our al- rithm [17] which computes a minimum cut with high 2 gorithm. Additionally, we parallelize the contraction probability in polylogarithmic time using n processors. routines of Nagamochi, Ono and Ibaraki. Overall, we This is however unfeasible for large instances. There has arrive at a system that outperforms the fastest state- been a MPI implementation of this algorithm by Gian- of-the-art solvers for the exact minimum cut problem inazzi et al. [9]. However, there have been no parallel significantly. implementations of the algorithms of Hao et al. [12] and Nagamochi et al. [24, 25], which outperformed other ex- 1 Introduction act algorithms by orders of magnitude [7, 13, 15], both in real-world and generated networks. Given an undirected graph with non-negative edge All algorithms that solve the minimum cut prob- weights, the minimum cut problem is to partition the lem exactly have non-linear running times, currently vertices into two sets so that the sum of edge weights the fastest being the deterministic algorithm of Hen- between the two sets is minimized. A minimum cut zinger et al. [14] with running time O(log2 n log log2 n). is often also referred to as the edge connectivity of a There is a linear time approximation algorithm, namely arXiv:1808.05458v1 [cs.DS] 16 Aug 2018 graph [24, 14]. The problem has applications in many the (2+")-approximation algorithm by Matula [23] and fields. In particular, for network reliability [16, 30], a linear time heuristic minimum cut algorithm by Hen- assuming equal failure probability edges, the smallest zinger et al. [13] based on the label propagation algo- edge cut in the network has the highest chance to rithm [29]. The latter paper also contains a shared- memory parallel implementation of their algorithm. ∗The research leading to these results has received funding from the European Research Council under the European Com- 1.1 Contribution. We engineer the fastest known munity's Seventh Framework Programme (FP7/2007-2013) /ERC exact minimum cut algorithm for the problem. We do so grant agreement No. 340506 yUniversity of Vienna, Vienna, Austria. by (1) incorporating recently proposed inexact methods [email protected] and (2) by using better suited data structures and other zUniversity of Vienna, Vienna, Austria. optimizations as well as (3) parallelization. [email protected] Algorithms like the algorithm of Padberg and Ri- x University of Vienna, Vienna, Austria. naldi or the algorithm of Nagamochi, Ono and Ibaraki [email protected] identify edges that can be contracted to reduce the into two non-empty partitions A and V n A, each being graph size such that at least one minimum cut is main- called a side of the cut. The capacity of a cut (A; V nA) P tained in the contracted graph. Our algorithm achieves is c(A) = (u;v)2E[A] c(u; v). A minimum cut is a cut improvements in running time by a multitude of tech- (A; V n A) that has smallest weight c(A) among all cuts niques. First, we use a recently developed fast and par- in G. We use λ(G) (or simply λ, when its meaning is allel inexact minimum cut algorithm [13] to obtain a clear) to denote the value of the minimum cut over all better approximate bound λ^ for the problem. As know A ⊂ V . For two vertices s and t, we denote λ(G; s; t) graph reduction techniques depend on this bound, the as the smallest cut of G, where s and t are on different better bound enables us to apply more reductions and sides of the cut. The connectivity λ(G; e) of an edge reduce the size of the graph much faster. For exam- e = (s; t) is defined as λ(G; s; t), the connectivity of its ple, edges whose incident vertices have a connectivity incident vertices. This is also known as the minimum of at least λ^, can be contracted without the contraction s-t-cut of the graph or the connectivity or vertices s and affecting the minimum cut. Using better suited data t. At any point in the execution of a minimum cut al- structures as well as incorporating observations that gorithm, λ^(G) (or simply λ^) denotes the lowest upper help to save a significantly amount of work in the con- bound of the minimum cut that an algorithm discovered traction routine of Nagamochi, Ono and Ibaraki [25] fur- until that point. For a vertex u 2 V with minimum ver- ther reduce the running time of our algorithm. For ex- tex degree, the size of the trivial cut (fug;V n fug) is ample, we observe a significantly higher performance on equal to the vertex degree of u. Hence, the minimum some graphs when using a FIFO bucket priority queue, vertex degree δ(G) can serve as initial bound. bounded priority queues as well as better bounds λ^. Ad- Many algorithms tackling the minimum cut prob- ditionally, we give a parallel variant of the contraction lem use graph contraction. Given an edge (u; v) 2 E, routines of Nagamochi, Ono and Ibaraki [25]. Overall, we define G=(u; v) to be the graph after contracting we arrive at a system that outperforms the state-of- edge (u; v). In the contracted graph, we delete vertex the-art by a factor of up to 2:5 already sequentially, v and all edges incident to this vertex. For each edge and when run in parallel by a factor of up to 12:9 us- (v; w) 2 E, we add an edge (u; w) with c(u; w) = c(v; w) ing 12 cores. to G or, if the edge already exists, we give it the edge The rest of the paper is organized as follows. Chap- weight c(u; w) + c(v; w). ter 2 gives preliminaries, an overview over related work and details of the algorithms of Nagamochi et al. [24, 25] 2.2 Related Work. We review algorithms for the and Henzinger et al. [13], as we make use of their re- global minimum cut and related problems. A closely sults. Our shared-memory parallel exact algorithm for related problem is the minimum s-t-cut problem, which the minimum cut problem is detailed in Chapter 3. In asks for a minimum cut with nodes s and t in different Chapter 4 we give implementation details and extensive partitions. Ford and Fulkerson [8] proved that minimum experiments both on real-world and generated graphs. s-t-cut is equal to maximum s-t-flow. Gomory and We conclude the paper in Chapter 5. Hu [11] observed that the (global) minimum cut can be computed with n−1 minimum s-t-cut computations. 2 Preliminaries For the following decades, this result by Gomory and Hu 2.1 Basic Concepts. Let G = (V; E; c) be a was used to find better algorithms for global minimum weighted undirected graph with vertex set V , edge cut using improved maximum flow algorithms [17]. One set E ⊂ V × V and non-negative edge weights c : of the fastest known maximum flow algorithms is the 0 push-relabel algorithm [10] by Goldberg and Tarjan. E ! N. We extend c to a set of edges E ⊆ E by summing the weights of the edges; that is, c(E0) := Hao and Orlin [12] adapt the push-relabel algorithm P to pass information to future flow computations. When e=fu;vg2E0 c(u; v). We apply the same notation for single nodes and sets of nodes. Let n = jV j be the a push-relabel iteration is finished, they implicitly merge number of vertices and m = jEj be the number of the source and sink to form a new sink and find a new edges in G.