Faster Approximation Algorithms for Computing Shortest Cycles on Weighted Graphs

LIPICS - Leibniz International Proceedings in Informatics, Jul 2019

Given an n-vertex m-edge graph G with non-negative edge-weights, a shortest cycle of G is one minimizing the sum of the weights on its edges. The girth of G is the weight of such a shortest cycle. We obtain several new approximation algorithms for computing the girth of weighted graphs: - For any graph G with polynomially bounded integer weights, we present a deterministic algorithm that computes, in O~(n^{5/3}+m)-time, a cycle of weight at most twice the girth of G. This matches both the approximation factor and - almost - the running time of the best known subquadratic-time approximation algorithm for the girth of unweighted graphs. - Then, we turn our algorithm into a deterministic (2+epsilon)-approximation for graphs with arbitrary non-negative edge-weights, at the price of a slightly worse running-time in O~(n^{5/3}polylog(1/epsilon)+m). For that, we introduce a generic method in order to obtain a polynomial-factor approximation of the girth in subquadratic time, that may be of independent interest. - Finally, if we assume that the adjacency lists are sorted then we can get rid off the dependency in the number m of edges. Namely, we can transform our algorithms into an O~(n^{5/3})-time randomized 4-approximation for graphs with non-negative edge-weights. This can be derandomized, thereby leading to an O~(n^{5/3})-time deterministic 4-approximation for graphs with polynomially bounded integer weights, and an O~(n^{5/3}polylog(1/epsilon))-time deterministic (4+epsilon)-approximation for graphs with non-negative edge-weights. To the best of our knowledge, these are the first known subquadratic-time approximation algorithms for computing the girth of weighted graphs.

A PDF file should load here. If you do not see its contents the file may be temporarily unavailable at the journal website or you do not have a PDF plug-in installed and enabled in your browser.

Alternatively, you can download the file locally and open with any standalone PDF reader:

http://drops.dagstuhl.de/opus/volltexte/2019/10625/pdf/LIPIcs-ICALP-2019-49.pdf

Faster Approximation Algorithms for Computing Shortest Cycles on Weighted Graphs

I C A L P Faster Approximation Algorithms for Computing Shortest Cycles on Weighted Graphs Guillaume Ducoffe 0 Category Track A: Algorithms, Complexity and Games 0 National Institute for Research and Development in Informatics, Romania The Research Institute of the University of Bucharest ICUB, Romania University of Bucharest , Romania Given an n-vertex m-edge graph G with non-negative edge-weights, a shortest cycle of G is one minimizing the sum of the weights on its edges. The girth of G is the weight of such a shortest cycle. We obtain several new approximation algorithms for computing the girth of weighted graphs: For any graph G with polynomially bounded integer weights, we present a deterministic algorithm that computes, in O?(n5/3 + m)-time1, a cycle of weight at most twice the girth of G. This matches both the approximation factor and - almost - the running time of the best known subquadratic-time approximation algorithm for the girth of unweighted graphs. Then, we turn our algorithm into a deterministic (2 + ?)-approximation for graphs with arbitrary non-negative edge-weights, at the price of a slightly worse running-time in O?(n5/3polylog(1/?) + m). For that, we introduce a generic method in order to obtain a polynomial-factor approximation of the girth in subquadratic time, that may be of independent interest. Finally, if we assume that the adjacency lists are sorted then we can get rid off the dependency in the number m of edges. Namely, we can transform our algorithms into an O?(n5/3)-time randomized 4-approximation for graphs with non-negative edge-weights. This can be derandomized, thereby leading to an O?(n5/3)-time deterministic 4-approximation for graphs with polynomially bounded integer weights, and an O?(n5/3polylog(1/?))-time deterministic (4 + ?)-approximation for graphs with non-negative edge-weights. To the best of our knowledge, these are the first known subquadratic-time approximation algorithms for computing the girth of weighted graphs. 2012 ACM Subject Classification Theory of computation ? Design and analysis of algorithms; Theory of computation ? Graph algorithms analysis; Theory of computation ? Approximation algorithms analysis Related Version A full version of the paper is available at https://arxiv.org/abs/1810.10229. 1 The O?(?) notation suppresses polylogarithmic factors. and phrases girth; weighted graphs; approximation algorithms - Funding This work was supported by a grant of Romanian Ministry of Research and Innovation CCCDI-UEFISCDI. project no. 17PCCDI/2018. The exciting program of ?Hardness in P? aims at proving (under plausible complexity theoretic conjectures) the exact time-complexity of fundamental, polynomial-time solvable problems in computer science. In this paper, we consider the Girth problem on edge-weighted undirected graphs, for which almost all what is known in terms of finer-grained complexity 49:2 only holds for dense graphs (m = ?(n2)). We recall that the girth of a given graph G is the minimum weight of a cycle in G ? with the weight of a cycle being defined as the sum of the weights on its edges (see Sec. 2 for any undefined terminology in this introduction). For dense graphs this parameter can be computed in time O(n3), and Vassilevska Williams and Williams [19] proved a bunch of combinatorial subcubic equivalences between Girth and other path and matrix problems. In particular, for every ? > 0, there cannot exist any combinatorial (4/3 ? ?)-approximation algorithm for Girth that runs in truly subcubic time unless there exists a truly subcubic combinatorial algorithm for multiplying two boolean matrices. Roditty and Tov completed this above hardness result with an O?(n2/?)-time (4/3 + ?)-approximation algorithm [15], thereby essentially completing the picture of what can be done combinatorially in subcubic time. However, the story does not end here for at least two reasons. A first simple but important observation is that as the graphs considered get sparser, the complexity for computing their girth falls down to O(n2). In fact, when the edge-weights are integers bounded by some constant M , there is a non-combinatorial algorithm for computing the girth of any n-vertex graph G in time O?(M n?) where ? stands for the the exponent of square matrix multiplication over a ring [16]. It is widely believed that ? = 2 [13], and if true, that would imply we can compute the exact value of the girth in quasi quadratic time ? at least when edge-weights are bounded. So far, all the approximation algorithms for Girth on weighted graphs run in ?? (n2)-time [10, 15]. This leads us to the following, natural research question: Does there exist a subquadratic approximation algorithm for Girth on weighted graphs? In this paper, we answer to this above question in the affirmative. 1.1 Our contributions We present new approximation algorithms for the girth of graphs with non-negative real edge-weights. These are the first algorithms to break the quadratic barrier for this problem ? at the price of a slightly worse approximation factor compared to the state of the art [15] ? see Sec. 1.2 on the Related work for more details. Our first result is obtained for graphs with bounded integer edge-weights. I Theorem 1. For every G = (V, E, w) with edge-weights in {1, . . . , M }, we can compute a deterministic 2-approximation for Girth in time O?(n5/3polylogM + m). Our starting point for Theorem 1 is a previous 2-approximation algorithm from Lingas and Lundell [10], that runs in quadratic time. Specifically, these two authors introduced an O?(n log M )-time procedure that takes as entry a specified vertex of the graph and needs to be applied to every vertex in order to obtain the desired 2-approximation of the girth. Inspired by the techniques used for approximate distance oracles [18] we informally modify their algorithm as follows. We only apply their procedure to the vertices in a random subset S: where each vertex is present with equal probability n?1/3 (we can derandomize our approach by using known techniques from the litterature [14]). Furthermore, for the vertices not in S, we rather apply a modified version of their procedure that is restricted to a small subgraph ? induced by some ball of expected size O(n1/3). A careful analysis shows this is a 2-approximation. The reason why this above approach works is that, when we run the procedure of Lingas and Lundell at some arbitrary vertex s, it will always detect a short cycle if there is one passing close to s (but not necessarily passing through s itself). This nice property has been noticed and exploited for related algorithms on unweighted graphs [10]2. However, we think we are the first to prove such a property in the weighted case. We note that one of the two algorithms proposed by Roditty and Tov in [15] also satisfies such a property. We did not find a way to exploit their algorithm in order to improve our approximation factor. Our approach for graphs with bounded integer edge-weights (see Sec. 3.2) is the cornerstone of all our other results in the paper. We considerably refine this approach so that it also applies to graphs with arbitrary non-negative edge-weights. I Theorem 2. For every ? > 0 and G = (V, E, w) with non-negative edge-weights, we can compute a deterministic (2 + ?)-approximation for Girth in time O?(n5/3polylog1/? + m). We note that in [15], Roditty and Tov introduced a nice technique ? that we partly reuse in this paper ? in order to transpose their results for bounded integer-weights to arbitrary weights. However, we face several new difficulties, not encountered in [15], due to the need to perform all the intermediate operations in subquadratic time. As a side contribution of this work, we present an intricate modification of our approach for graphs with bounded integer edge-weights that we use in order to approximate the girth of graphs with arbitrary non-negative edge-weights up to a polynomial-factor. This subquadratic-time routine could be useful to anyone improving our result for the graphs with integer-weights in order to generalize their results to the graphs with non-negative real weights. Our algorithms are subquadratic in the size of the graph, but they may be quadratic in its order n if there are m = ?(n2) edges. By a folklore application of Moore bounds, any unweighted graph with O(n1+ 1` ) edges has girth at most 2`, and so, we can always output a constant upper-bound on the girth of moderately dense graphs. It implies that the dependency on m can always be removed in the running-time of approximation algorithms for the girth of unweighted graphs. However, in the full version of this paper, we prove by using elementary arguments that any approximation algorithm for the girth on weighted graphs must run in ?(m)-time. We study what happens if we have sorted adjacency lists3. I Theorem 3. Let G = (V, E, w) have sorted adjacency lists. 1. If all edge-weights are in {1, . . . , M } then, we can compute a deterministic 4-approximation for Girth in time O?(n5/3polylogM ). 2. If all edge-weights are non-negative then, we can compute a randomized 4-approximation for Girth in time O?(n5/3). For every ? > 0, we can also compute a deterministic (4 + ?)-approximation for Girth in time O?(n5/3polylog1/?). We observe that even assuming sorted adjacency lists, it is not clear whether the algorithm of Theorem 1 can be implemented to run in time O?(n5/3polylogM ). Indeed, this algorithm requires to build several induced subgraphs in time roughly proportional to their size, that requires a different preprocessing on the adjacency lists. We prove that we do not need to construct these induced subgraphs entirely in order to derive a constant-factor approximation of the girth. Similarly, for graphs with non-negative edge-weights we cannot use our polynomial-factor approximation algorithm for the girth directly, as it needs to enumerate all edges in the graph. We overcome this difficulty through the help of a classical density result for the C4-free unweighted graphs [4]. 2 There is a subtle difference between our approach for weighted graphs and the one formerly applied to unweighted graphs. Indeed, we need to consider all edges in the subgraphs that are induced by some small balls in the graph, that might include some large-weight edges not on any shortest-path in G. For unweighted graphs [10, 16], they mostly consider edges on some shortest-paths in G between a pre-defined vertex and the other vertices in the ball. 3 Throughout this paper, we call an adjacency list sorted if it is sorted by edge-weight, and ordered if it is sorted by neighbour index. See also Sec. 2. 1.2 Related work Approximation algorithms for the girth. Itai and Rodeh were the first to study the Girth problem for unweighted graphs [9]. Among other results, they showed how to compute an additive +1-approximation of the girth in time O(n2). This was later completed by Lingas and Lundell [10], who proposed a randomized quasi 2-approximation algorithm for this problem that runs in time O(n3/2?log n). In [17], Roditty and Vassilevska Williams presented the first deterministic approximation algorithm for the girth of unweighted graphs. Specifically, they obtained a 2-approximation algorithm in time O?(n5/3), and they conjectured that there does not exist any subquadratic (2 ? ?)-approximation for Girth. We obtain the same approximation factor for weighted graphs, and we almost match their running time up to polylog factors and to an additional term in O?(m). It would be interesting to know whether in our case, this dependency on m can be removed while preserving the approximation factor 2. Very recently, new subquadratic-time approximation algorithms were proposed for Girth in unweighted graphs (see [7]). It is open whether one can achieve a constant-factor approximation for the girth in, say, O?(n1+o(1))-time. Much less is known about the girth of weighted graphs. The first known subcubic approximation was the one of Lingas and Lundell [10], that only applies to graphs with bounded integer edge-weights. Their work somewhat generalizes the algorithm of Itai and Rodeh for unweighted graphs. The approximation factor was later improved to 4/3 by Roditty and Tov, still for the graphs with bounded integer weights, and to 4/3 + ? for the graphs with arbitrary weights [15]. Our algorithms in this paper are faster than these two previous algorithms, but they use the latter as a routine to be applied on several subgraphs of sublinear size. Therefore, the approximation factors that we obtain cannot outperform those obtained in [10, 15]. More recently, a breakthrough logarithmic approximation of the girth of directed weighted graphs was obtained in [11]. Approximate distances. Finally, approximation algorithms for the girth are tightly related to the computation of approximate distances in weighted graphs. In a seminal paper [18], Thorup and Zwick showed that we can compute in expected time O(mn1/k) an approximate distance oracle: that can answer any distance query in time O(k) with a multiplicative stretch at most 2k ? 1. This has been improved in several follow-ups [2, 5, 12, 14, 20]. However, the construction of most oracles already takes (super)quadratic time for moderately dense graphs. A key observation is that we do not need to construct these oracles entirely if we just want to approximate the girth. This allows us to avoid a great deal of distance computations, and so, to lower the running time. 1.3 Organization of the paper We start gathering in Section 2 some known results from the literature that we will use for our algorithm. Then, in Section 3, we give some new insights on the algorithm of Lingas and Lundell [10] before presenting our main result (Theorem 1). Our algorithm is generalized to graphs with arbitrary weights in Section 4. Finally, we remove the dependency on the number of edges in the time complexity of our algorithms in Section 5. We conclude this paper with some open perspectives (Section 6). Due to space restrictions, some of the proofs are omitted. Full proofs can be found in our technical report [8]. 2 Preliminaries We refer to [3] for any undefined graph terminology. Graphs in this study are finite, simple (hence, without any loop nor multiple edges), connected and edge-weighted. Specifically, we denote a weighted graph by a triple G = (V, E, w) where w : E ? R+ is the edge-weight function of G. The weight of a subgraph H ? G, denoted w(H) := Pe?E(H) we, is the sum of the weights on its edges. The girth of G is the minimum weight of a cycle in G. The distance distG(u, v) between any two vertices u, v ? V is the minimum weight of an uv-path in G. By extension, for every v ? V and S ? V we define distG(v, S) := minu?S distG(u, v). ? We will sometimes omit the subscript if no ambiguity on the graph G can occur. ? For any v ? V and r ? 0, we also define the ball BG(v, r) := {u ? V | distG(u, v) ? r}. Finally, an r-nearest set for v is any r-set Nr(v) such that, for any x ? Nr(v) and y ?/ Nr(v), we have distG(v, x) ? distG(v, y). For every v ? V , let NG(v) = {u ? V | uv ? E} be the (open) neighbourhood of vertex v and let dv = |NG(v)| be its degree. Let Qv = {vu | u ? NG(v)} be totally ordered. We call it a sorted adjacency list if edges incident to v are ordered by increasing weight, i.e., Qv = (vu1, vu2, . . . , vudv ) and wvui ? wvui+1 for every i < dv. However, we call it an ordered adjacency list if, given some fixed total ordering ? over V the neighbours of v are ordered according to ? (i.e., ui ? ui+1 for every i < dv). Throughout the rest of the paper we will assume that each vertex has access to two copies of its adjacency list: one being sorted and the other being ordered. The latter can always be ensured up to an O?(m)-time preprocessing. 2.1 The Hitting Set method We gather many well-known facts in the literature, that can be found, e.g., in [14, 18, 1, 6]. All these facts are combined in order to prove the following useful result for our algorithms: 1. |S| = O?(n2/3); 2. and for every v ? V we have |BS(v)| = O(n1/3). I Proposition 4. For any graph G = (V, E, w) with sorted adjacency lists, in O?(n5/3)-time we can compute a set S ? V , and the open balls BS(v) := {u ? V | dist(v, u) < dist(v, S)} for every v ? V , such that the following two properties hold true: It is well-known that a set S as requested by Proposition 4 can be constructed randomly as follows: every vertex in V is added in S with equal probability n?1/3 [18]. This construction was derandomized in [14, 18, 1, 6]. In what follows we will not only need the balls BS(v) for every vertex v, but also the subgraphs these balls induce in G. Next, we observe that all these subgraphs can be obtained almost for free. Namely: I Lemma 5 (folklore). For every G = (V, E, w) and U ? V we can compute the subgraph G[U ] induced by U in time O?(|U |2) (assuming ordered adjacency lists). 3 Case of graphs with bounded integer weights This section is devoted to the proof of Theorem 1. We start presenting some new properties of a previous approximation algorithm for the girth of weighted graphs (Section 3.1) as we will need to use them in our own algorithm. Then, we prove our main result for graphs with bounded integer weights in Section 3.2. 3.1 Reporting a close short cycle We propose a deeper analysis of an existing approximation algorithm for Girth on weighted graphs [10]. Roughly, this algorithm applies a same procedure to every vertex of the graph. In order to derive the approximation factor of their algorithm, the authors in [10] were considering a run that takes as entry some vertex on a shortest cycle. This is in contrast with the classical algorithm from Itai and Rodeh on unweighted graphs [9], that also offers provable guarantees on the length of the output assuming there is a shortest cycle passing close to the source (but not necessarily passing by this vertex); see [10, Lemma 2]. We revisit the analysis of the algorithm in [10] for weighted graphs, and we prove that this algorithm also satisfies such a ?closeness property?. The HBD-algorithm from [10]. Given G = (V, E, w), s ? V and t ? 0, the algorithm HBD(G, s, t) is a relaxed version of Dijkstra?s single-source shortest-path algorithm. We are only interested in computing the ball of radius t around s, and so, we stop if there are no more unvisited vertices at a distance ? t from s. Furthermore, whenever we visit a vertex u ? BG(s, t), we only relax edges e = {u, v} such that dist(s, u) + we ? t. Then, a cycle is detected if we already inferred that dist(s, v) ? t (i.e., using another neighbour of v than u). Overall, the algorithm stops as soon as it encounters a cycle, or all the vertices in BG(s, t) were visited. Assuming sorted adjacency lists, this algorithm runs in O?(n)-time [10]. (a) HBD(G, s, t). (b) Controlled-Relax(u, t). (c) RelaxOrStop(u, v). 1: for all v ? V do 2: d(v) ? ?; ?(v) ? N IL 3: d(s) ? 0; Q ? {s} 4: while Q 6= ? do 5: u ? Extract-min(Q) 6: Controlled-Relax(u, t) 1: Qu ? sorted adj. list 2: uv ? Extract-min(Qu) 3: while d(u) + wuv ? t do 4: RelaxOrStop(u, v) 5: uv ? Extract-min(Qu) 1: if d(v) 6= ? then 2: return a cycle and stop 3: else 4: d(v) ? d(u) + wuv 5: Q ? Q ? {v} I Lemma 6 ( [10]). If HBD(G, s, t) detects a cycle, then its weight is ? 2t. We now complete the analysis of the HBD-algorithm in order to derive a generalization of [10, Lemma 2] to weighted graphs. Assuming no cycle has been detected, we first gain more insights on the structure of the ball of radius t centered at s. I Lemma 7. If HBD(G, s, t) does not detect a cycle then, for any v ? BG(s, t), there exists a unique sv-path of weight ? t. Based on Lemma 7, we state some bounds on the weight of the cycle detected using HBD. In particular, Corollary 9 will play a key role in the analysis of our algorithms. I Corollary 8. Given G = (V, E, w), let s ? V and let C be a cycle. The minimum t0 such that HBD(G, s, t0) detects a cycle satisfies t0 ? dist(s, C) + w(C). I Corollary 9. Given G = (V, E, w), let s ? V and let C be a cycle. Assume the existence of a vertex x ? V (C) such that maxv?V (C) distC (x, v) ? distG(s, x) > 0. Then, the minimum t0 such that HBD(G, s, t0) detects a cycle satisfies t0 ? w(C). v z Proof. Let Bx = {v ? V (C) | distC (x, v) < distG(x, s)}. Since we assume that we have maxv?V (C) distC (x, v) ? distG(x, s), Bx 6= V (C). Hence there exist uy, vz ? E(C) distinct such that u, v ? Bx but y, z ?/ Bx. W.l.o.g. distC (x, y) ? distC (x, z). We can bipartition E(C) in two edge-disjoint xy-paths P1 and P2, with P1 being the xy-subpath passing by vz (and so, P2 is the other xy-subpath passing by uy). Note that it implies distC (x, y) = w(P2) ? w(C)/2. Then, by Lemma 7 we have t0 ? distG(s, x) + max{w(P1), w(P2)} = distG(s, x) + w(P1) ? distC (x, y) + w(P1) = w(P2) + w(P1) = w(C). J 3.2 Subquadratic-time approximation Proof of Theorem 1. We analyse the following Subquadratic-Approx algorithm: (a) Approx-Girth(G, s, M). (b) Subquadratic-Approx(G, M). The algorithm starts precomputing a set S ? V and the open balls (BS(v))v?V as described in Proposition 4. This takes time O?(n5/3), plus an additional preprocessing time in O?(m) for sorting the adjacency lists. Then, we process the vertices in S and those in V \ S separately: For every s ? S, we compute the smallest ts ? [3; M n] such that HBD(G, s, ts) detects a cycle by using a dichotomic search (procedure Approx-Girth(G, s, M )). We store the cycle Cs outputted by HBD(G, s, ts). Since each test we perform during the dichotomic search consists in a call to the HBD-algorithm, this takes time O?(n log M ) per vertex in S, and so, O?(n|S| log M ) = O?(n5/3 log M ) in total. We now consider the vertices v ? V \ S sequentially. Let G0v be the subgraph of G induced by the open ball BS(v). By Lemma 5, this subgraph can be computed in time O?(|BS(v)|2) = O?(n2/3) ? assuming a preprocessing of the graph in time O(m) for ordering the adjacency lists. We apply the same procedure as for the vertices in S but, we restrict ourselves to the ball BS(v). That is, we call Approx-Girth(G0v, v, M ), and we denote by Cv the cycle outputted by this algorithm. Since we restrict ourselves to a subgraph of order O(n1/3), this takes total time O?(n ? (n2/3 + n1/3 log M )) = O?(n5/3 log M ). Let C ? {Cv | v ? V } be of minimum weight. We claim that w(C) is a 2-approximation of the girth of G, that will end proving the theorem. In order to prove this claim, we apply the following case analysis to some arbitrary shortest cycle C0 of G. If V (C0) ? S 6= ? then, let CS be a shortest cycle among {Cs | s ? S}. We prove as a subclaim that w(CS) is at most twice the weight of a shortest cycle intersecting S. In order to prove this subclaim, it suffices to prove that for every s ? S, we compute a cycle Cs of weight no more than twice the weight of a shortest cycle passing by s. By Corollary 8, if ts is the smallest t such that HBD(G, s, t) detects a cycle then, a shortest cycle C passing by s must have weight ? ts. Furthermore, by Lemma 6 we get w(Cs) ? 2ts, thereby proving the subclaim. Thus, w(CS) ? 2w(C0) if V (C0) ? S 6= ?. From now on we assume V (C0) ? S = ?. Let v ? V (C0) be arbitrary. There are two subcases: If V (C0) ? BS(v) then, C0 is also a cycle in G0v. Moreover by Corollary 8 applied for dist(v, C0) = 0, the smallest tv such that HBD(G0v, v, tv) detects a cycle satisfies tv ? w(C0). By Lemma 6, w(C) ? w(Cv) ? 2w(C0). Otherwise V (C0) 6? BS(v). This implies that we have: maxu?V (C0) distC0 (u, v) ? maxu?V (C0) distG(u, v) ? distG(v, S) > 0. Furthermore, let s ? S minimize distG(s, v). Then, by Corollary 9, the smallest ts such that HBD(G, s, ts) detects a cycle satisfies ts ? w(C0). As a result, by Lemma 6 w(C) ? w(Cs) ? 2w(C0). Summarizing, w(C) ? 2w(C0) in all the cases. J 4 Generalization to unbounded weights This section is devoted to the proof of Theorem 2. We divide it into two parts. In Section 4.1 we present a polynomial-factor approximation of the girth in subquadratic time. This part is new compared to [15] and the techniques used are interesting in their own right. Then, based on a clever technique from [15], we end up refining this rough estimate of the girth until we obtain a constant-factor approximation (Section 4.2). Throughout this section, we will use the main result of Roditty and Tov as a subroutine: I Theorem 10 ( [15]). For every G = (V, E, w) with arbitrary non-negative edge-weights, we can compute a (4/3 + ?)-approximation for Girth in time O?(n2/?). 4.1 A polynomial-factor approximation For simplicity, we first reduce the general case of graphs with non-negative weights to the subcase of graphs with positive weights. We omit the proof as it quite similar, but simpler, to the one of Proposition 12 (presented next). I Lemma 11. Assume there exists an T (n, m)-time ?-approximation algorithm for Girth for graphs with positive edge-weights, where T (n, m) = ?(m). Then, there also exists an O(T (n, m))-time ?-approximation algorithm for Girth for graphs with non-negative edge-weights. We now obtain an approximation of the girth that only depends on the order of the graph. We stress that for weighted graphs, this is already a non-trivial task. I Proposition 12. For every G = (V, E, w) with arbitrary positive edge-weights, we can compute an O?(n2/3)-approximation for Girth in time O?(n5/3 + m). Proof. Let S be as in Proposition 4. We show a significantly more elaborate method that uses S in order to approximate the girth. We divide this method into five main steps. Step 1: check the small balls. For every v ?/ S, let G0v be the subgraph induced by the open ball BS(v). As before, we first estimate the girth of G0v. Since this subgraph has order O(n1/3), by Theorem 10 we can compute a constant-factor approximation for its girth in time O?(n2/3) (say, a 2-approximation). Overall, this step takes total time O?(n5/3). Furthermore, after completing this step the following property (also used in Theorem 1) becomes true: B Claim 13. Let Cv be a shortest cycle passing through v. If w(Cv) < 2 ? dist(v, S) then, we computed a cycle of weight ? 2w(Cv). Step 2: partitioning into (shortest path) subtrees. Intuitively, what we try to do next is to approximate the weight of a shortest cycle passing close to S. The difference with Theorem 1 is that we cannot use directly the algorithm of Roditty and Tov for that. Indeed, their algorithm has some global steps (e.g., the approximate computation of the girth of some sparse spanner) that we currently do not know how to do in subquadratic time. So, we need to find some new techniques. Specifically, we partition the vertex-set V into shortest-path subtrees (Ts)s?S such that, for every s ? S and v ? V (Ts) we have dist(v, s) = dist(v, S). As noted, e.g., in [18], a simple way to do that is to add a dummy vertex xS ?/ V , edges sxS for every s ? S with weight 0, then to compute a shortest-path tree rooted at xS in time O?(m). See Fig. 3 for an example. In what follows, we show how to use this tree structure in order to compute short cycles. 4 7 2 3 9 8 7 3 2 3 7 9 3 4 2 3 2 3 3 Step 3: finding short cycles in a subtree. Let s ? S be fixed. Informally, we try to estimate the weight of a shortest cycle in V (Ts). Note that every such a cycle has an edge that is not contained in Ts. So, we consider all the edges e = uv such that u, v ? V (Ts) but e ?/ E(Ts). Adding this edge in Ts closes a cycle. Let Ce,s be an (unknown) shortest cycle passing by e and contained in V (Ts). We output dist(s, u) + we + dist(v, s) as a rough estimate of w(Ce,s). Indeed, the latter is a straightforward upper-bound on w(Ce,s), and this bound is reached if s ? {u, v}. Overall, this step takes total time O(m). B Claim 14. Let Cs? be a shortest cycle contained in V (Ts). After Steps 1-3, we computed a cycle of weight ? 2w(Cs?). Step 4: finding short cycles in two subtrees. We now want to estimate the weight of a shortest cycle in V (Ts) ? V (Ts0 ), for some distinct s, s0 ? S. We only need to consider the case where this cycle must contain two edges e, e0 with an end in V (Ts) and the other end in V (Ts0 ) (all other cases have already been considered at Step 3). 1. We scan all the edges e = uv ? E such that u and v are not in a same subtree. Let su, sv ? S such that u ? V (Tsu ), v ? V (Tsv ). We set `(e) = dist(su, u)+we+dist(v, sv). 2. Group all these above edges with their two ends in the same two subtrees. It takes time O(m + |S|) = O(m + n2/3) by using, say, a linear-time sorting algorithm. 3. Finally, for every distinct s, s0 ? S, let E(s, s0) contain all the edges with one end in Ts and the other end in Ts0 . If |E(s, s0)| ? 2 then, we pick e, e0 minimizing `(?) and we output `(e) + `(e0). Overall, since the sets E(s, s0) partition the edges of G, this last phase also takes time O(m). B Claim 15. Let s, s0 ? S be distinct and let Cs?,s0 be a shortest cycle contained in V (Ts) ? V (Ts0 ). After Steps 1-4, we computed a cycle of weight ? 3w(Cs?,s0 ). Step 5: the general case. We end up defining a weighted graph HS = (S, ES, wS), where ES = {ss0 | E(s, s0) 6= ?}, and for every ss0 ? ES: wsSs0 = min e?E(s,s0) `(e) = min uv?E(s,s0) dist(s, u) + wuv + dist(v, s0). Roughly, wsSs0 is the smallest weight of an ss0-path with one edge in E(s, s0). We can construct HS simply by scanning all the sets E(s, s0) (computed during Step 4). Overall, since the sets E(s, s0) partition the edges of G, this takes total time O(m + |S|) = O(m + n2/3). Furthermore, by Theorem 10 we can compute a constant-factor approximation of the girth of HS in time O?(|S|2) = O?(n4/3). The graph HS is not a subgraph of G. However, given a cycle CH for HS, we can compute a cycle CH? of G as follows. For every s ? V (CH ) let s0, s00 ? V (CH ) be its two neighbours. By construction, there exist e = uv ? E(s0, s) and e0 = xy ? E(s, s00) such that the edges ss0 and ss00 in HS have weights dist(s0, u) + we + dist(v, s) and dist(s, x) + we0 + dist(y, s00), respectively. ? We may assume the edges e, e0 to be stored in HS so that s0, s00 will choose the same common edge with s. ? Then, we replace s by the vx-path in Ts. It is important to notice that, by construction, we have w(CH? ) ? w(CH ). In particular, we can apply this above transformation to the (approximately shortest) cycle of HS that has been outputted by the algorithm of Roditty and Tov (Theorem 10). Overall, let Cmin be a shortest cycle computed by the algorithm above (i.e., after Steps 15). In order to finish the proof, we need to show that w(Cmin) is an O?(n2/3)-approximation of the girth of G. By Claims 14 and 15, this is the case if there exists a shortest cycle intersecting at most two subtrees Ts, s ? S. From now on assume that any shortest cycle C0 of G intersects at least three subtrees Ts. Write C0 = (v0, v1, . . . , vp?1, v0) and assume w.l.o.g. v0, vp?1 are not contained into the same subtree Ts. We partition the vi?s into the maximal subpaths P0, P1, . . . , Pq?1, q ? p that are contained into the vertex-set of a same subtree Ts (in particular, v0 ? V (P0) and vp?1 ? V (Pq?1)). Furthermore for every j ? {0, 1, . . . , q ? 1} let sj ? S be such V (Pj) ? V (Tsj ), and let ij be the largest index such that vij ? V (Pj). For instance, iq?1 = p ? 1 by construction. Since P0 = Pq and q ? 3 by the hypothesis, there exist distinct indices j1, j2 such that sj1 = sj2+1 and for every j ? {j1, j1 + 1, . . . , j2} the sj?s are pairwise different (indices are taken modulo q). Then, two cases may arise: Case j2 = j1 + 1. We have: ej1 := vij1 vij1 +1, ej2 := vij2 +1vij2 ? E(sj1 , sj2 ). Furthermore, C0 goes by vij1 (by vij1 +1, vij2 +1, vij2 , respectively), and so, by Claim 13, either we computed a short cycle of weight ? 2w(C0) during Step 1, or we have w(C0) ? 2 ? max{dist(sj1 , vij1 ), dist(sj1 , vij2 +1), dist(sj2 , vij1 +1), dist(sj2 , vij2 )}. In the latter case, there exists a cycle of weight: ? dist(sj1 , vij1 )+wej1 +dist(sj2 , vij1 +1)+dist(sj2 , vij2 )+ wej2 + dist(sj1 , vij2 +1) ? 3w(C0) that is fully contained in V (Tsj1 ) ? V (Tsj2 ). By Claim 15, we so computed a cycle of weight ? 9w(C0) at Step 4. From now on let us assume j2 6= j1 + 1. For every j we have ej := vij vij+1 ? E(sj, sj+1), and so, the edge sjsj+1 ? ES has weight no more than dist(sj, vij ) + wej + dist(vij+1, sj+1) in HS (indices are taken modulo q for the sj?s and modulo p for the vi?s). Furthermore, C0 goes by vij (by vij+1, respectively), and so, by Claim 13, either we computed a short cycle of weight ? 2w(C0) during Step 1, or we have w(C0) ? 2 ? max{dist(sj, vij ), dist(sj+1, vij+1} for every j. In the latter case, 4.2 Improving the approximation factor Sketch Proof of Theorem 2. We may assume that all weights are positive by Lemma 11. Let g? be the O?(n2/3)-approximation that we computed by using Proposition 12. There exists some (known) constant c such that the girth of G is somewhere between g?/(cn2/3 log n) and g?. Then, let imin, imax be the smallest nonnegative integers such that g?/(cn2/3 log n) ? (1 + ?/2)imin and in the same way g? ? (1 + ?/2)imax . We have that: imax ? imin = O log1+?/2 g? g?/(cn2/3 log n) = O(log n/ log (1 + ?/2)) = O(log n/?). Let S be as in Proposition 4. For every v ? V \ S, we compute a 2-approximation of a shortest cycle in G0v: the subgraph of G induced by the ball BS(v)4. By Theorem 10, it can be done in time O?(n2/3) for each v, and so, this takes total time O?(n5/3). Then, let T = {(1 + ?/2)i | imin ? i ? imax}. For every s ? S, we compute the smallest t ? T such that HBD(G, s, t) detects a cycle (if any). It can be done in time O?(|S|n log |T |) = O?(n5/3 log 1/?) by using a dichotomic search. Finally, let gmin be the value computed by the above algorithm (with a corresponding cycle). In order to conclude we prove, with a similar case analysis as for Theorem 1, that the girth of G is at least gmin/(2 + ?). J 5 A subquadratic algorithm for dense graphs A drawback of the algorithms in Theorems 1 and 2 is that their time complexity also depends on the number m of edges. It implies that for dense graphs with m = ?(n2) edges we do not achieve any improvement on the running time compared to [10, 15]. The main result of this section is that assuming sorted adjacency lists, the dependency on m can always be discarded (Theorem 3). Due to lack of space, we will only prove the following weaker result: I Proposition 16. For every G = (V, E, w) with non-negative edge-weights and sorted adjacency lists, we can compute: 1. a randomized 4-approximation for Girth in expected time O?(n5/3); 2. and, for every ? > 0, a deterministic (8 + ?)-approximation for Girth in time O?(n5/3polylog1/?). 4 In fact, this is already done in the proof of Proposition 12, but we restate it here for completeness of the method. Roughly, we can prove Theorem 3 by combining this above Proposition 16 with a natural modification of the algorithm presented in Section 3.2. We will need the following well-known result in graph theory: I Theorem 17 ( [4]). Every unweighted graph with order n and m ? 21 + o(1) n3/2 edges contains a cycle of length four. Proof of Proposition 16. If G has m = O?(n5/3) edges then, we can simply apply Theorem 2 for ? = 2 (the latter can be easily verified by scanning the adjacency lists until we read the end of it or we reach the desired upper-bound). From now on assume this is not the case and let H be induced by the 21 + o(1) n3/2 edges of minimum weight in G. We claim that H can be constructed in time O?(n3/2) by using a priority queue Q. Indeed, initially we set E(H) = ? and for every v ? V we start inserting in Q the edge of minimumweight that is incident to v. This way, we ensure that a minimum-weight edge of G \ E(H) is present in Q (recall that initially, E(H) = ?, and so, G = G \ E(H)). Then, in order to preserve this above invariant, each time a minimum-weight edge uv is extracted from Q and added in H we insert in Q the remaining edge of minimum weight in Qu and the one in Qv (if any). ? Note that in doing so, a same edge can be added in Q twice, but this has no consequence on the algorithm. ? We now apply Theorem 2 for ?0 = ?/4 to H, and we so obtain a cycle C that is a (2 + ?/4)-approximation of the girth of H. We claim that w(C) is also a (8 + ?)-approximation of the girth of G. In order to prove this claim, we need to consider two different cases: Assume there exists a shortest cycle C0 of G such that E(C0) ? E(H). By Theorem 2, w(C) ? (2 + ?/4)w(C0) < (8 + ?)w(C0). Otherwise, any shortest cycle C0 of G has at least one edge that is not contained in H. Since edges are added by increasing weights, this implies that every shortest cycle contains an edge of weight at least wmax, where wmax denotes the maximum-weight of an edge in H. In particular, the girth of G is at least wmax. Furthermore, since H has enough edges by construction, by Theorem 17 it contains a cycle of four vertices; the latter has weight at most 4wmax. As a result, w(C) ? (2 + ?/4) ? 4wmax = (8 + ?)wmax ? (8 + ?)w(C0). The above proves the claim, and so, the deterministic version of the result. In order to obtain a randomized 4-approximation, it suffices to pick ? ? 2 and to output any cycle C0 of H with four vertices (then, we output any of C, C0 that has minimum weight). Up to some constant multiplicative increase of the number of edges to add in H, this can be done by using a randomized algorithm of Yuster and Zwick that runs in expected linear time [21, Theorem 2.9]. Note that this is the only source of randomness in the algorithm. J We recall that any unweighted graph with O(n1+ 1` ) edges contains a cycle of length at most 2`. We could use this density result instead of Theorem 17. In doing so, we could use a much sparser subgraph H in the proof of Proposition 16. However, our algorithm would still run in time O?(n5/3) because the bottleneck is our call to the algorithm of Theorem 2. 6 Open problems The most pressing question is whether we can achieve a 4/3-approximation for the girth in subquadratic time. If it is not the case then, what is the best approximation factor we can get in subquadratic time? We note that in [17], Roditty and Vassilevska Williams conjectured that we cannot achieve a (2 ? ?)-approximation already for unweighted graphs5. 5 They did obtain such an algorithm for triangle-free graphs. If their conjecture is true then, this would imply our algorithm is essentially optimal (at least for the non-dense graphs with O(n2??) edges). However, for the dense graphs with sorted adjacency lists, we left open whether a better approximation-factor than 4 can be obtained in o(n2)-time. Finally, another interesting question is whether a constant-approximation for the girth can be computed in quasi linear time. We recall that this is wide open even for unweighted graphs [7]. 1 2 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 D. Aingworth , C. Chekuri , P. Indyk , and R. Motwani . Fast estimation of diameter and shortest paths (without matrix multiplication) . SIAM Journal on Computing , 28 ( 4 ): 1167 - 1181 , 1999 . S. Baswana and S. Sen . Approximate distance oracles for unweighted graphs in expected O (n 2) time . ACM Transactions on Algorithms (TALG) , 2 ( 4 ): 557 - 577 , 2006 . J. A. Bondy and U. S. R. Murty . Graph theory. Grad . Texts in Math., 2008 . W. Brown . On graphs that do not contain a Thomsen graph . Canadian Mathematical Bulletin , 9 ( 2 ): 1 - 2 , 1966 . S. Chechik . Approximate distance oracles with constant query time . In ACM STOC'14 , pages 654 - 663 , 2014 . Better approximation algorithms for the graph diameter . In SODA , pages 1041 - 1052 . SIAM, 2014 . S. Dahlgaard , M. Knudsen , and M. St?ckel . New Subquadratic Approximation Algorithms for the Girth . Technical report , arXiv, 2017 . arXiv: 1704 . 02178 . Technical report, arXiv , 2018 . arXiv: 1810 .10229. A. Itai and M. Rodeh . Finding a minimum circuit in a graph . SIAM Journal on Computing , 7 ( 4 ): 413 - 423 , 1978 . A. Lingas and E. Lundell . Efficient approximation algorithms for shortest cycles in undirected graphs . Information Processing Letters , 109 ( 10 ): 493 - 498 , 2009 . J. Pachocki , L. Roditty , A. Sidford , R. Tov , and V. Vassilevska Williams . Approximating cycles in directed graphs: Fast algorithms for girth and roundtrip spanners . In SODA , pages 1374 - 1392 . SIAM, 2018 . M. Patrascu and L. Roditty . Distance Oracles beyond the Thorup-Zwick Bound . SIAM Journal on Computing , 43 ( 1 ): 300 - 311 , 2014 . S. Robinson . Toward an optimal algorithm for matrix multiplication . SIAM news , 38 ( 9 ): 1 - 3 , 2005 . L. Roditty , M. Thorup , and U. Zwick . Deterministic constructions of approximate distance oracles and spanners . In ICALP , pages 261 - 272 . Springer, 2005 . L. Roditty and R. Tov . Approximating the girth . ACM Transactions on Algorithms (TALG) , 9 ( 2 ): 15 , 2013 . L. Roditty and V. Vassilevska Williams . Minimum weight cycles and triangles: Equivalences and algorithms . In FOCS , pages 180 - 189 . IEEE, 2011 . L. Roditty and V. Vassilevska Williams . Subquadratic time approximation algorithms for the girth . In SODA , pages 833 - 845 . SIAM, 2012 . M. Thorup and U. Zwick . Approximate distance oracles . Journal of the ACM (JACM) , 52 ( 1 ): 1 - 24 , 2005 . V. Vassilevska Williams and R. Williams . Subcubic equivalences between path, matrix and triangle problems . In FOCS , pages 645 - 654 . IEEE, 2010 . C. Wulff-Nilsen . Approximate distance oracles with improved preprocessing time . In ACM/SIAM SODA'12 , pages 202 - 208 , 2012 . R. Yuster and U. Zwick . Finding even cycles even faster . SIAM Journal on Discrete Mathematics , 10 ( 2 ): 209 - 222 , 1997 .


This is a preview of a remote PDF: http://drops.dagstuhl.de/opus/volltexte/2019/10625/pdf/LIPIcs-ICALP-2019-49.pdf

Guillaume Ducoffe. Faster Approximation Algorithms for Computing Shortest Cycles on Weighted Graphs, LIPICS - Leibniz International Proceedings in Informatics, 2019, 49:1-49:13, DOI: 10.4230/LIPIcs.ICALP.2019.49