Approximating Long Cycle Above Dirac's Guarantee

Parameterization above (or below) a guarantee is a successful concept in parameterized algorithms. The idea is that many computational problems admit ``natural'' guarantees bringing to algorithmic questions whether a better solution (above the guarantee) could be obtained efficiently. The above guarantee paradigm has led to several exciting discoveries in the areas of parameterized algorithms and kernelization. We argue that this paradigm could bring forth fresh perspectives on well-studied problems in approximation algorithms. Our example is the longest cycle problem. One of the oldest results in extremal combinatorics is the celebrated Dirac's theorem from 1952. Dirac's theorem provides the following guarantee on the length of the longest cycle: for every 2-connected n-vertex graph G with minimum degree \delta(G)\leq n/2, the length of a longest cycle L is at least 2\delta(G). Thus, the ``essential'' part in finding the longest cycle is in approximating the ``offset'' k = L - 2 \delta(G). The main result of this paper is the above-guarantee approximation theorem for k. Informally, the theorem says that approximating the offset k is not harder than approximating the total length L of a cycle. In other words, for any (reasonably well-behaved) function f, a polynomial time algorithm constructing a cycle of length f(L) in an undirected graph with a cycle of length L, yields a polynomial time algorithm constructing a cycle of length 2\delta(G)+\Omega(f(k)).


Introduction
One of the concepts that had a strong impact on the development of parameterized algorithms and kernelization is the idea of the above guarantee parameterization.Above guarantee parameterization grounds on the following observation: the natural parameterization of a maximization/minimization problem by the solution size is not satisfactory if there is a lower bound for the solution size that is sufficiently large [23].To make this discussion concrete, consider the example of the classical NP-complete problem Max Cut.Observe that in any graph with m edges there is always a cut containing at least m/2 edges.(Actually, slightly better bounds are known in the literature [18,10].)Thus Max Cut is trivially fixed-parameter tractable (FPT) parameterized by the size of the max-cut.Indeed, the following simple algorithm shows that the problem is FPT: If k ≤ m/2, then return yes; else m ≤ 2k and any brute-force algorithm will do the job.However, the question about Max Cut becomes much more meaningful and interesting, when one seeks a cut above the "guaranteed" lower bound m/2.
The above guarantee approach was introduced by Mahajan and Raman [45] and it was successfully applied in the study of several fundamental problems in parameterized complexity and kernelization.For illustrative examples, we refer to [1,4,14,23,25,32,33,34,36,37,44], see also the recent survey of Gutin and Mnich [35].Quite surprisingly, the theory of the above (or below) guarantee approximation remains unexplored.(Notable exceptions are the works of Mishra et al. [46] on approximating the minimum vertex cover beyond the size of a maximum matching and of Bollobás and Scott on approximating max-cut beyond the m/2 + m/8 bound [10].) In this paper, we bring the philosophy of the above guarantee parameterization into the realm of approximation algorithms.In particular, The goal of this paper is to study the approximability of the classical problems of finding a longest cycle and a longest (s, t)-path in a graph from the viewpoint of the above guarantee parameterization.
Our results.Approximating the length of a longest cycle in a graph enjoys a lengthy and rich history [6,8,21,20,28,29,49].There are several fundamental results in extremal combinatorics providing lower bounds on the length of a longest cycle in a graph.The oldest of these bounds is given by Dirac's Theorem from 1952 [17].Dirac's Theorem states that a 2-connected graph G with the minimum vertex degree δ(G) contains a cycle of length L ≥ min{2δ(G), |V (G)|}.Since every longest cycle in a graph G with δ(G) < 1  2 |V (G)| (otherwise, G is Hamiltonian and a longest cycle can be found in polynomial time) always has a "complementary" part of length 2δ(G), the essence of the problem is in computing the "offset" k = L − 2δ(G).Informally, the first main finding of our paper is that Dirac's theorem is well-compatible with approximation.We prove that approximating the offset k is essentially not more difficult than approximating the length L.
More precisely.Recall that f is subadditive if for all x, y it holds that f (x + y) ≤ f (x) + f (y).Our main result is the following theorem.
Theorem 1.Let f : R + → R + be a non-decreasing subadditive function and suppose that we are given a polynomial-time algorithm finding a cycle of length at least f (L) in graphs with the longest cycle length L. Then there exists a polynomial time algorithm that finds a cycle of length at least 2δ(G) + Ω(f (L − 2δ(G))) in a 2-connected graph G with δ(G) ≤ 1  2 |V (G)| and the longest cycle length L.
The 2-connectivity condition is important.As was noted in [24], deciding whether a connected graph G contains a cycle of length at least 2δ(G) is NP-complete.Theorem 1 trivially extends to approximating the longest path problem above 2δ(G).For the longest path, the requirement on 2-connectivity of a graph can be relaxed to connectivity.This can be done by a standard reduction of adding an apex vertex v to the connected graph G, see e.g.[24].The minimum vertex degree in the new graph G + v, which is 2-connected, is equal to δ(G) + 1, and G has a path of length at least L if and only if G + v has a cycle of length at least L + 2. Thus approximation of the longest cycle (by making use of Theorem 1) in G + v, is also the approximation of the longest path in G.
Related work.The first approximation algorithms for longest paths and cycles followed the development of exact parameterized algorithms.Monien [47] and Bodlaender [9] gave parameterized algorithms computing a path of length L in times O(L!2 L n) and O(L!nm) respectively.These algorithms imply also approximation algorithms constructing in polynomial time a path of length Ω(log L/ log log L), where L is the longest path length in graph G.In their celebrated work on color coding, Alon, Yuster, and, Zwick [2] obtained an algorithm that in time O(5.44 L n) finds a path/cycle of length L. The algorithm of Alon et al. implies constructing in polynomial time a path of length Ω(log L).A significant amount of the consecutive work targets to improve the base of the exponent c L in the running times of the parameterized algorithms for longest paths and cycles [42,50,27,5,7].The surveys [26,43], and [15,Chapter 10] provide an overview of ideas and methods in this research direction.The exponential dependence in L in the running times of these algorithms is asymptotically optimal: An algorithm finding a path (or cycle) of length L in time 2 o(L) n O (1) would fail the Exponential Time Hypothesis (ETH) of Impagliazzo, Paturi, and Zane [38].Thus none of the further improvements in the running times of parameterized algorithms for longest cycle or path, would lead to a better than Ω(log L) approximation bound.
Björklund and Husfeldt [6] made the first step "beyond color-coding" in approximating the longest path.They gave a polynomial-time algorithm that finds a path of length Ω(log L/ log log L) 2 in a graph with the longest path length L. Gabow in [29] enhanced and extended this result to approximating the longest cycle.His algorithm computes a cycle of length 2 Ω( √ log L/ log log L) in a graph with a cycle of length L. Gabow and Nie [31] observed that a refinement of Gabow's algorithm leads to a polynomial-time algorithm constructing cycles of length 2 Ω( √ log L) .This is better than (log(L)) O (1) but worse than L ε .Pipelining the algorithm of Gabow and Nie with Theorem 1 yields a polynomial time algorithm constructing in a 2-connected graph G a cycle of length 2δ(G) + Ω(c √ log k ).For graphs of bounded vertex degrees, better approximation algorithms are known [13,21].
The gap between the upper and lower bounds for the longest path approximation is still big.Karger, Motwani, and Ramkumar [40] proved that the longest path problem does not belong to APX unless P = NP.They also show that for any ε > 0, it cannot be approximated within 2 log 1−ε n unless NP ⊆ DTIME(2 O(log 1/ε n) ).Bazgan, Santha, and Tuza [3] extended these lower bounds to cubic Hamiltonian graphs.For directed graphs the gap between the upper and lower bounds is narrower [8,30].
Our approximation algorithms are inspired by the recent work Fomin, Golovach, Sagunov, and Simonov [24] on the parameterized complexity of the longest cycle beyond Dirac's bound.Fomin et al. were interested in computing the "offset" beyond 2δ(G) exactly.Their parameterizes algorithm decides whether G contains a cycle of length at least 2δ(G) + k in time 2 O(k) n O (1) , and thus in polynomial time computes a cycle of length 2δ(G) + Ω(log k).However, the tools developed in [24] are not sufficient to go beyond Ω(log k)-bound on the offset.The main combinatorial tools from [24] are Erdős-Gallai decomposition and Dirac decomposition of graphs.For the needs of approximation, we have to develop novel ("nested") variants or prove additional structural properties of these decompositions.
Dirac's theorem is one of the central pillars of Extremal Graph Theory.The excellent surveys [12] and [11] provide an introduction to this fundamental subarea of graph theory.Besides [24], the algorithmic applications of Dirac's theorem from the perspective of parameterized complexity were studied by Jansen, Kozma, and Nederlof in [39].
Paper structure.Section 2 provides an overview of the techniques employed to achieve our results.Then, Section 3 introduces notations and lists auxiliary results.Section 4 guides through the proof of the approximation result for (s, t)-paths, which is the key ingredient required for Theorem 1. Section 5 is dedicated to the proof of Theorem 1 itself.Finally, we conclude with a summary and some open questions in Section 6.

Overview of the proofs
In this section, we provide a high-level strategy of the proof of Theorem 1, as well as key technical ideas needed along the way.The central concept of our work is an approximation algorithm for the Longest Cycle problem.Formally, such an algorithm should run in polynomial time for a given graph G and should output a cycle of length at least f (L), where L is the length of the longest cycle in G.The function f here is the approximation guarantee of the algorithm.In our work, we allow it to be an arbitrary non-decreasing function f : R + → R + that is also subadditive (i.e., f (x) + f (y) ≥ f (x + y) for arbitrary x, y).We also note that an f (L)-approximation algorithm for Longest Cycle immediately gives a 1  2 f (2L)-approximation algorithm for Long (s, t)-Path in 2-connected graphs (by Menger's theorem, see Lemma 2 for details).
Our two main contributions assume that we are given such an f -approximation algorithm as a black box.In fact, we only require to run this algorithm on an arbitrary graph as an oracle and receive its output.We do not need to modify or know the algorithm routine.
While the basis of our algorithm comes from the structural results of Fomin et al. [24], in the first part of this section we do not provide the details on how it is used.
The first of our contributions is a polynomial-time algorithm that finds a long (s, t)-path in a given 2-connected graph G with two vertices s, t ∈ V (G).The longest (s, t)-path in G always has length δ(G − {s, t}) + k for k ≥ 0 by Erdős-Gallai theorem, and the goal of the algorithm is to find an (s, t)-path of length at least δ(G − {s, t}) + Ω(f (k)) in G.To find such a path, this algorithm first recursively decomposes the graph G in a specific technical way.As a result, it outputs several triples (H i , s i , t i ) in polynomial time, where H i is a 2-connected minor of G and s i , t i ∈ V (H i ).For each triple, the algorithm runs the black box to find a f -approximation of the longest (s i , t i )-path in H i .In the second round, our algorithm cleverly uses constructed approximations to construct a path of length at least δ(G − {s, t}) + Ω(f (k)) in the initial graph G.This is summarized as the following theorem.
Theorem 2. Let f : R + → R + be a non-decreasing subadditive function and suppose that we are given a polynomial-time algorithm computing an (s, t)-path of length at least f (L) in graphs with given two vertices s and t having the longest (s, t)-path of length L. Then there is a polynomial-time algorithm that outputs an (s, t)-path of length at least δ(G − {s, t}) + Ω(f (L − δ(G − {s, t}))) in a 2-connected graph G with two given vertices s and t having the longest (s, t)-path length L.
The second (and main) contribution of this paper is the polynomial-time algorithm that approximates the longest cycle in a given 2-connected graph G such that 2δ(G) ≤ |V (G)|.It employs the black-box f -approximation algorithm for Longest Cycle to find a cycle of length 2δ(G)+Ω(f (k)), where 2δ(G) + k is the length of the longest cycle in G.By Dirac's theorem applied to G, k is always at least 0.
To achieve that, our algorithm first tries to decompose the graph G.However, in contrast to the first contributed algorithm, here the decomposition process is much simpler.In fact, the decomposition routine is never applied recursively, as the decomposition itself needs not to be used: its existence is sufficient to apply another, simple, procedure.
Similarly to the first contribution, the algorithm then outputs a series of triples (H i , s i , t i ), where H i is a 2-connected minor of G and s i , t i ∈ V (H i ).The difference here is that for each triple the algorithm runs not the initial black-box f -approximation algorithm, but the algorithm of the first contribution, i.e. the algorithm of Theorem 2. Thus, the output of each run is an (s Finally, from each approximation, our algorithm constructs a cycle of length at least 2δ(G) + Ω(f (k i )).It is guaranteed that k i = Ω(k) for at least one i, so the longest of all constructed cycles is of length at least 2δ(G) + Ω(f (k)).The following theorem is in order.Theorem 1.Let f : R + → R + be a non-decreasing subadditive function and suppose that we are given a polynomial-time algorithm finding a cycle of length at least f (L) in graphs with the longest cycle length L. Then there exists a polynomial time algorithm that finds a cycle of length at least | and the longest cycle length L.
One may note that Theorem 2 actually follows from Theorem 1 (again, by Menger's theorem, see Lemma 2).However, as described above, the algorithm in Theorem 1 employs the algorithm of Theorem 2, so we have to prove the latter before the former.
In the remaining part of this section, we provide more detailed proof overviews of both theorems, in particular, we explain how the algorithms employ the structural results of [24].In both proofs, we complement these results by showing useful properties of specific graph decompositions.For clarity, we start with Theorem 1, as its proof is less involved.

Approximating long cycles
The basis of our algorithm is the structural result due to Fomin et al. [24].In that work, the authors show the following: There is an algorithm that, given a cycle in a 2-connected graph, either finds a longer cycle or finds that G is of a "particular structure".This algorithm can be applied to any cycle of length less than (2 + σ 1 ) • δ(G) (to be specific, we use σ 1 = 1 24 , see Lemma 14 for details).
To see how this stuctural result is important, recall that we aim to find a cycle of length at least 2δ(G) + Ω(f (k)) in a 2-connected graph G with the longest cycle length 2δ(G) + k.Our algorithm simply starts with some cycle in G and applies the result of [24] to enlarge it exhaustively.It stops when either a cycle is of length at least (2 + σ 1 ) • δ(G), or the particular structure of G is found.
The crucial observation here is that if a long cycle is found, we can trivially find a good approximation.If σ 1 • δ(G) is, e.g., less than σ 1 /10 • f (k), then 10δ(G) < f (k).If we just apply the blackbox f -approximation algorithm for the Longest Cycle problem, we get a cycle of length at least Hence, by taking the longest of the cycles of length (2 + σ 1 ) • f (k) and of length f (2δ(G) + k) we always achieve a good approximation guarantee on k.
The most important part of the algorithm is employed when the "particular structure" outcome is received from the structural lemma applied on G and the current cycle C.Here we need to be specific about this structure, and the outcome can be of two types.The first outcome is a bounded vertex cover of the graph.This vertex cover is of size at most δ(G) Such vertex cover is a guarantee that C is not much shorter than the longest cycle in G: the length of the longest cycle is bounded by twice the vertex cover size, so k ≤ 4(k ′ + 1).Hence, k ′ = Ω(k) and C is a sufficient approximation.
The second, and last, structural outcome is the Dirac decomposition, defined in [24].Basically, this decomposition is obtained by finding a small separator of G (that consists of just two subpaths P 1 , P 2 of the cycle C), and the parts of this decomposition are the connected components of G after the separation.The main result on Dirac decomposition proved in [24] is that there always exists a longest cycle that contains an edge in at least one of these parts.
While the definition and properties of Dirac decomposition may seem quite involved, our algorithm does not even require the Dirac decomposition of G to be found.In fact, we show a new nice property of Dirac decomposition.It guarantees that if a Dirac decomposition for G exists, then there also exists a 2-vertex separator {u, v} of G that also divides the longest cycle in G into almost even parts.Our contribution is formulated in the following lemma.
Lemma 1.Let G be a 2-connected graph and P 1 , P 2 induce a Dirac decomposition for a cycle C of length at most 2δ(G) + κ in G such that 2κ ≤ δ(G).If there exists a cycle of length at least 2δ(G) + k in G, then there exist u, v ∈ V (G) such that • G − {u, v} is not connected, and Our algorithm employs Lemma 1 in the following way.Since there are O(|V (G)| 2 ) vertex pairs in G, our algorithm iterates over all vertex pairs.If a pair u, v separates the graph into at least two parts, then our algorithm finds a long (u, v)-path that contains vertices in only one of the parts.Formally, it iterates over all connected components in G − {u, v}.For a fixed connected component H, our algorithm applies the algorithm of Theorem 2 to the graph G[V (H) ∪ {u, v}] + uv (the edge uv is added to ensure 2-connectivity), to find an approximation of the longest (u, v)-path.By Lemma 1, if u, v is the required separating pair, then for at least one H the length of the found (u, v)-path should be δ(G)+Ω(k).And if such a path is found, a sufficiently long (u, v)-path outside H in G is guaranteed by Erdős-Gallai theorem.Together, these two paths form the required cycle of length 2δ(G) + Ω(k).
With that, the proof overview of Theorem 1 is finished.The formal proof is present in Section 5.

Approximating long (s, t)-paths
While the algorithm of Theorem 1 does not use the underlying Dirac decomposition explicitly, in the case of finding (s, t)-paths (and to prove Theorem 2), we require deeper usage of the obtained graph decomposition.While the Dirac decomposition of Fomin et al. was originally used in [24] to find long cycles above 2δ(G), for finding (s, t)-paths above δ(G − {s, t}) the authors introduced the Erdős-Gallai decomposition.
In the formal proof of Theorem 2 in Section 4, we give a complete definition of Erdős-Gallai decomposition.In this overview, we aim to avoid the most technical details in order to provide an intuition of the structure of the decomposition and how our algorithm employs it.
Similarly to Dirac decomposition, the Erdős-Gallai decomposition is obtained through the routine that, given a graph G and an (s, t)-path inside it, either enlarges the path or reports that two subpaths P 1 (that starts with s) and P 2 (that starts with t) of the given path induce (when deleted) an Erdős-Gallai decomposition in G.This routine can be applied to an (s, t)-path until it reaches (1 + σ 2 ) • δ(G − {s, t}) in length (specifically, σ 2 = 1 4 , see Lemma 7; in this overview, we also skip the case of a Hamiltonian (s, t)-path for brevity).Note that, in contrast to the cycle enlargement routine of the Dirac decomposition, here the bounded vertex cover outcome is not possible.Similarly to the algorithm of the previous subsection, the only non-trivial part of the algorithm is dealing with the Erdős-Gallai decomposition outcome.In the other case, a single run of the black-box f -approximation algorithm for Longest Cycle provides the desired approximation immediately.
The main property of this decomposition due to [24] is as follows: If an (s, t)-path of length at least δ(G − {s, t}) + k exists in G, then there necessarily exists the path of length at least δ(G−{s, t})+k that goes through one of the connected components in the decomposition.Moreover, for each of the connected components G i there is exactly one pair of distinct entrypoints s i , t i : if an (s, t)-path in G goes through G i , it should necessary enter G i in s i (or t i ) once and leave G i in t i (or s i ) exactly once as well.
Additionally to that, we have that the degree of each G i is not much different from G: δ(G i − {s i , t i }) ≥ δ(G − {s, t}) − 2 holds true.And this constant difference is always compensated by paths from s and t to s i and t i : if we succeed to find an (s i , t i )-path of length at least δ(G i − {s i , t i }) + k i inside G i , we can always complete it with any pair of disjoint paths from {s, t} to {s i , t i } into an (s, t)-path of length δ(G − {s, t}) + k i in G. Should this pair be longer than the trivial lower bound of 2, it grants the additional length above δ(G − {s, t}) + k i .
The previous paragraph suggests the following approach for our approximation algorithm: for each G i , s i , t i , our algorithm applies itself recursively to find an (s i , t i )-path of length δ(G i −{s i , t i }+ Ω(f (k i )), where k i comes from the longest (s i , t i )-path length in G i .Since the other part of the additional length comes from two disjoint paths between {s, t}, and {s i , t i }, we would like to employ the black-box f -approximation algorithm to find the f -approximation of this pair of paths.
Unfortunately, finding such pair of paths reduces only to finding a long cycle through a given pair of vertices (it is enough to glue s with t and s i with t i in G, and ask to find the long cycle through the resulting pair of vertices).In their work, Fomin et al. have shown that the problem of finding such a cycle of length at least k can be done in 2 O(k) • n O(1) time.However, this is of little use to us, as k is only bounded by O(δ(G)), but we require polynomial time.Simultaneously, we do not know of any way to force the black-box algorithm to find an f -approximation for a cycle through the given pair of vertices.
These arguments bring us away from the idea of a recursive approximation algorithm.Instead, our approximation algorithm will apply the black-box algorithm to a single "complete-picture" graph that is obtained according to the structure brought by the Erdős-Gallai decomposition.However, the recursion here remains in the sense that we apply the path-enlarging routine to each component of the decomposition.This brings us to the idea of the recursive decomposition, which we define as the nested Erdős-Gallai decomposition in Section 4. This decomposition can be seen as a tree, where the root is the initial triple (G, s, t), the children of a node represent the triples (G i , s i , t i ) given by the Erdős-Gallai decomposition, and the leaves of this decomposition are the graphs G i where sufficient approximations of long (s i , t i )-paths are found (by taking the longest of (1 + σ 2 ) • δ(G − {s i , t i })-long path from the enlarging routine and the approximation obtained from the blackbox algorithm).A schematic picture of this novel decomposition is present in Figure 1.
In Section 4, we show that a long path found inside a leaf (G i , s i , t i ) of the decomposition can be contracted into a single edge s i t i .Moreover, if (G j , s j , t j ) is a child of a (G i , s i , t i ) in the decomposition, and the longest pair of paths from {s i , t i } to {s j , t j } is just a pair of edges (so it does not grant any additional length as described before), we contract these edges.The crucial in our proof is the claim that after such a contraction, if an (s, t)-path of length δ(G − {s, t}) + k exists in the initial graph, an (s, t)-path of length at least Ω(k) exists in the graph obtained with described contractions.After doing all the contractions, the algorithm applies the black-box algorithm to the transformed graph and finds an (s, t)-path of length f (Ω(k)) (which is Ω(f (k)) by subadditivity) inside it.
The final part of our algorithm (and the proof of Theorem 2) is the routine that transforms this (s, t)-path inside the contracted graph G into a path of length δ(G − {s, t}) + Ω(f (k)) in the initial graph G.In this part, we prove that it is always possible to transform an (s, t)-path of length r in the contracted graph into a path of length Ω(r) that goes through at least one edge corresponding to a leaf of the nested Erdős-Gallai decomposition (hence, to a good approximation of (s i , t i )-path inside G i ).Finally, we observe that reversing the contractions in G transforms this path into the required approximation.
This finishes the overview of the proof of Theorem 2. Section 4 contains it fully, with all Figure 1: A schematic example of a nested Erdős-Gallai decomposition (left) and the corresponding recursion tree (right).Red straight paths inside G i denote the pair of paths inducing an Erdős-Gallai decomposition in G i .Bold (s i , t i )-paths are sufficient approximations of the longest (s i , t i )-paths in technical details and formal proofs.

Preliminaries
In this section, we define the notation used throughout the paper and provide some auxiliary results.We use [n] to denote the set of positive integers {1, . . ., n}.We remind that a function We denote the set of all nonnegative real numbers by R + .
Recall that our main theorems are stated for arbitrary nondecreasing subadditive functions f : R + → R, such that an algorithm achieving the respective approximation exists.Throughout the proofs, we will additionally assume that f (x) ≤ x for every x ∈ R + .For any integer x ≥ 3, this is already implied by the statement, since a consistent approximation algorithm cannot output an (s, t)-path (respectively, cycle) of length greater than x in a graph where the longest (s, t)-path (respectively, cycle) has length x.However, for a general function f (•) this does not necessarily hold on the whole R + .If this is the case, for clarity of the proofs we redefine f (x) := min{x, f (x)} for every x ∈ R + .Clearly, f remains subadditive and non-decreasing, while also imposing exactly the same guarantee on the approximation algorithm.
Graphs.We consider only finite simple undirected graphs and use the standard notation (see, e.g., the book of Diestel [16]).We use V [G] and E(G) to denote the sets of vertices and edges, respectively, of a graph G. Throughout the paper, we use n and m to denote the number of vertices and the number of edges of a considered graph if it does not create confusion.For a set X ⊆ V (G), G[X] is used to denote the subgraph of G induced by X and we write G− X to denote the subgraph of G induced by V (G) \ X.For a single-vertex set {v}, we write We denote by δ(G) = min v∈V (G) deg G (v) the minimum degree of G.We may omit the subscript in the above notation if the considered graph is clear from the context.We remind that the edge contraction operation for uv ∈ E(G) replaces u and v by a single vertex w uv that is adjacent to every vertex of N G ({u, v}).A set of vertices X ⊆ V (G) is vertex cover if every edge of G has at least one endpoint in X.
A path P in a graph G is a subgraph of G whose set of vertices can be written as {v 0 , . . ., v k } where We may write a path P as the sequence of its vertices v 0 , . . ., v k .The vertices v 0 and v k are called endpoints of P and other vertices are internal.For a path P with endpoints s and t, we say that P is an (s, t)-path.Two paths P 1 and P 2 are (vertex-)disjoint if they have no common vertex and internally disjoint if no internal vertex of either of the paths is a vertex of the other path.
The length of a path (a cycle, respectively) is the number of its edges.For two internally disjoint paths P 1 = v 0 , . . ., v k and P 2 = u 0 , . . ., v s sharing exactly one endpoint v k = u 0 , we write P 1 P 2 to denote their concatenation, that is, the path v 0 , . . ., v k , u 1 , . . ., u s .If P 1 and P 2 share both endpoints and at least one of them has internal vertices, we write P 1 P 2 to denote the cycle composed by the paths.A path Recall that G is connected if for every two vertices s and t, G contains an (s, t)-path.
A block of a connected graph G is an inclusion maximal induced subgraph without cut-vertices.Note that if G has at least two vertices, then each block is either isomorphic to K 2 or a 2-connected graph.For a block B of G, a vertex v ∈ V (B) that is not a cut-vertex of G is called inner.Blocks in a connected graph form a tree structure (viewing each block as a vertex of the forest and two blocks are adjacent if they share a cut-vertex).The blocks corresponding to the leaves of the block-tee, are called leaf-blocks.For s, t ∈ V (G), S ⊆ V (G) \ {s, t} is an (s, t)-separator if G − S has no (s, t)-path; we also say that S separates s from t.We also say that S separates two sets of vertices A and B if S separates each vertex of A from every vertex of B.
The following useful observation follows immediately from Menger's theorem (see, e.g., [16,41]).Lemma 2. For any 2-connected graph G with a cycle of length L, there is a path of length at least L/2 between any pair of vertices in G.Moreover, given a cycle C and two distinct vertices s and t, an (s, t)-path of length at least |V (C)|/2 can be constructed in polynomial time.
We observe that given an approximation algorithm for a longest cycle, we can use it as a black box to approximate a longest path between any two vertices.Lemma 3. Let A be a polynomial-time algorithm that finds a cycle of length at least f (L) in a graph with the longest cycle length L. Then there is a polynomial-time algorithm using A as a subroutine that, given a graph G and two distinct vertices s and t, finds an (s, t)-path of length at least 1  2 f (2L), where L is the length of a longest (s, t)-path in G. Proof.Let G be a graph and let s, t ∈ V (G) be distinct vertices.We assume without loss of generality that G is connected.Let P be a longest (s, t)-path in G and let L be its length.If st is a bridge of G, then G has a unique (s, t)-path and and its length is one.In this case, our algorithm returns this path that trivially can be found in polynomial time.Assume that this is not the case.Then st / ∈ E(P ) and L ≥ 2.
We construct two copies G 1 and G 2 of G. Denote by s 1 and s 2 the copies of s in G 1 and G 2 , respectively.Similarly, let t 1 and t 2 be the copies of t, and denote by P 1 and P 2 the copes of P in G 1 and G 2 , respectively.Next, we construct the graph G ′ by unifying s 1 and s 2 , and t 1 and t 2 (if st ∈ E(G), the edges s 1 t 1 and s 2 t 2 are unified as well).Denote by s ′ the vertex of G ′ obtained from s 1 and s 2 , and let t ′ be the vertex obtained from t 1 and t 2 .Note that P 1 and P 2 are internally disjoint (s ′ , t ′ )-paths in G ′ .In particular, this implies that s ′ and t ′ are vertices of the same block B of G ′ , and P 1 and P 2 are paths in B. Therefore, B contains the cycle C = P 1 P 2 of length 2L.We obtain that the longest cycle length in B is at least 2L.We call A on B and this algorithm outputs a cycle C of length at least f (2L).Note that B is distinct from K 2 , i.e., is 2-connected.By Lemma 2, B has an (s ′ , t ′ )-path P ′ of length at least 1  2 Since G ′ can be constructed in polynomial time and the unique block B of G ′ containing s ′ and t ′ can be found in polynomial (linear) time (see, e.g., [41]), the overall running time is polynomial.
We will use as a subroutine an algorithm finding two disjoint paths between two pairs of vertices of total length at least k, where k is the given parameter.For us, constant values of k suffice, though in fact there exists an FPT algorithm for this problem parameterized by the total length.It follows as an easy corollary from the following result of [24] about Long (s, t)-Cycle, the problem of finding a cycle of length at least k through the given two vertices s and t.

For completeness, we show the corollary next.
Corollary 1.There is an FPT algorithm that, given a graph G with two pairs of vertices {s, t} and {s ′ , t ′ }, and a parameter k, finds two disjoint paths between {s, t} and {s ′ , t ′ } in G of total length at least k, or correctly determines that such paths do not exist.
Proof.Construct a new graph H that consists of the graph G together with two additional vertices u and v.The vertex u has exactly two neighbors in H, s and t, and the neighbors of v are s ′ and t ′ .Now run the algorithm for Long (s, t)-Cyclewith the parameter k + 4 to find a cycle in H going through the vertices u and v.If such a cycle is found, then removing the vertices u and v from it yields a pair of disjoint paths between {s, t} and {s ′ , t ′ } in G of total length at least k.In the other direction, if there is a pair of desired disjoint paths in G, then together with the vertives u and v they constitute a cycle of length at least k + 4 in H.
Finally, it is convenient to use the following corollary, which generalizes the theorem of Erdős and Gallai [19,Theorem 1.16].
Corollary 2 (Corollary 3 in [24]).Let G be a 2-connected graph and let s, t be a pair of distinct vertices in G.For any B ⊆ V (G) there exists a path of length at least δ(G − B) between s and t in G.Moreover, there is a polynomial time algorithm constructing a path of such length.

Approximating (s, t)-path
In this section, we provide the formal proof of Theorem 2, stating that any guarantee for approximating the longest cycle in a 2-connected graph can be transferred to approximating the longest (s, t)-path above minimum degree.For the convenience of the reader, we recall the precise statement next.
Theorem 2. Let f : R + → R + be a non-decreasing subadditive function and suppose that we are given a polynomial-time algorithm computing an (s, t)-path of length at least f (L) in graphs with given two vertices s and t having the longest (s, t)-path of length L. Then there is a polynomial-time algorithm that outputs an (s, t)-path of length at least δ(G − {s, t}) + Ω(f (L − δ(G − {s, t}))) in a 2-connected graph G with two given vertices s and t having the longest (s, t)-path length L.
In order to obtain this result, we first recall the concept of Erdős-Gallai decomposition introduced in [24] together with a few of its helpful properties established there.Then we introduce the recursive generalization of this concept, called nested Erdős-Gallai decomposition, and show how to obtain with its help the compression of the graph such that a long (s, t)-path in the compressed graph can be lifted to an (s, t)-path in the original graph with a large offset.

Erdős-Gallai decomposition
This subsection encompasses the properties of an Erdős-Gallai decomposition, defined next.The definition itself and most of the technical results presented here are due to [24].Some of the results from [24] need to be modified in order to be used for our purposes, we supply such results with full proofs.Note that the statements in [24] hold in the more general case where there is also a low-degree vertex subset in the graph, here while recalling the results we automatically simplify the statements.Next, we recall the definition of an Erdős-Gallai decomposition.
Definition 1 (Erdős-Gallai decomposition and Erdős-Gallai component, Definition 2 in [24]).Let P be a path in a 2-connected graph G.We say that two disjoint paths P 1 and P 2 in G induce an Erdős-Gallai decomposition for P in G if • Path P is of the form P = P 1 P ′ P 2 , where the inner path P ′ has at least δ(G − {s, t}) edges.
• There are at least two connected components in G − V (P 1 ∪ P 2 ), and for every connected component H, it holds that |V (H)| ≥ 3 and one of the following.
(R1) H is 2-connected and the maximum size of a matching in G between V (H) and V (P 1 ) is one, and between V (H) and V (P 2 ) is also one; (R2) H is not 2-connected, exactly one vertex of , and no inner vertex from a leaf-block of H has a neighbor in P 2 ; (R3) The same as (R2), but with P 1 and , and no inner vertex from a leaf-block of H has a neighbor in P 1 .
The set of Erdős-Gallai components for an Erdős-Gallai decomposition is defined as follows.First, for each component H of type (R1), H is an Erdős-Gallai component of the Erdős-Gallai decomposition.Second, for each H of type (R2), or of type (R3), all its leaf-blocks are also Erdős-Gallai components of the Erdős-Gallai decomposition.
As long as an Erdős-Gallai decomposition is available, Erdős-Gallai components allow us to bound the structure of optimal solutions in a number of ways.First, Fomin et al. [24] observe that the longest (s, t)-path necessarily visits an Erdős-Gallai component.
Lemma 4 (Lemma 7 in [24]).Let G be a graph and P 1 , P 2 induce an Erdős-Gallai decomposition for an (s, t)-path P in G. Then there is a longest (s, t)-path in G that enters an Erdős-Gallai component.
Next, since an Erdős-Gallai component has a very restrictive connection to the rest of the graph, it follows that any (s, t)-path has only one chance of entering the component.
Lemma 5 (Lemma 5 in [24]).Let G be a 2-connected graph and P be an (s, t)-path in G. Let paths P 1 , P 2 induce an Erdős-Gallai decomposition for P in G. Let M be an Erdős-Gallai component.Then for every (s, t)-path P ′ in G, if P ′ enters M , then all vertices of V (M ) ∩ V (P ′ ) appear consecutively in P ′ .
For the purposes of recursion, it is convenient to enclose an Erdős-Gallai component together with some of its immediate connections, so that this slightly larger subgraph behaves exactly like an (s, t)-path instance.The subgraph K in the next lemma plays this role.
Lemma 6 (Lemma 8 in [24]).Let paths P 1 , P 2 induce an Erdős-Gallai decomposition for an (s, t)path P in graph G. Let M be an Erdős-Gallai component in G. Then there is a polynomial time algorithm that outputs a 2-connected subgraph K of G and two vertices s ′ , t ′ ∈ V (K), such for that every (s, t)-path P ′ in G that enters M , the following hold: Most importantly, Erdős-Gallai decompositions capture extremal situations, where the current (s, t)-path cannot be made longer in a "simple" way.The next lemma formalizes that intuition, stating that in polynomial time we can find either a long (s, t)-path or an Erdős-Gallai decomposition.The lemma is largely an analog of Lemma 4 in [24], however our statement here is slightly modified.Next, we recall the statement from Section 2 and provide a proof.
Lemma 7. Let G be a 2-connected graph such that δ(G − {s, t}) ≥ 16.There is a polynomial time algorithm that • either outputs an (s, t)-path P of length at least min{ 5  4 δ(G − {s, t}) − 3, |V (G)| − 1}, • or outputs an (s, t)-path P with paths P 1 , P 2 that induce an Erdős-Gallai decomposition for P in G. Additionally, there is no (s, t)-path in G that enters at least two Erdős-Gallai components of this Erdős-Gallai decomposition.
If we obtain an Erdős-Gallai decomposition, then we additionally need to check whether there exists an (s, t)-path that goes through at least two Erdős-Gallai components of the Erdős-Gallai decomposition induced by P 1 and P 2 in G.To this end, iterate over all ordered pairs of Erdős-Gallai components in the Erdős-Gallai decomposition.For each pair, apply Lemma 6 to each of the two Erdős-Gallai components and obtain two triples (K 1 , s 1 , t 1 ) and (K 2 , s 2 , t 2 ).There is an (s, t)-path entering both Erdős-Gallai components in the order given by the pair if and only if there exist three disjoint paths between the pairs (s, a 1 ), (b 1 , a 2 ), (b 2 , t), where (a i , b i ) is a permutation of (s i , t i ) for each i ∈ [2].
When the permutations are fixed, such paths, if they exist, can be found in polynomial time using the famous algorithm of Robertson and Seymour for k-Disjoint Paths [48].Since δ(K i − {s i , t i }) ≥ δ(G − {s, t}) − 2 for each i ∈ [2], these three paths together with two (s i , t i )-paths inside K i combine into an (s, t)-path of length at least 2δ(G − {s, t}) − 4 > 5  4 δ(G − {s, t}) − 3, so the algorithm outputs this path and stops.If the disjoint path triple was not found on any of the steps, then there is indeed no (s, t)-path entering at least two Erdős-Gallai components.
Finally, to deal with (s, t)-paths that do not enter any Erdős-Gallai component, one can observe the following.Intuitively, such a path should be far from optimal, as going through an Erdős-Gallai component would immediately give at least δ(G − {s, t}) − O(1) additional edges of the path.The final lemma of this subsection establishes how precisely the length of a path avoiding Erdős-Gallai components can be "boosted" in this fashion.To obtain this result, we first need a technical lemma from [24] that yields long paths inside separable components.
Lemma 8 (Lemma 6 in [24]).Let H be a connected graph with at least one cut-vertex.Let I be the set of inner vertices of all leaf-blocks of H. Let S ⊆ V (H) \ I separate at least one vertex in V (H) \ I from I in H.For any vertex v that is not an inner vertex of a leaf-block of H, there is a cut-vertex c of a leaf-block of H and a (c, v)-path of length at least 1 2 (δ(H) − |S|) in H.This path can be constructed in polynomial time.Now we move to (s, t)-paths that avoid Erdős-Gallai components.The following Lemma 9 has been already stated in Section 2, here we recall the statement and provide a proof.Lemma 9. Let P be an (s, t)-path of length at most δ(G − {s, t}) + k and let two paths P 1 , P 2 induce a Erdős-Gallai decomposition for P in G.There is a polynomial time algorithm that, given an (s, t)-path of length at least 4k + 5 in G that does not enter any Erdős-Gallai component, outputs a path of length at least min{δ(G − {s, t}) + k − 1, 3  2 δ(G − {s, t}) − 5 2 k − 1} in G. Proof.For clarity, we denote δ := δ(G − {s, t}).Let Q be the given (s, t)-path in G. Denote by S the set of the first k vertices on Q and by T the set of the last k vertices on Q.Let s ′ be the first vertex on Q that is not in S and t ′ be the last vertex on Q that is not in T .Since Q consists of more than 2k vertices, s ′ , t ′ / ∈ S ∪ T .The length of the (s, s ′ )-subpath of Q and the length of the (t ′ , t)-subpath of Q are equal to k.
The total length of P 1 and P 2 is at most k, hence Hence, this subpath contains at least one edge of G that is not incident to vertices in |V (P 1 ) ∪ V (P 2 )|.Denote the endpoints of this edge by u and v. Since Q does not enter any Erdős-Gallai component, this edge is an edge of a non-leaf-block of some separable connected component H of G − V (P 1 ∪ P 2 ).The component H corresponds to either (R2) or (R3) in the definition of Erdős-Gallai decomposition.Without loss of generality, we assume that H corresponds to (R2).
We now consider two cases depending on the structure of H − (S ∪ T ).If S ∪ T separates u or v from all cut vertices of the leaf-blocks in H, then we have a set of size 2k in H that satisfies the condition of Lemma 8. Take a vertex w in H that has a neighbour in V (P 2 ) in G.By Lemma 8, a (w, c)-path of length at least exists in H for some cut vertex c of some leaf-block L of H.In this leaf-block, we have a vertex z with a neighbour in V (P 1 ).By Corollary 2, we have a (c, z)-path of length at least δ(L − c) ≥ δ(G − {s, t}) − 2 inside L. Combine the two paths and obtain a (z, w)-path of length at least 3 2 δ(G − {s, t}) − 5 2 k − 3 inside H. Finally, prepend to this path a prefix of P 1 connecting s with the neighbour of z, and append to this path a suffix of P 2 connecting the neighbour of w with t.The length increases by at least two as s = z and w = t.The obtained path is an (s, t)-path of length at least 3  2 δ(G − {s, t}) − 5 2 k − 1.The second case is when from v we can reach a cut vertex c of some leaf-block L in H while avoiding vertices in S ∪ T .Note that V (Q) ∩ V (L − c) = ∅ by the properties of Erdős-Gallai decomposition.Then choose w as an arbitrary vertex in L − c with a neighbour in V (P 1 ).Now construct a (v, s)-path Q ′ in the following way.First, follow an arbitrary (v, c)-path in H − (S ∪ T ).Then continue with a (c, w)-path of length at least δ(L − c) ≥ δ(G − {s, t}) − 2 inside L − c that exists by Corollary 2. Note that this path has no common vertices with Q. Finish Q ′ by going from w to the neighbour of w in P 1 and follow P 1 backwards down to s.
Let x be the last vertex before c on Q ′ that belongs to V (Q).Let y be the first vertex after w on Q ′ that belongs to V (Q).Both x, y are defined correctly since v, s ∈ V (Q).Consider the (x, y)subpath of Q ′ .It strictly contains the (c, w)-path inside L, so its length is at least δ(G − {s, t}) − 1.Also, the length of the (s, x)-subpath of Q and the length of the (x, t)-subpath of Q is at least k as x / ∈ S ∪ T .We now construct a long (s, t)-path in G.If y is contained in the (s, x)-subpath of Q, then the (s, t)-path is constructed in the following way: follow P 1 from s to y, then follow Q ′ backwards from y down to x, and finish by following Q from x to t.The length of this path is at least δ(G − {s, t}) − 1 + k.If y belongs to the (x, t)-subpath of Q, start by taking the (s, x)-subpath of Q, then follow Q ′ from x to y and finish by following P 2 from y to t.This path also has length at least k + δ(G − {s, t}) − 1.The proof is complete.

Proof of Theorem 2
To deal with the recursive structure of the solution, we introduce the following nested generalization of an Erdős-Gallai decomposition.Intuitively, it captures how the structural observations of the previous subsection allow us to recursively construct Erdős-Gallai decompositions with the aim of finding a long (s, t)-path.For an illustration of a nested Erdős-Gallai decomposition, see Figure 1.We recall the formal definition from Section 2.
Definition 2 (Nested Erdős-Gallai decomposition).A sequence of triples (G 1 , s 1 , t 1 ), (G 2 , s 2 , t 2 ), . . ., (G ℓ , s ℓ , t ℓ ) is called a nested Erdős-Gallai decomposition for G and two vertices s, t ∈ V (G) if -Lemma 7 applied to G i , s i , t i gives a path P i and two paths P i,1 , P i,2 that induce an Erdős-Gallai decomposition for P i in G i , and for each Erdős-Gallai component M of this decomposition there is j > i such that (G j , s j , t j ) is the result of Lemma 6 applied to M in G i .In this case, we say that G i is decomposed.
• for each i ∈ {2, . . ., ℓ}, there is e(i) < i such that (G i , s i , t i ) is a result of Lemma 6 applied to some Erdős-Gallai component of the Erdős-Gallai decomposition of G e(i) for P e(i) .
The proof of Theorem 2 is performed in two steps: first, we show how to obtain a nested Erdős-Gallai decomposition for a given graph G, and then we use the nested Erdős-Gallai decomposition to recursively construct a good approximation to the longest (s, t)-path.The first part is achieved simply by applying Lemma 7 recursively on each Erdős-Gallai component until components are no longer decomposable.The main hurdle is the second part, on which we focus for the rest of the section.For completeness, first we show that a nested Erdős-Gallai decomposition can always be constructed in polynomial time.
Lemma 10.There is a polynomial time algorithm that, given a 2-connected graph G and its two vertices s and t, outputs a nested Erdős-Gallai decomposition for G, s, t.
Proof.The algorithm proceeds recursively, starting with the triple (G 1 , s 1 , t 1 ) = (G, s, t).For the given triple (G i , s i , t i ), if δ(G i − {s i , t i }) < 16, the algorithm stops.Otherwise, invoke the algorithm of Lemma 7 on (G i , s i , t i ).If this returns a path P i of length at least 5  4 δ(G i − {s i , t i }) − 3, the algorithm stops.On the other hand, if an Erdős-Gallai decomposition is returned, for each Erdős-Gallai component M run the algorithm of Lemma Lemma 6 on M to obtain a triple (G j , s j , t j ), where j is the lowest free index among the triples produced so far.Run the main algorithm recursively on each of the triples generated on this step.
By definition, the algorithm above produces a nested Erdős-Gallai decomposition.To show that the running time is polynomial, first observe that running the algorithm without the subsequent recursive calls is clearly polynomial.Assume this running time is bounded by αn c for some constant α > 0 and c ≥ 1, where n = |V (G) \ {s, t}| and (G, s, t) is the current instance.We show by induction on the depth of the resulting nested Erdős-Gallai decomposition that the running time of the recursive algorithm is at most αn c+1 .If the instance does not spawn any recursive calls, this trivially holds.Otherwise, assume ℓ new instances (G j 1 , s j 1 , t j 1 ), . . ., (G j ℓ , s j ℓ , t j ℓ ) are produced, denote n i = |V (G j i \ {s j i , t j i }|.Note that ℓ ≥ 2 since there are always at least 2 components in an Erdős-Gallai decomposition.By induction, the running time is bounded by α We now bound ℓ i=1 n c+1 i , observe first that ℓ i=1 n i ≤ n, as all the sets V (G j i \ {s j i , t j i } are disjoint and do not contain s or t.We use the following numerical observation proven in [24]. Claim 1 (Proposition 3 in [24]).Let a 1 , a 2 , . . ., a q be a sequence of q ≥ 2 positive integers with q i=1 a i = n.Let x > 1 be an integer.Then q i=1 a x i ≤ (n − 1) x + 1 ≤ n x − n x−1 .By Claim 1, we can bound the running time by Clearly, it follows that the size of a nested Erdős-Gallai decomposition returned by Lemma 10 is also polynomial.Observe also that the construction algorithm invokes Lemma 7 for all sufficiently large G i , thus in what follows we assume that the corresponding paths P i are already computed.Now we focus on using a constructed nested Erdős-Gallai decomposition for approximating the longest (s, t)-path.First of all, we present the algorithm long nested st path that, given a nested Erdős-Gallai decomposition of G, computes a long (s, t)-path by going over the decomposition.
The pseudocode of long nested st path is present in Algorithm 3. Intuitively, first the algorithm computes a compression H of the graph G that respects the nested Erdős-Gallai decomposition: components that are not decomposed are replaced by single edges, and edges that are "unavoidable" to visit a component are contracted.The computation of this compression is encapsulated in the nested compress function presented in Algorithm 1.As a subroutine, this function uses the two long disjoint paths algorithm given by Corollary 1, that finds two disjoint paths of at least the given length between the given pairs of vertices.
Next, the blackbox approximation algorithm long st path approx is used to compute an (s, t)path Q in H.The function nested decompress reconstructs then this path in the original graph G, see Algorithm 2 for the pseudocode.Later we argue (Lemma 11) that any (s, t)-path in H of length r yields in this way an (s, t)-path in G of length at least δ(G − {s, t}) + r/8 − 3. Finally, either the length of Q in H was large enough and the reconstructed path provides the desired approximation or a long path can be found inside one of the components in a "simple" way, and then connected arbitrarily to {s, t}.Specifically, in this component, it suffices to either take an approximation of the longest path computed by long st path approx, or a long Erdős-Gallai path returned by the algorithm from Corollary 2, long eg st path.Thus, in the final few lines long nested st path checks whether any of these paths is longer than the reconstructed path Q.The path from inside the component is extended to an {s, t}-path in G by using the algorithm two long disjoint paths, given by Corollary 1, with the parameter 0.
Input: a nested Erdős-Gallai decomposition for G, s and t.
Output: the compressed graph H. Now, our goal is to show that the path that the long nested st path algorithm constructs serves indeed as the desired approximation of the longest (s, t)-path in G.For the rest of this section, let G 1 , . . ., G ℓ be the given nested Erdős-Gallai decomposition for G, s, t.An important piece of intuition about nested Erdős-Gallai decomposition is that, as we go deeper into the nested Erdős-Gallai components, the minimum degree of the component δ(G i \ {s i , t i }) decreases, but we gain more and more edges that we collect while going from {s, t} to {s i , t i }.We introduce values that help us measure this difference between the nested components: for each i ∈ [ℓ], denote d i = |{s e(i) , t e(i) } \ {s i , t i }|.In particular, by Lemma 6 we know that for any i ∈ [ℓ], nested decompress((G 1 , s 1 , t 1 ), (G 2 , s 2 , t 2 ), . . ., (G ℓ , s ℓ , t ℓ ), H, Q) Input: a nested Erdős-Gallai decomposition for G, s and t, the compressed graph H and an (s, t)-path Q in H of length r.Output: an (s, t)-path of length at least δ(G − {s, t}) + r/8 − 3 in G.   δ(G i ) ≥ δ(G e(i) ) − d i .On the other hand, any pair of disjoint paths that connects {s e(i) , t e(i) } to {s i , t i } contains at least d i edges.This leads to the following simple observation about extending an (s j , t j )-path in a component G j to an (s, t)-path in G.
Claim 2. For each j ∈ [ℓ], let G j 1 , . . ., G jc be such that j c = j and j 1 = 1 and e(j i+1 ) = j i for each i ∈ [c − 1].Let P be an (s j , t j )-path in G j .Then P combined with any pair of disjoint paths connecting {s, t} to {s j , t j } yields an (s, t)-path in G of length at least However, there might also exist longer paths connecting nested components G e(i) and G i .When we construct the compressed graph H in Algorithm 1, we distinguish between two cases.Either any pair of such paths have the total length d i , meaning that the only option is to use the edges of a matching between {s e(i) , t e(i) } and {s i , t i }.In that case we simply contract these edges as we know that there is no choice on how to reach G i from G e(i) .Or, there is a pair of disjoint paths of total length at least d i + 1.This situation is beneficial to us in a different way: since we can find such a pair of paths in polynomial time, we can traverse at least d i + 1 edges going from G e(i) to G i , while we only lose at most d i in the minimum degree.This dichotomy on the structure of long nested st path((G 1 , s 1 , t 1 ), (G 2 , s 2 , t 2 ), . . ., (G ℓ , s ℓ , t ℓ )) Input: a nested Erdős-Gallai decomposition for G, s and t.
Output: an (s, t)-path of length at least δ(G − {s, t}) The algorithm finding a long (s, t)-path in a 2-connected graph with a given nested Erdős-Gallai decomposition.
the "slice" between two nested components is the main leverage that allows us to lift the length of an (s, t)-path in H to an offset above the minimum degree in G.We formally show this crucial property of the compressed graph H and the nested decompress routine in the next lemma.
Lemma 11.The nested decompress routine transforms an (s, t)-path Q in H of length r into an (s, t)-path in G of length at least δ(G − {s, t}) + r/8 − 3.
Proof.Observe that in the tree of the nested Erdős-Gallai decomposition, the path Q visits a rooted subpath of components G i .That is, there are indices j 1 , j 2 , . . ., j c ∈ [ℓ] such that j 1 = 1 and e(j i+1 ) = j i for each i ∈ [c − 1].This holds since in a Erdős-Gallai decomposition on each level, Q visits at most one Erdős-Gallai component by Lemma 7.Here we say that Q visits a component G i if Q contains an edge of G i that was not contracted in H, and for non-decomposed components G i this means that Q contains the edge s i t i in H.
By Lemma 6, δ(G j i+1 ) ≥ δ(G j i ) − d j i+1 .Let h ∈ [ℓ] be the largest integer such that Q enters G h , h = j c .Denote by p be the number of edges in E(Q) \ E(G h ) and by y the length of the (s h , t h )-subpath of Q, then p + q = r.
We now analyze the length of Q after performing the replacement operations in Lines 2.1-2.9.Denote by Y the set of all i ∈ [c−1] such that no contraction was made in Line 1.6 between {s j i , t j i } and {s j i+1 , t j i+1 }.For each i ∈ Y with d j i+1 > 0, performing the replacement operation in Line 2.7 between {s j i , t j i } and {s j i+1 , t Let p ′ be the length of Q outside of G h after all these replacements, from the above p ′ ≥ 3 2 i∈Y d j i+1 .Also, p ′ ≥ p since the replacement only takes place if it makes the path longer.
Denote by X := [c − 1] \ Y the set of all i ∈ [c − 1] such that a contraction was made in Line 1.6 between {s j i , t j i } and {s j i+1 , t j i+1 }.For each i ∈ X the algorithm reverses the respective edge contractions done in Line 1.6 in Q.This increases the length of Q by d j i+1 , so after Line 2.9 it holds that We now observe that any long (s h , t h )-subpath in G h can be combined with Q to preserve at least a constant fraction of p in the offset.Claim 3.After Line 2.9, replacing the (s h , t h )-subpath of Q with a path P in G h of length δ(G h − {s h , t h }) + k ′ , where k ′ is a nonnegative integer, yields an (s, t)-path in G of length at least δ(G − {s, t}) + k ′ + p/3.
Proof of Claim 3. The length of the resulting path is at least Note that the last inequality holds since p ′ is at least 3 2 i∈Y d j i+1 and also at least p.The path obtained at this point is an (s, t)-path in G with possibly some contracted edges, since not all edge contractions were reversed.Reverse all remaining edge contractions affecting Q and obtain an (s, t)-path in G of at least the same length.
For estimating the length of the (s h , t h )-subpath, consider two cases depending on the type of G h .G h is not decomposed.In this case, Q contains the edge s h t h in H, and in Line 2.12 this edge is replaced with the path P h .By Claim 3, this yields a path of length at least δ(G−{s, t})+(r−1)/3, since the length of P h is at least δ(G h − {s h , t h }), and p = r − 1.
G h is decomposed.By the choice of j, the (s h , t h )-subpath of Q does not enter any Erdős-Gallai component in the Erdős-Gallai decomposition induced by P j,1 and P j,2 in G h .
By Claim 3, an (s h , t h )-path of length δ(G h − {s h , t h }) + k ′ inside G h combined with the outer part of Q obtains an (s, t)-path of length at least δ(G − {s, t}) + p/3 + k ′ inside G.We now focus on identifying a long enough (s h , t h )-path inside G h .
It will also be helpful to observe that in the "slice" between a decomposed component and the nested components, at most two edges of any path can be contracted.Note that this does not follow immediately, as a pair of edges to each of the nested components is potentially contracted.Claim 4. Let Q be an (s j , t j )-path inside a decomposed graph G j .Then all edges E(Q) ∩ E(G j ) \ e(i)=j E(G i ) are unchanged in H except for, possibly, contraction of the first and the last edge of Q.
Proof of Claim 4. Let i be such that a contraction is made for G i in Line 1.6 with e(i) = j and d i > 0. There are no two disjoint paths between {s j , t j } and {s i , t i } of total length at least d i + 1.
Without loss of generality, we assume that s i = s j , t i = s j and s i = t j and the edge s Suppose now that s i is not the second vertex in Q.Then the (s j , s i )-subpath of Q is of length at least two.If t i does not belong to this subpath, we add the trivial (of length zero or one) (t i , t j )-path in G j and obtain two disjoint paths between {s j , t j } and {s i , t i } of total length at least 2 + |{t i , t j }| − 1 > d i , which is a contradiction.
Hence, t i is present on the (s j , s i )-subpath of Q.Then t i = t j , so d i = 2 and s i , t i , s j , t j are all distinct.We have an (s j , t i )-subpath of Q and an (s i , t j )-subpath of Q which are disjoint.If one of them is of length at least two, then we have two disjoint paths of total length more than d i .Hence, s j t i and s i t j are the first and the last edge in Q.The proof of the claim is complete.Now we are ready to prove the main lemma that bounds the length of the (s, t)-path returned by Algorithm 3.
Lemma 12. long nested st path outputs an (s, t)-path in G of length at least δ(G − {s, t}) + f (k)/32 − 3, where k = L − δ(G − {s, t}) and L is the length of the longest (s, t)-path in G.
Proof.Let T be the longest (s, t)-path in G, |E(T )| = L = δ(G−{s, t})+k.Our aim is to show that either T yields a sufficiently long path in H to use Lemma 11, or conclude that after contractions most of the path stays inside one Erdős-Gallai component, the deepest component visited.In case of the latter, we show that it suffices to take a long path inside this component.
We now introduce some notations for T with respect to the nested Erdős-Gallai decomposition structure, similarly to the proof of Lemma 11.Let h ∈ [ℓ] be the largest integer such that T enters G h .Let j 1 , j 2 , . . ., j c be such that j c = j, j 1 = 1 and e(j i+1 ) = j i for each i ∈ [c − 1].Denote by Y the set of all i ∈ [c − 1] such that no contraction was made in Line 1.6 between {s j i , t j i } and Consider what happens to the path T in the graph H between two consecutive nested components G j i and G j i+1 .Since T is the longest (s, t)-path in G, edges in E(T ) ∩ E(G j i ) \ E(G j i+1 ) form two disjoint paths between {s j i , t j i } and {s j i+1 , t j i+1 } of longest possible total length.If . By Claim 4, all edges in E(T )∩E(G j i )\E(G j i+1 ) are present in H, except for possibly d j i+1 of them (the first and/or the last).Also, recall that by properties of nested Erdős-Gallai decomposition, T does not enter any G i with e(i) = j i except for G j i+1 .Then the removal of the internal vertices of non-decomposed components does not affect edges in Let T ′ be the path T with all contractions applied to H.If G h is not decomposed, we assume that T ′ contains the edge s h t h marked with G h .By the above, we have The last inequality holds since for each i ∈ Y with , and for all the remaining indices i, , and from the above obtain the equivalent If p ≥ k/4, then an (s, t)-path of length at least k/4 + 1 is present in H.In this case, an approximation of the longest (s, t)-path in H in Line 3.2 of long nested st path gives a path of length at least f (k/4 + 1) ≥ f (k)/4.By Lemma 11, running nested decompress on this path results in an (s, t)-path of length at least δ(G − {s, t}) + f (k)/32 − 3 in G, so in this case the proof is finished.
G h is decomposed.In this case, T h does not enter any Erdős-Gallai component of G h .By Claim 4, at most two edges of T h can be contracted in H, denote the number of such edges by d ′ h .Also, at least one edge is not contracted, so then long nested st path outputs an (s, t)-path of length at least δ + k/4 − 3 by Claim 2, regardless of the length of P h at Line 3.5.
Otherwise, T ′ is an (s, t)-path in H of length at least 1 3 (3k/4 + 3) = k/4 + 1. Analogously to the case p ≥ k/4, long nested st path then finds a path of length at least f (k)/4, and the path Q returned by nested decompress is of length at least δ(G − {s, t}) + f (k)/32 − 3.
G h is not decomposed.Here, our goal is to show that taking in G h one of the (s h , t h )-paths computed on Line 3.5 together with an arbitrary connection from {s, t} to {s h , t h } gives a long enough (s, t)-path in G. Let k h := |E(T h )| − δ h .Note that by the choice of T , T h is the longest (s h , t h )-path in G h .We first show the following.
Claim 5.If G h is not decomposed, then at Line 3.6 the length of P h is at least δ h + f (k h )/8 − 3.

Proof of Claim 5.
First note that if the length of P h from definition of nested Erdős-Gallai decomposition is at least |V (G h )| − 1, then P h is a hamiltonian (s h , t h )-path in G h .Then its length is maximum possible and is equal to Hence, we can assume that the length of P h given by nested Erdős-Gallai decomposition is at least 5  4 7 δ h , then long st path approx(G h , s h , t h ), the blackbox (s, t)-path approximation algorithm, returns a path of length at least f (δ h + k h ) ≥ f (k h ) ≥ δ h + f (k h )/8, so we are done.
Otherwise, f (k h ) ≤ 8 7 δ h .If f (k h ) ≤ 24, then it suffices for P h to have length δ h .In this case long eg st path(G h , s h , t h ), the exact (s, t)-path algorithm from Corollary 2, returns a (s h , t h )path of length at least δ h .
It only remains to deal with the case where f (k h ) > 24, and δ h ≥ 7 8 f (k h ).Since G h is not decomposed and δ h > 16, by definition of nested Erdős-Gallai decomposition, P h is of length at least 5 4 Using (1), we can lower-bound k h by On Line 3.6, P h is transformed into an (s, t)-path in G of length at least |E(P h )| + i∈X∪Y d j i+1 , by Claim 2. By Claim 5, this length is at least Here for the first inequality we use (2), then the properties of the function f , and the fact that we are in the case where k > 4p.Observe that for each x ∈ Z + , f (x) ≤ x, since we are given an algorithm that finds an (s, t)-path of length f (x) in any graph with the longest (s, t)-path of length x.With this, we have shown that in each case the returned (s, t)-path is of desired length, and the proof is complete.
Finally, observe that the running time of Algorithm 3 is polynomial in the size of the given nested Erdős-Gallai decomposition.By Lemma 10, its size is polynomial in the size of the input graph G.This concludes the proof of Theorem 2.

Approximation for cycles
This section is devoted to the proof of Theorem 1 that establishes a way of lifting the approximation guarantee of the longest cycle in a 2-connected graph G to the offset above 2δ(G).
Theorem 1.Let f : R + → R + be a non-decreasing subadditive function and suppose that we are given a polynomial-time algorithm finding a cycle of length at least f (L) in graphs with the longest cycle length L. Then there exists a polynomial time algorithm that finds a cycle of length at least 2δ(G) + Ω(f (L − 2δ(G))) in a 2-connected graph G with δ(G) ≤ 1  2 |V (G)| and the longest cycle length L.
We first recall the concept of a Dirac decomposition and its properties that were established by Fomin et al. [24].Further in this section, we prove the novel crucial property that in a graph admitting a Dirac decomposition, there exists a separating pair of vertices with a long path between this pair.Finally, we combine these results together with our approximation for (s, t)-path from the previous section (Theorem 2) to obtain the lifting algorithm in Theorem 1.

Dirac decomposition
This subsection contains the definition and properties of a Dirac decomposition, including the algorithmic result that allows to construct a Dirac decomposition from a given 2-connected graph G.We start with the definition of a Dirac decomposition, which can be seen as an analogue of an Erdős-Gallai decomposition for cycles.Definition 3 (Dirac decomposition and Dirac component, Definition 5 in [24]).Let G be a 2connected graph and let C be a cycle in G of length at least 2δ(G).We say that two disjoint paths P 1 and P 2 in G induce a Dirac decomposition for C in G if • The cycle C is of the form C = P 1 P ′ P 2 P ′′ , where each of the paths P ′ and P ′′ has at least δ(G) − 2 edges.
• For every connected component H of G − V (P 1 ∪ P 2 ) holds |V (H)| ≥ 3 and one of the following.
(D1) H is 2-connected, the maximum size of a matching in G ′ between V (H) and V (P 1 ) is one, and between V (H) and V (P 2 ) is also one; (D2) H is not 2-connected, exactly one vertex of P 1 has neighbors in H, that is, |N G (V (H)) ∩ V (P 1 )| = 1, and no inner vertex from a leaf-block of H has a neighbor in P 2 ; (D3) The same as (D2), but with P 1 and P 2 interchanged.That is, H is not 2-connected, |N G (V (H)) ∩ V (P 2 )| = 1, and no inner vertex from a leaf-block of H has a neighbor in P 1 .
• There is exactly one connected component where s ′ and t ′ are the endpoints of P ′ .Analogously, there is exactly one connected component The set of Dirac components for a Dirac decomposition is defined as follows.First, for each component H of type (D1), H is a Dirac component of the Dirac decomposition.Second, for each leaf-block of each H of type (D2), or of type (D3), this leaf-block is also a Dirac component of the Dirac decomposition.
First, we recall an important property of a Dirac decomposition that restricts how a cycle can pass through a Dirac component.
Lemma 13 (Lemma 17 in [24]).Let G be a 2-connected graph and C be a cycle in G. Let paths P 1 , P 2 induce a Dirac decomposition for C in G. Let M be a Dirac component of the Dirac decomposition and P be a path in G such that P contains at least one vertex in V (P 1 ) ∪ V (P 2 ).If P enters M , then all vertices of M hit by P appear consecutively on P .
We now restate the result of [24] on the construction of a Dirac decomposition for a given graph.Note that here we state it in a slightly different form, which is more convenient in the setting of this paper.The statement is given below and the main difference is highlighted in bold.
Lemma 14 (Lemma 20 in [24]).Let G be an n-vertex 2-connected graph and k be an integer such that δ(G) ≥ 12, 0 < k ≤ 1  24 δ(G), and Then there is an algorithm that, given a non-hamiltonian cycle C of length less than 2δ(G) + k in polynomial time finds either • Longer cycle in G, or • Vertex cover of G of size at most δ(G) + 2k, or • Two paths P 1 , P 2 that induce a Dirac decomposition for C in G.
To clarify this form, note that in the original statement of Lemma 20 in [24], the upper bound for δ(G−B) is n 2 − |B|+k 2 , where B is a given set of small-degree vertices.In the proof of Lemma 20 in [24], one can easily note that the only reason for this bound is the existence of at least one vertex in V (G) \ V (C) \ B. Since in our work B is always empty, this is equivalent to V (G) = V (C), i.e. nonhamiltonicity of C. Hence, the replacement of this bound with the condition on non-hamiltonicity of C is legitimate.
We finish this subsection with another important property of Dirac decomposition stating that there is a long cycle that enters at least one Dirac component.Unfortunately, this property, Lemma 19 in [24], is stated in a way requiring the offset above 2δ(G) for this long cycle to be much smaller than δ(G).Here we provide this property in the form that does not require this and is much more convenient in our setting.Since it differs significantly from the original statement, we provide a proof of this result that is based on the proof of Lemma 19 from [24].
Lemma 15 (Modified Lemma 19 from [24]).Let G be a graph and P 1 , P 2 induce a Dirac decomposition for a cycle C of length at most 2δ(G − B) + κ in G such that 2κ ≤ δ(G).If there exists a cycle of length at least 2δ(G) + k in G that contains at least one vertex in V (P 1 ) ∪ V (P 2 ), then there exists a cycle of length at least 2δ(G) + k/2 − 1 in G that enters a Dirac component.
Proof.Suppose that there exists a cycle C ′ of length at least 2δ(G) + k in G that contains at least one vertex in V (P 1 ) ∪ V (P 2 ).If C ′ already contains an edge of a Dirac component, we are done.We now assume that C ′ does not contain any edge of any Dirac component.We show how to use C ′ to construct a cycle of length at least 2δ(G) + k/2 − 1 in G that contains an edge of a Dirac component of the given Dirac decomposition.
Let W be the set of all vertices of G that are vertices of non-leaf-blocks of (D2)-type or (D3)-type components in the Dirac decomposition.We start with the following claim.
Proof of Claim 6.This is a counting argument.Note that C ′ cannot contain an edge with both endpoints inside a Dirac component of G. Since Dirac components of G are (D1)-type components of the Dirac decomposition and leaf-blocks of (D2)-type or (D3)-type connected components, each edge of C ′ has an endpoint either in V (P 1 ) ∪ V (P 2 ), or inside a non-leaf-block of a (D2)-type or a (D3)-type connected component.The union of the vertex sets of the non-leaf-blocks forms the set Note that a vertex cover of any cycle consists of at least half of its vertices.Then By definition of a Dirac decomposition, We now take a vertex w 1 ∈ W ∩ V (C ′ ).The following claim allows constructing a long chord of C ′ starting in w 1 .
Claim 7. Let H be a (D2)-type or a (D3)-type component in the Dirac decomposition.C ′ does not contain any inner vertex of the leaf-blocks of H.
Proof of Claim 7. Suppose that C ′ contains some vertex u ∈ V (H ′ ) that is an inner vertex of some leaf-block L of H.As L is a Dirac component of G, C ′ cannot contain any edge of L, so C ′ should enter L from V (P 1 ) ∪ V (P 2 ) through u and leave it immediately.By definition of Dirac decompositions, the only option to enter or leave L is to go through the only vertex in V (P 1 ) (if H is of type (D2)) or in V (P 2 ) (if H is of type (D3)).As C ′ cannot contain any vertex twice, this is not possible.Now construct the chord of C ′ starting in w 1 .Since w 1 is a vertex of a separable component H, there is a cut vertex c 1 of a leaf-block L 1 of H reachable from w 1 inside H.The leaf-block L 1 contains also at least one vertex since the only outside neighbour of vertices in L 1 − c 1 is a single vertex in V (P 1 ) or V (P 2 ).By Corollary 2, there exists an (c 1 , v 1 )-path inside L 1 of length at least δ(G) − 2. Combine this with a (w 1 , c 1 )-path inside H and obtain a (w 1 , v 1 )-path inside H.
Note that the constructed (w 1 , v 1 )-path can contain vertices from V (C ′ ) apart from w 1 .Let w ′ 1 ∈ V (C ′ ) be the vertex from V (C ′ ) on the (w 1 , v 1 )-path farthest from w 1 .Note that the (w ′ 1 , v 1 )-subpath still contains the (c 1 , v 1 )-path as a subpath by Claim 7. Hence, we obtain a -arcs, and one of the arcs has length at least δ(G) + k/2.Combine this arc with the chord and obtain a cycle of length at least 2δ(G) + k/2 − 1 in G.This cycle contains an edge of a leaf-block of H, i.e. of a Dirac component.The proof is complete.

Existence of a separating pair
This subsection encapsulates the new combinatorial result behind Dirac decomposition that is crucial to our proof of Theorem 1.It helps us avoid using the Dirac decomposition explicitly in our algorithm, so that we can instead reduce to the algorithm for approximating (s, t)-paths.The formal statement is recalled next.Proof.Consider the longest cycle C ′ in G.We assume that this cycle is of length at least 2δ(G) + k and consider four cases.
Case 1. C ′ is completely contained in some connected component H of G − V (P 1 ∪ P 2 ), and H is 2-connected.Then H is a Dirac component of type (D1).Since the matching size between V (H) and V (P i ) for each i ∈ {1, 2} is exactly one, by Kőnig's theorem all edges between V (H) and V (P i ) are covered by a single vertex.Denote this vertex by u for i = 1 and by v for i = 2. Since G is 2-connected, u and v are distinct.As {u, v} separates H from the rest of the graph and V (C) ⊂ V (H ∪ P 1 ∪ P 2 ), we have that G − {u, v} is not connected.It is left to show that there exists a long (u, v)-path in G. Toward this, denote u ′ = u if u ∈ V (H), and u ′ ∈ N G (u) ∩ V (H) if u ∈ V (P 1 ).Choose v ′ ∈ V (H) similarly, i.e. v ′ either equals v or is a neighbour of v. Since G is 2-connected, there is always a way to choose distinct u ′ and v ′ .By Lemma 2, there is a (u ′ , v ′ )-path of length at least δ(G) + k/2 in H, hence there is also a (u, v)-path of length at least δ(G) + k/2 in G.
Case 2. C ′ is completely contained in a leaf-block of a connected component H of G−V (P 1 ∪P 2 ).That is, C ′ is contained in a Dirac component of type (D2) or (D3).The choice of u and v is similar to Case 1.That is, if the Dirac component is of type (D2), choose u such that u ∈ N G (V (H))∩V (P 1 ) and choose v equal to the cut vertex of the Dirac component.G − {u, v} is not connected as {u, v} separates the Dirac component from the rest of H.There is an (u, v)-path of length at least δ(G) + k/2 + 1 since there exists a (z, v)-path of length at least δ(G) + k/2 by Lemma 2, where z ∈ N G (u) ∩ V (H − v).The choice of u and v for type (D3) is symmetrical.
Case 3. C ′ is completely contained in a non-leaf-block of a connected component H of G − V (P 1 ∪ P 2 ).In this case, C ′ is not contained in a Dirac component.Denote the non-leaf-block of H that contains C ′ by K. Without loss of generality, we assume that H corresponds to (D2), i.e. |N G (V (H)) ∩ V (P 1 )| = 1.By Menger's theorem, there are either two vertices separating V (K) from V (P 1 ∪ P 2 ) in G or three disjoint paths going from V (K) to V (P 1 ∪ P 2 ).If the former is the case, denote these two vertices by u and v. Obviously, G − {u, v} is not connected.There are two disjoint paths going from V (K) to V (P 1 ∪ P 2 ), and one of these paths contains u and the other contains v. Connect the endpoints of these paths in V (K) using a path of length at least δ(G)+ k/2 inside V (K) given by Lemma 2. Clearly, the obtained long path contains an (u, v)-path of length at least δ(G) + k/2 as a subpath.
If the latter is the case, then two of the three paths necessarily end in V (P 2 ).Let these two paths start respectively from u 1 and u 2 in V (K) and end in v 1 and v 2 in V (P 2 ).Note that these paths use only edges of H and edges between V (H) and V (P 2 ) in G.Moreover, none of the paths has an internal vertex in V (K) or V (P 2 ).By Lemma 2, there is an (u 1 , u 2 )-path of length at least δ(G) + k/2 in K. Now construct a cycle in G by combining the (u 1 , u 2 )-path with the (u 1 , v 1 )-path, (u 2 , v 2 )-path, and the subpath of C that goes between v 1 and v 2 outside of P 2 .Since that subpath contains P ′ and P ′′ from the definition of Dirac decomposition as subpaths, the obtained cycle is of length at least (δ(G) + k/2) + 1 + 1 + 2 • (δ(G) − 2) ≥ 3δ(G) + k/2 − 2 ≥ 2δ(G) + k/2.This cycle contains an edge of P ′ , so it enters a Dirac component, so we can replace C ′ with this cycle and apply the following case.
Case 4. C ′ has a common vertex with V (P 1 ∪ P 2 ).By Lemma 15, we can assume that C ′ enters a Dirac component K but its length is at least 2δ(G) + k/2 − 1.Following Case 1 and Case 2, we know that there are u, v ∈ V (K ∪ P 1 ∪ P 2 ) such that in G − {u, v} vertices in V (K) are separated from the rest of the graph.By Lemma 13, vertices in V (K) appear consecutively on C ′ , so vertices and edges of C ′ induce a path inside K. Since C ′ is not contained in V (K), at least one of u and v is present in C ′ , so we have two cases depending on |V (C ′ ) ∩ {u, v}|.If u, v ∈ V (C ′ ), then the longest arc of C ′ going between u and v simply yields a path of length at least (2δ(G) + k/2 − 1)/2 = δ(G) + (k − 2)/4.If exactly one of u and v is present on C ′ , without loss of generality we assume u ∈ V (C ′ ).Then V (C ′ ) ⊆ V (K) ∪ {u}, as C ′ does not pass through v -the only other entry to K. Similarly to Case 1 and Case 2, we have a vertex v ′ ∈ V (K), which is either equal to v or is a neighbour of v. Take a shortest path from v ′ to V (C ′ ) inside K. Denote its endpoint by w.Prolong the path starting in v ′ with the longest arc of C ′ that goes between w and u.This yields a (v ′ , u)-path, hence a (v, u)-path, of length at least δ(G) + (k − 2)/4 in G.We move on to the most involved case where the two paths P 1 , P 2 inducing a Dirac decomposition are found.Our goal now is to use Lemma 1 to find a separating pair of vertices that has a long path between them, and then use the already established algorithm from Theorem 2 to approximate the length of this path.
Hence, before moving further, we need to obtain an approximation algorithm for finding a long (s, t)-path.For this, we apply Lemma 3 to the blackbox f (L)-approximation algorithm for the longest cycle and obtain an algorithm that finds an (s, t)-path of length at least 1  2 f (2p) in a graph with the longest (s, t)-path lenght p. Finally, we apply Theorem 2 to the latter algorithm and obtain an algorithm finding an (s, t)-path of length δ + ( 1 64 f (2k ′ ) − 3) where k ′ = p − δ for the longest (s, t)-path length p.
Since 2(|V (C)| − 2δ) < δ, we can apply Lemma 1 to G and C. We obtain that there exists a pair of vertices u, v ∈ V (G) such that G − {u, v} is not connected and there is a path of length at least δ + (L − 2δ − 2)/4 between u and v in G. Towards encountering this pair of vertices, our algorithm iterates over all possible u, v ∈ V (G) such that G − {u, v} is not connected.Assume that the pair {u, v} is fixed.Then for each connected component H of G − {u, v}, our algorithm applies the (s, t)-path approximation algorithm to G[V (H) ∪ {u, v}] + uv to find a long (u, v)-path.Note that this is a legitimate application of the algorithm since G[V (H) ∪ {u, v}] + uv is 2-connected.Now, each application of the algorithm yields some (u, v)-path.There are at least two connected components in G − {u, v}, so at least two (u, v)-paths are produced, and our algorithm simply combines the longest two paths among them in a cycle.The length of each path is at least δ − 2.Moreover, if {u, v} is the pair given by Lemma  In any case, the length of Q is at least Hence, if our algorithm combines the longest two paths given by the pair {u, v}, it obtains a cycle of length at least 2δ + 1 128 f (k) − 8 = 2δ + h(k).Since the algorithm outputs the longest cycle among those constructed, the proof is complete.
Finally, we show the corollary of Theorem 1 that allows to approximate the longest path in a graph that is not necessarily 2-connected.Corollary 3. Let f : R + → R be a non-decreasing subadditive function.If there exists a polynomialtime algorithm finding a cycle of length f (L) in a 2-connected graph with the longest cycle length L, there is a polynomial time algorithm that outputs a path of length at least 2δ(G)+f (L−2δ(G))/128− 8 in a graph G with δ(G) < 1  2 |V (G)| and the longest path length L.

1 2 f
(2L) as required by the lemma.

Lemma 1 .
Let G be a 2-connected graph and P 1 , P 2 induce a Dirac decomposition for a cycle C of length at most 2δ(G) + κ in G such that 2κ ≤ δ(G).If there exists a cycle of length at least 2δ(G) + k in G, then there exist u, v ∈ V (G) such that • G − {u, v} is not connected, and• there is an (u, v)-path of length at least δ(G) + (k − 2)/4 in G.

3 C 5 return
longest cycle above degree approx(G) Input: 2-connected graph G of minimum degree δ Output: a cycle C of length at least 2δ + h(k), where k = L − 2δ and L is the length of the longest cycle in G 4.1 C ←− longest cycle approx(G); 4.2 if long dirac cycle(G, ∅, 1)is Yes then 4.←− the longest of C and the computed cycle of length at least 2δ + 1 in G; 4.4 else 4.the cycle of length 2δ in G;

end 4 . 22 C 4 : 4 ,
←− the longest of C, Q ∪ R; 4.23 end 4.24 return C; Algorithm The algorithm finding a cycle of length at least 2δ(G) + h(k) in a 2connected graph G.The first outcome is the desired h(k)-approximation of the offset since |V (C)| ≥ 2δ+ 1 49 f (L)−1 ≥ 2δ + h(k) in this case.In the second outcome, since a vertex cover upper-bounds the length of anycycle, L ≤ 2 • (2 • |V (C)| − 3δ + 2), hence |V (C)| − 2δ ≥ L−4−2δ so |V (C)| ≥ 2δ + k 4 − 1.Automatically, C is a valid approximation in this case as well.Thus if any of the two situations occur, our algorithm simply returns the current cycle C.
t 6 10 t 10 s 11 t 11 s 12 t 12 s 1.1 H ←− G; 1.2 foreach i ∈ {2, . . ., ℓ} do i ←− |{s j , t j } \ {s i , t i }|; if two long disjoint paths (G i , {s j , t j }, {s i , t i }, d i + 1) is No then 1.6 contract all edges of a maximum matching between {s j , t j } and {s i , t i } in H; remove all vertices in V (G i ) \ {s i , t i } from H; 1.10 add edge s i t i to H and mark it with G i ; d 2.1 foreach i ∈ {2, . . ., ℓ} such that d i > 0 and Q enters G i do if an edge between {s j , t j } and {s i , t i } was contracted in H then 2.4 replace s i and/or t i in Q with the respective contracted edges; S 1 , S 2 ←− two long disjoint paths(G, {s j , t j }, {s i , t i }, d i + 1); replace the two subpaths of Q going from {s j , t j } to {s i , t i } with S 1 and S 2 if the length of Q increases; ←− largest h ∈ [ℓ] such that Q enters G h ; 2.11 if G h is not decomposed then 2.12 replace s h t h in Q with P h ; 2.13 else R ←− result of Lemma 9 applied to G h , P h and the (s h , t h )-subpath of Q; 2.24 return Q; Algorithm 2: The algorithm decompressing a path in H into a long path in G.
4.6 end 4.7 if δ ≤ 24 then 4.8 return C; 4.9 end 4.10 while |V (C)| − 2δ < ⌊ 1 24 δ⌋ and Lemma 14 applied to G and C gives a longer cycle do 4.11 C ←− a longer cycle in G; 4.12 end 4.13 if |V (C)| ≥ ⌊2 1 24 δ⌋ or Lemma 14 gives the vertex cover of G then 4.14 return C; 4.15 end 4.16 foreach u, v ∈ V (G) such that G − {u, v} is not connected do