scieee AI-readable full text Open interactive document viewer

On the complexity of the Whitehead minimization problem

Roig, Abdó; Ventura, Enric; Weil, Pascal

Abstract

The Whitehead minimization problem consists in finding a minimum size element in the automorphic orbit of a word, a cyclic word or a finitely generated subgroup in a finite rank free group. We give the first fully polynomial algorithm to solve this problem, that is, an algorithm that is polynomial both in the length of the input word and in the rank of the free group. Earlier algorithms had an exponential dependency in the rank of the free group. It follows that the primitivity problem - to decide whether a word is an element of some basis of the free group - and the free factor problem can also be solved in polynomial time.

Full text

ON THE COMPLEXITY OF THE WHITEHEAD MINIMIZATION PROBLEM ABD ´ O ROIG, ENRIC VENTURA, AND PASCAL WEIL Abstract. The Whitehead minimization problem consists in finding a minimum size element in the automorphic orbit of a word, a cyclic word or a finitely generated subgroup in a finite rank free group. We give the first fully polynomial algorithm to solve this problem, that is, an algorithm that is polynomial both in the length of the input word and in the rank of the free group. Earlier algorithms had an exponential dependency in the rank of the free group. It follows that the primitivity problem – to decide whether a word is an element of some basis of the free group – and the free factor problem can also be solved in polynomial time. Let Fbe a finite rank free group and let Abe a fixed (finite) basis of F. The elements of Fcan be represented by reduced words over the symmetrized alphabet A∪¯ A, and the finitely generated subgroups of Fby certain finite graphs whose edges are labeled by letters from A(obtained by the technique of so-called Stallings foldings [23], see [12] and Section 1). We measure the size of an element of Fby the length of the reduced word representing it, and the size of a finitely generated subgroup of Fby the number of vertices of the graph representing it. The Whitehead minimization problem consists in finding a minimum size element in the automorphic orbit of a given word or a given finitely generated subgroup. An important variant considers rather as input conjugacy classes of words (the so-called cyclic words) or subgroups. As we will see (Section 1.3), the minimization problem for words, cyclic words and subgroups can be reduced to the problem for conjugacy classes of finitely generated subgroups, so we will often discuss only the latter problem. The Whitehead minimization problem is a fragment of the larger equivalence problem, where one must decide, given two subgroups of F, whether they sit in the same automorphic orbit. More precisely, in view of a result of Part of this work was produced while the second author was a Visiting Professor at LaBRI, Universit´e Bordeaux-1. The second author gratefully acknowledges partial support by DGI (Spain) through grant BFM2003-06613. The third author gratefully acknowledges support from the ESF programme AutoMathA. 1 2 ABD ´ O ROIG, ENRIC VENTURA, AND PASCAL WEIL Gersten [5] (which generalizes to subgroups a classical result of Whitehead that applies to words [26], see [17, Sec. I.4]), the first part of the (only known) algorithm to solve the equivalence problem consists in finding minimum size elements in the automorphic orbits of the given subgroups, that is, in solving the Whitehead minimization problem for these two subgroups. Moreover, any solution of the Whitehead minimization problem for words implies a solution of the primitivity problem: to decide whether a given word is an element of some basis of F. Indeed, a word is primitive if and only if the minimum length of an element in its automorphic orbit is 1. Similarly, a subgroup is a free factor of Fif and only if the minimum size of an element in its automorphic orbit is 1, so any solution of the Whitehead minimization problem for subgroups implies a solution of the free factor problem: to decide whether a given subgroup is a free factor of F. As hinted above, a classical algorithm is known to solve the Whitehead minimization problems. The algorithm for the word case is based on Whitehead’s theorem [26] (see [17, Prop. I.4.17]), and the algorithm for the subgroup case relies on a generalization of this theorem due to Gersten [5, Corol. 2] (Theorem 1.9 below). Both algorithms are polynomial in n, the size of the input, and exponential in r, the rank of the free group F, see Section 1.4 below and [18] for a more detailed analysis. In a recent paper, Haralick, Miasnikov and Myasnikov [8] (see also Miasnikov and Myasnikov [18]) present a number of heuristics and experiments on different implementation strategies for the algorithm regarding words, that tend to show that the actual dependency of the problem in the rank of Fis much lower than exponential, at least in the generic case. Haralick and Miasnikov [7] pursue in that direction by giving a polynomial-time stochastic algorithm for the same problem. Another recent paper, by Silva and Weil [22] gives an exact algorithm for solving the free factor problem on input H, which is polynomial in the size of Hand exponential in rank(F)−rank(H). The main result of this paper confirms the intuition of [8, 18, 7] and improves the complexity result in [22]. Indeed, we give a fully polynomial solution to the Whitehead minimization problem, that is, an exact algorithm that is polynomial in both the size of the input and the rank of F. Interestingly, this result is obtained with only a small amount of new mathematical results. Our algorithm is in fact a minor modification of the classical Whitehead method (the algorithm mentioned above), and the study of its complexity relies on the conjunction of three ingredients: (1) a representation of a Whitehead automorphism as a pointed cut of the set A∪¯ A, that is, a partition of A∪¯ Ainto two disjoint subsets Yand Zand the choice of a letter a∈Ysuch that ¯a∈Z, COMPLEXITY OF THE WHITEHEAD MINIMIZATION PROBLEM 3 (2) an exact computation of the effect of such an automorphism on the length of a cyclic word u(resp. the size of a conjugacy class Hof finitely generated subgroups) in terms of the capacity of the associated cut on the Whitehead graph associated with u(resp. a generalization of the Whitehead graph which we call the Whitehead hypergraph of H), (3) and an algorithmic complexity result on finding a minimum capacity cut in a graph (resp. a hypergraph). The first ingredient is classical in combinatorial group theory (see for instance [17, Prop. I.4.16]). The second ingredient can be described as a rewording of a formula of Gersten [5, Corol. 2] proved in [11, Prop. 10.3]. And the last one can be reduced to standard problems in combinatorial optimization, for which there exist several polynomial-time algorithms in the literature. In Section 1, we fix the notation to handle words, cyclic words and subgroups of F, and to describe Whitehead automorphisms. We also discuss the foundational theorem of Whitehead and its generalization by Gersten, that gives rise to the known algorithm solving the Whitehead minimization problem. As indicated above this algorithm is polynomial in the size of the input and exponential in the rank of the ambient free group. In Section 2, we introduce the Whitehead hypergraph of a cyclically reduced subgroup, and we present a rewording of a formula of Gersten, describing the effect of a Whitehead automorphism on the size of a conjugacy class of finitely generated subgroups (and generalizing a classical result of Whitehead on cyclic words, see [17, Prop. I.4.16]). This technical analysis helps show how the exponential dependency in the usual Whitehead algorithm can be removed, provided a certain graph-theoretic problem, namely the min-cut problem for undirected hypergraphs, can be solved in polynomial time. We discuss existing polynomial-time algorithms to solve the min-cut problem in Section 3, thus completing our proof. Finally, we consider some consequences of our main result. We conclude this introduction with a remark on complexity computation. Since the rank rof Fis part of the input, we consider complexity functions under the bit cost assumption:ris the cardinality of Aand each letter is identified by a bit string of length log r, so that the elementary operations on A(reading or writing a letter, comparing two letters, etc) require O(log r) units of time. 4 ABD ´ O ROIG, ENRIC VENTURA, AND PASCAL WEIL 1. The Whitehead minimization problem In this paper, Fdenotes a finitely generated free group and Adenotes a fixed basis of F. We let r=rank(F) = card(A). 1.1. Words, graphs and subgroups. Elements of Fcan be represented as usual by reduced words on the symmetrized alphabet ˜ A=A∪¯ A, and we write u∈F(A) to indicate that the element uof Fis given by a reduced word on alphabet ˜ A. Recall that the mapping a7→ ¯ais extended to the set of all words over the alphabet ˜ Aby letting ¯ ¯a=afor each a∈A, and ua = ¯a¯ufor each word uand each letter a∈˜ A. 1.1.1. Graphs. To represent finitely generated subgroups of F, we use finite A-graphs. An A-graph is a directed graph, whose edges are labeled by letters in ˜ A. More precisely, it is a pair Γ = (V, E) with E⊆Vט A×V. The elements of Vare called vertices, the elements of Eare called edges, and we say that there is an edge from xto ylabeled aif (x, a, y)∈E. We denote respectively by α,λand ωthe first, second and third coordinate projections from Eto V,˜ Aand V. The map λis called the labeling function. We measure the size of an A-graph Γ by the number of its vertices, and we write |Γ|=card(V). Adual A-graph is one in which for each a∈A, there is an edge from vertex xto vertex ylabeled aif and only if there is one from yto xlabeled ¯a. That is, (x, a, y)∈Eif and only if (y, ¯a, x)∈E. A dual A-graph is reduced if whenever there are a-labeled edges from x to yand from x′to y, then x=x′(a∈˜ A,x, x′, y ∈V). It is cyclically reduced if it is reduced and, for each vertex x, there exist at least 2 edges into x. If Γ is an A-graph and x∈V, we define the link of xto be the set of edges into x, and the hyperlink of xto be the set of labels of these edges, linkΓ(x) = {e∈E|ω(e) = x},hlΓ(x) = {λ(e)|e∈linkΓ(x)}. (The reason for the terminology hyperlink will become clear in Section 2.1.) Let Γ be a dual A-graph. By an immediate rewording of the definitions, we see that Γ is reduced if and only if λestablishes a bijection from linkΓ(x) to hlΓ(x); and Γ is cyclically reduced if in addition, card(hlΓ(x)) ≥2 for each x∈V. A vertex xsuch that card(hlΓ(x)) ≤1, is called an endpoint of Γ. We say that an A-graph is connected if the underlying undirected graph is connected. In the case of a dual A-graph, this is the case if and only if, for any vertices x, y, there exists a path from xto y. COMPLEXITY OF THE WHITEHEAD MINIMIZATION PROBLEM 5 The following particular case will be important for our purpose. A circular A-graph is a connected dual A-graph in which the link of each vertex has exactly 2 elements. A cyclically reduced circular A-graph is called a cyclic word. Example 1.1. When representing A-graphs, we draw only the positively labeled edges, that is, those labeled by letters of A. Figure 1 shows such A-graphs. In that figure, Γ1, Γ2and Γ3are reduced, Γ0is not. Vertices 2 and 3 are endpoints in Γ2and Γ3respectively, while Γ1has no endpoint. In Γ2, the hyperlink of vertex 1 is {a, ¯a,¯ b}and the hyperlink of vertex 2 is {¯a}.⊓⊔ 1.1.2. Reduction. Let Γ = (V, E) be a dual A-graph, and let x, y be distinct vertices. The A-graph obtained from Γ by identifying vertex yto vertex xis constructed as follows: its vertex set is V\{y}; and its edge set is obtained from Eby replacing everywhere yby x. The resulting A-graph is again dual. Note that identifying yto xor xto yyields isomorphic A-graphs. If Γ is not reduced, there exist pairs of distinct edges (x, a, z) and (y, a, z) (that is, edges with the same label that point to the same vertex). An elementary reduction of Γ is the A-graph that results from identifying vertex yto vertex xin such a situation (which automatically implies the identification of the two distinct edges). The reduction of a dual A-graph Γ consists in repeatedly performing elementary reductions, as long as some are possible. This is a terminating process since we consider only finite graphs, and each elementary reduction properly decreases the size of the graph. The resulting graph, denoted by red(Γ), is reduced, and it is well known that it does not depend on the sequence of elementary reductions that were performed (that is: the process of elementary reductions is confluent, see [23]). If Γ is reduced, an elementary trimming consists in removing an endpoint and the edges adjacent to it. The cyclic reduction of Γ consists in repeatedly applying elementary trimmings, as long as it is possible. The resulting graph is cyclically reduced, it does not depend on the sequence of elementary trimmings performed, and it is called the cyclic core of Γ, written cc(Γ). Clearly, cc(Γ) is a subgraph of Γ. If xis a vertex of Γ, there exists a unique shortest path from xto a vertex of cc(Γ). We call this path the branch of Γ at x, and we denote by b(x) the label of that path, and by β(x) its extremity in cc(Γ). If xis already in cc(Γ), then β(x) = xand b(x) is the empty word, b(x) = 1. 6 ABD ´ O ROIG, ENRIC VENTURA, AND PASCAL WEIL 1 Γ0 1 Γ1 12 Γ2 3 Γ3 a a b bb a a ba b a a a b b a b b b a Figure 1. Four A-graphs COMPLEXITY OF THE WHITEHEAD MINIMIZATION PROBLEM 7 Example 1.2. With reference to the A-graphs in Example 1.1 and Figure 1, we have red(Γ0) = Γ1=cc(Γ2) = cc(Γ3). In graph Γ2, we have β(2) = 1 and b(2) = a.⊓⊔ Let u=a1···an∈F(A). The word uis said to be cyclically reduced if an6= ¯a1, if and only if the word u2is reduced. It is a standard observation that, in general, there exists a unique cyclically reduced word wsuch that u=vw¯vfor some v∈F(A). The word wis called the cyclic core of u, written cc(u). Let Γ(u) be the circular graph with vertex set Z/nZ= {1,...,n}and with edges (i, ai, i + 1) and (i+ 1,¯ai, i) for each 1 ≤i≤n. Reducing Γ(u) yields the graph shown in Figure 2, and cc(Γ(u)) = Γ(cc(u)). 1β(1) v=b(1) w=cc(u) Figure 2. The graph red(Γ(u)), where u=vw¯v,v=b(1) and w=cc(u) Fact 1.3. It is verified in [22, Sec. 3.2] that reducing and trimming an nvertex dual A-graph takes time O(n2log(nr)). See Touikan [25] for a faster algorithm. If u∈F(A) has length n, its cyclic core cc(u) is computed in time O(nlog r). In particular, reducing and trimming an n-vertex circular graph takes time O(nlog r). ⊓⊔ 1.1.3. Graphs and subgroups. It is classical to represent finitely generated subgroups of Fby pointed A-graphs. Let Hbe a finitely generated subgroup of F(we write H≤fg F) and let h1,...,hm∈F(A) be a set of generators of H. Let Γ0(h1,...,hm) be the dual A-graph which consists of a bouquet of m loops, labeled by the hi, around a distinguished vertex, usually denoted by 1. We denote by Γ(H) the reduced A-graph red(Γ0(h1,...,hm)). Observe that this construction coincides with the application of the so-called Stallings foldings [23, 12]: it is well-known that the pair (Γ(H),1) depends on H only, not on the choice of the generating set {h1,...,hm}, and we call it the (graphical)representation of H. Γ(H) is a connected reduced A-graph, in which no vertex different from 1 is an endpoint. 8 ABD ´ O ROIG, ENRIC VENTURA, AND PASCAL WEIL Conversely, if Γ is a connected reduced A-graph, 1 is a vertex of Γ and Γ has no endpoint except maybe for 1, there exists a unique subgroup H≤fg Fsuch that (Γ,1) is the representation of H. In that situation, let Tbe a spanning tree of the A-graph Γ, and for each vertex x, let uxbe the only reduced word labeling a path from 1 to xinside the tree T. For each positively labeled edge e= (x, a, y) (that is, a∈A), let he=uxa¯uy. Then a basis of Hconsists of the elements he, where eruns over the positively labeled edges not in T[23, 12]. Example 1.4. Let H1=ha2b−1, b2a−1i. With reference to the graphs in Figure 1, we see that Γ0= Γ0(a2b−1, b2a−1) (with distinguished vertex 1) and (Γ1,1) is the graphical representation of H1. Let H2= ha3b−1a−1, ab2a−2iand H3=hb−1ab−1ab, b−1a−1b3i. The graphical representation of H2is (Γ2,2) and the graphical representation of H3is (Γ3,3). ⊓⊔ Fact 1.5. In view of Fact 1.3, and if Pm i=1 |hi|=n, computing Γ(H) takes time O(n2log(nr)). Given an n-vertex reduced A-graph Γ and a vertex 1, and letting Hbe the subgroup represented by (Γ,1), one can compute in time O(n2log(nr)) a basis of H, whose elements are words of length at most 2n[22, Sec. 3.3]. If H=huiis a cyclic subgroup of F, generated by a word of length n6= 0, then {u}is a basis of Hand Γ(hui) = red(Γ(u)) is computed in time O(nlog r) by Fact 1.3. ⊓⊔ Let H≤fg F, with representation (Γ(H),1). Let us say that His cyclically reduced if 1 is not an endpoint, that is, if Γ(H) is cyclically reduced. In the general case, let Kbe the subgroup represented by (cc(Γ(H)), β(1)). It is well-known that K=χb(1)(H), where χuis the conjugation x7→ u−1xu. It follows that, for each subgroup H′≤fg F,H′is a conjugate of Hif and only if cc(Γ(H′)) = cc(Γ(H)). As a consequence, we say that cc(Γ(H)) is the (graphical)representation of the conjugacy class [H]. We note that if H=huiis a cyclic subgroup, then the subgroup His cyclically reduced if and only if the word uis cyclically reduced. In the sequel, the size of Γ(H) and of cc(Γ(H)) will be taken to be measures of the size of Hand [H], and we will write |H|=|Γ(H)|and |[H]|=|cc(Γ(H))|. In particular, |[H]|is the minimum size of subgroups in the conjugacy class [H], and it is equal to the size of any cyclically reduced conjugate of H. Example 1.6. Let H1,H2and H3be the subgroups discussed in Example 1.4. In view of Figure 1, we see that H1is cyclically reduced, and that H2=χa−1(H1) and H3=χab(H1). ⊓⊔ COMPLEXITY OF THE WHITEHEAD MINIMIZATION PROBLEM 9 1.2. Action of an automorphism. Let ϕ∈Aut(F) and let Γ = (V, E) be a reduced A-graph with a designated vertex 1. Let ϕ•(Γ) be the A-graph obtained after the following steps: (a) replace each a-labeled edge by a path labeled by the word ϕ(a) with the same endpoints: if ϕ(a) = a1···am(ai∈˜ A) and (x0, a, xm)∈ E, remove the edges (x0, a, xm) and (xm,¯a, x0), add new vertices x1,...,xm−1and add edges (xi−1, ai, xi) and (xi,¯ai, xi−1) for each 1≤i≤m; (b) reduce the resulting A-graph; (c) repeatedly trim all the endpoints different from 1. If Γ is cyclically reduced, we also denote by ϕ(Γ) the cyclically reduced graph cc(ϕ•(Γ)). Example 1.7. Let Γ1be as in Example 1.1 and let ϕ∈Aut(F) be given by ϕ(a) = ba−1and ϕ(b) = bab−1. The graphs Γ1,ϕ•(Γ1) and ϕ(Γ1) are shown in Figure 3. ⊓⊔ Fact 1.8. Let ℓbe the maximum length of the image of a letter by an automorphism ϕ(so ϕis given by a r-tuple of words of length at most ℓ) and let Γ be an n-vertex reduced A-graph. In view of Fact 1.3, the complexity of computing ϕ•(Γ) is O(n2ℓ2r2log(nℓr)). If Γ is a cyclic word, Γ = Γ(u) with u∈F(A) cyclically reduced and |u|= n, then ϕ•(Γ) = red(Γ(ϕ(u))), which is computed in time O(nℓ log r). ⊓⊔ It is easy to verify that if ϕ∈Aut(F) and H≤fg F, then ϕ(H) is represented by (ϕ•(Γ(H)),1). If in addition His cyclically reduced, the conjugacy class ϕ([H]) is represented by ϕ(Γ(H)). The Whitehead minimization problem (WMP) for finitely generated subgroups (resp. for conjugacy classes of finitely generated subgroups) consists in finding a minimum size element X′of the automorphic orbit of a given finitely generated subgroup (resp. conjugacy class of finitely generated subgroups) X, and an automorphism ϕsuch that X′=ϕ(X). If the input of the WMP is a conjugacy class of cyclic subgroups, that is, a cyclic word, we talk of the Whitehead minimization problem for cyclic words. The Whitehead minimization problem for words consists in finding a minimum length element u′of the automorphic orbit of a given reduced word u, and an automorphism ϕsuch that u′=ϕ(u). We will see in Section 1.3 that all these problems reduce to the problem for conjugacy classes of finitely generated subgroups. 16 ABD ´ O ROIG, ENRIC VENTURA, AND PASCAL WEIL Proof. Let Γ = (V, E), v,Yand ϕbe as in the statement. We first examine in detail the construction of ϕ(Γ). The first step is to construct the A-graph Γ′= (V′, E′) as follows. For each vertex x∈V, if hlΓ(x)∩(Y\{v})6=∅, we let uxbe a new vertex. If hlΓ(x)⊆Yc∪ {v},uxis undefined. We let V′=V∪{ux|uxexists}. The set E′consists of the following edges. All the v- and ¯v-labeled edges of Γ are also in E′. Next, if x∈Vand uxexists, then there is a v-labeled edge from uxto xand a ¯v-labeled edge from xto ux. Finally, for each a-labeled (a6=v, ¯v) edge from xto yin Γ, there is an a-labeled edge in Γ′ •from uxto uyif a, ¯a∈Y, •from xto uyif a∈Y, ¯a6∈ Y, •from uxto yif a6∈ Y, ¯a∈Y, •from xto yif a, ¯a6∈ Y. The transformation of Γ into Γ′is local in the following sense. Around each vertex x, we separate hlΓ(x) into hlΓ(x)∩(Y\{v}) and hlΓ(x)∩(Yc∪{v}) and, when the first set is non-empty, we push this fragment of hlΓ(x) away from xby introducing a new v-labeled edge (see Figure 4). hlΓ(x)∩(Y\{v}) hlΓ(x)∩(Yc∪{v}) x v v in Γ x uxv v v in Γ′ Figure 4. From Γ to Γ′ An observation that will be important in the sequel is that, by construction, the vertices x∈Vsatisfy hlΓ′(x)⊆Yc∪{v}, while the new vertices of the form uxsatisfy hlΓ′(ux)⊆(Y\{v})∪{¯v}. We note that for each a-labeled edge from xto yin Γ, we now have a path in Γ′from xto y, labeled by the word ϕ(a), and that Γ′consists of the collection of these paths. Thus ϕ(Γ) is obtained by first reducing Γ′, and then taking the cyclic core of the resulting A-graph, see Section 1.2. We now consider whether Γ′is reduced. Let x∈Vbe such that ux exists. Then linkΓ′(ux) consists of a ¯v-labeled edge, and a non-empty set in bijection with the set of edges in linkΓ(x) with a label in Y\ {v}. In particular, the labeling map λ′is injective on linkΓ′(ux). Moreover, uxis not an endpoint. COMPLEXITY OF THE WHITEHEAD MINIMIZATION PROBLEM 17 Now let xbe a vertex of Γ′, in V. There are 3 cases. We let •V1be the set of x∈Vsuch that uxdoes not exist, that is, hlΓ(x)⊆ Yc∪{v}; •V2be the set of x∈Vsuch that uxexists and linkΓ(x) contains no v-labeled edge, that is, hlΓ(x)∩(Y\{v})6=∅and v6∈ hlΓ(x); •V3be the set of x∈Vsuch that uxexists and linkΓ(x) contains a v-labeled edge, that is, hlΓ(x)∩(Y\{v})6=∅and v∈hlΓ(x). Case 1: x∈V1. Then linkΓ′(x) is in bijection with linkΓ(x), the labeling map λ′is injective on linkΓ′(x), and xis not an endpoint. Case 2: x∈V2. Then linkΓ′(x) consists of a v-labeled edge plus a set in bijection with the subset of linkΓ(x) of all edges labeled by letters in Yc. In particular, the labeling map λ′is injective on linkΓ′(x). Moreover, xis an endpoint in Γ′if and only if hlΓ(x)⊆Y. Case 3: x∈V3. Then linkΓ′(x) consists of two v-labeled edges (one of them starting at ux) and a set in bijection with the subset of linkΓ(x) consisting of the edges labeled by letters in Yc. Thus Γ′is non-reduced if and only if V36=∅, and in that case, the first step in reducing Γ′consists in performing the elementary reductions that arise from the pairs of v-labeled edges into the vertices x∈V3. We claim that the resulting graph, say Γ′′, is already reduced. In order to justify this claim, let us consider the effect of such an elementary reduction. Since x∈V3, Γ has a v-labeled edge from some y∈Vto x, and at least one a-labeled edge from some z∈Vto x, with a∈Y\{v}, see Figure 5. In Γ′, there are v-labeled edges from yand from uxto x, and an a-labeled edge from z′to ux(with z′∈ {z, uz}). By a previous observation, hlΓ′(y)⊆Yc∪{v}and hlΓ′(ux)\ {¯v} ⊆ Y\ {v}. Thus, after the elementary reduction identifying uxto y, the labeling function λ′′ is injective on linkΓ′′ (y). It follows that Γ′′ is reduced. Moreover |Γ′′|=|Γ|−card(V2). Next, we proceed to trimming Γ′′, since we want to compute ϕ(Γ), which is equal to cc(Γ′′). The analysis above shows that Γ′′ has two kinds of endpoints: •vertices x∈V2such that hlΓ(x)⊆Y(i.e., hlΓ(x)⊆Y\{v}), •vertices x∈V3such that hlΓ(x)⊆Y. Suppose first that x∈V2and hlΓ(x)⊆Y\{v}. Since xis not an endpoint in Γ, hlΓ(x) contains at least 2 elements a6=band hence, hlΓ′′ (ux) = hlΓ′(ux) has at least three elements, see Figure 6. Removing the vertex xand the only adjacent edges (labeled vfrom uxto x, and ¯vfrom xto ux) leaves a non-singleton link at ux, that is, trimming xdoes not create a new endpoint. 18 ABD ´ O ROIG, ENRIC VENTURA, AND PASCAL WEIL z y x a v in Γ z′ uxx y a v v in Γ′ z′ x y=ux a v in Γ′′ Figure 5. x∈V3,a∈Y\{v} zt x ab in Γ z′ uxx t′ a v b in Γ′and Γ′′ z′ ux t′ ab in cc(Γ′′) Figure 6. x∈V2,a, b ∈Y\{v},a6=b Suppose now that x∈V3and hlΓ(x)⊆Y, and let ybe the initial vertex of the v-labeled edge of Γ into x. Since x∈V3, there is an a-labeled edge of Γ into x(say, from vertex z∈V) for some a∈Y\ {v}, and therefore, a∈hlΓ′(ux)∩(Y\{v}). Since yis not an endpoint in Γ, linkΓ(y) contains an edge labeled b6= ¯v, see Figure 7. Then linkΓ′(y) contains an edge labeled b′ with b′=vif b∈Y, and b′=botherwise. In particular, b′∈Yc∪{v}\{¯v}, and hence b′6=a. Finally, the vertices uxand yare identified in Γ′′, so linkΓ′′ (y) contains the distinct elements a, b′and again, trimming xdoes not create a new endpoint. It follows that trimming these two families of endpoints suffices to yield cc(Γ′′) = ϕ(Γ). The total number of vertices trimmed in this process is card({x∈V2∪V3|hlΓ(x)⊆Y}) = card({x∈V|hlΓ(x)⊆Y}), so |ϕ(Γ)|−|Γ|=|cc(Γ′′)|−|Γ|=|Γ′′|−card({x∈V|hlΓ(x)⊆Y})−|Γ| =card(V2)−card({x∈V|hlΓ(x)⊆Y}). In this count, we observe that each vertex x∈Vmay contribute positively (if x∈V2) and negatively (if hlΓ(x)⊆Y), that is |ϕ(Γ)|−|Γ|=X x∈V δ(x), COMPLEXITY OF THE WHITEHEAD MINIMIZATION PROBLEM 19 z y x t a v b in Γ z′ uxx y t′ a v v b′ in Γ′ z′ y=uxx t′ a v b′ in Γ′′ Figure 7. x∈V3,a∈Y\{v},b6= ¯v,b′∈ {b, v},b′∈Yc∪{v}\{¯v} 20 ABD ´ O ROIG, ENRIC VENTURA, AND PASCAL WEIL where δ(x) =      +1 if x∈V2and hlΓ(x)6⊆ Y, −1 if x6∈ V2and hlΓ(x)⊆Y, 0 otherwise . This is equivalent to δ(x) =      +1 if hlΓ(x) meets Yand Yc,and v6∈ hlΓ(x), −1 if hlΓ(x)⊆Yand v∈hlΓ(x), 0 otherwise , which yields the expected formula, |ϕ(Γ)|−|Γ|=capWΓ(Y)−degWΓ(v). ⊓⊔ Example 2.5. Consider the 6-vertex A-graph Γ in Figure 8. Its Whitehead hypergraph WΓwas computed in Example 2.1 and we have degWΓ(a) = 3. Let ϕbe the Whitehead automorphism specified by the pair (a, {a, b, ¯c, ¯ d}). We note that capWΓ({a, b, ¯c, ¯ d}) = 2, and that ϕ(Γ) then has 6 + 2 −3 = 5 vertices, in conformity with Proposition 2.4. The graph ϕ(Γ) is shown in Figure 8, as well as the graph ψ(Γ), where ψis the Whitehead automorphism specified by the pair (a, {a,¯ b, ¯c}). Since capWΓ({a,¯ b, ¯c}) = 4 , ψ(Γ) must have size 6 + 4 −3 = 7 by Proposition 2.4. ⊓⊔ Remark 2.6. Let Γ be a cyclically reduced A-graph, let v∈˜ Aand let Y⊆˜ A. It is easily verified that Yis a v-cut if and only if its complement Ycis a ¯v-cut, capWΓ(Y) = capWΓ(Yc) and degWΓ(v) = degWΓ(¯v) (equal to the number of v-labeled edges in Γ). ⊓⊔ 2.3. Relative complexity of the Whitehead minimization problem. The algorithms to solve the WMP discussed in Section 1.3, can now be modified as follows. We first consider the case of conjugacy classes of finitely generated subgroups. Let Hbe a cyclically reduced subgroup. First let ~ϕ = (id) and Γ = Γ(H). Then repeatedly apply the following steps: compute the Whitehead hypergraph WΓand for each v∈A, find a v-cut Yvof ˜ Athat minimizes capWΓ(Yv); if minv∈A(capWΓ(Yv)−degWΓ(v)) <0, let ψbe the Whitehead automorphism specified by (v, Yv) where vrealizes the above minimum, and replace Γ by ψ(Γ) and ~ϕ by (ψ, ~ϕ); otherwise, stop and output Γ and ~ϕ. Finally, choose arbitrarily a vertex 1 in Γ and use the procedure discussed in Section 1.1.3 to output a basis of H′. The difference with the algorithm in Section 1.3 lies in the fact that instead of trying every Whitehead automorphism to find one that decreases the size of the cyclically reduced A-graph, we directly select one that will COMPLEXITY OF THE WHITEHEAD MINIMIZATION PROBLEM 21 1 2 3 4 5 6 a b dcd e a c a Γ 1 3 4 5 6 a ba d e d c c ϕ(Γ) 1 7 2 3 4 5 6 a a a cdd e a b c ψ(Γ) Figure 8. The graphs Γ, ϕ(Γ) and ψ(Γ) 22 ABD ´ O ROIG, ENRIC VENTURA, AND PASCAL WEIL yield the maximum size decrease. The fact that we consider only v-cuts where v∈Ais justified by Remark 2.6. Passing from the above algorithm to one that solves the WMP for subgroups, is done as in Section 1.3. In order to estimate the complexity of the reworded algorithm, we let g(n, r) be the complexity of the following problem, which we call the Whitehead hypergraph min-cut problem: if card(A) = r, given WΓ, the Whitehead hypergraph of a cyclically reduced A-graph Γ of size nand a letter v∈A, find a v-cut Yof ˜ Aminimizing capWΓ(Y). Fact 2.7. As we already saw in Fact 1.11, the cost of the construction of Γ(H), if the input is a set of generators of Hof total length n, is O(n2log(nr)), and Γ(H) has at most nvertices. The computation of the image of a cyclically reduced graph of size nunder a Whitehead automorphism takes time O(n2r2log(nr)). Moreover, the Whitehead hypergraph of a size ncyclically reduced A-graph has nhyperedges, and is computed in time O(nr log r) (Fact 2.3). Finding the degree of a vertex in such a hypergraph takes time O(nr log r). Then the complexity of each iterating step of our algorithm is at most O(nr log r+r(g(n, r)+nr log r)+n2r2log(nr)) = O(n2r2log(nr)+rg(n, r)). Since there are at most niterating steps, the complexity of the full algorithm is O(n2log(nr) + n(n2r2log(nr) + rg(n, r)) + n2log(nr)), that is, O(n3r2log(nr) + nrg(n, r)). ⊓⊔ Fact 2.8. Let the Whitehead graph min-cut problem be an instance of the Whitehead hypergraph min-cut problem where the input is the Whitehead graph Wuof a cyclic word u, and let g′(n, r) be the complexity function of this problem. Reasoning as in Fact 2.7, we find that the complexity of our algorithm to solve the WMP for cyclic words is O(n2log r+nrg′(n, r)). ⊓⊔ 3. Main result To conclude our work, we need to find algorithms to solve the Whitehead hypergraph min-cut problem and its graph analogue in time polynomial in nand r. 3.1. On minimizing the capacity of a cut. 3.1.1. The general case. The solution of the Whitehead hypergraph mincut problem can be reduced to a standard problem in combinatorial optimization, that of the minimization of submodular functions. A real-valued function f, defined on the powerset of a set B, is said to be submodular if COMPLEXITY OF THE WHITEHEAD MINIMIZATION PROBLEM 23 f(Y∪Z) + f(Y∩Z)≤f(Y) + f(Z) for any Y, Z ⊆B. We first verify the following fact. Lemma 3.1. Let W= (B, D, κ)be a hypergraph. The map Y7−→capW(Y), defined on the powerset of B, is submodular. Proof. Let dbe a hyperedge of W. The contribution of dto capW(Y) is 0 if κ(d)⊆Yor κ(d)⊆Yc, and 1 otherwise. In particular: •if the contribution of dto capW(Y∪Z) + capW(Y∩Z) is 2, then κ(d) meets Y∪Z, (Y∪Z)c,Y∩Zand (Y∩Z)c; then it meets Y, Yc,Zand Zc, so that the contribution of dto capW(Y) + capW(Z) is 2 as well; •if the contribution of dto capW(Y) + capW(Z) is 0, then κ(d) is contained in Yor in Yc, and it is contained in Zor in Zc; equivalently, it is contained in Y∩Z,Yc∩Z,Y∩Zcor Yc∩Zc; in particular, the contribution of dto capW(Y∪Z) + capW(Y∩Z) is 0 as well; •in all other cases, the contribution of dto capW(Y∪Z)+capW(Y∩Z) is at most 1 and its contribution to capW(Y) + capW(Z) is at least 1. This concludes the proof. ⊓⊔ Let vand WΓbe an instance of the Whitehead hypergraph min-cut problem. For each Y⊆V\{v, ¯v}, let f(Y) = capWΓ(Y∪ {v}). We note that Yminimizes function fif and only if Y∪{v}has minimum capacity among the v-cuts of ˜ A. It is easily derived from Lemma 3.1 that fis submodular. It follows from results of Gr¨otschel, Lov´asz and Schrijver [6] that fcan be minimized by an algorithm that makes a polynomial (in r) number of oracle calls (queries to evaluate fon a given argument). In our situation, given a subset Y⊆V\{v, ¯v}, computing f(Y) = capWΓ(Y∪{v}) takes time O(nr log r), so the Whitehead hypergraph min-cut problem can be solved in time polynomial in nand r. According to Queyranne [20, pp. 3-4], the number of oracle calls is O(r4), so the running time of the algorithm is O(nr5log r). A more recent result of Cunningham [1] gives a minimization algorithm with running time O(Mr3log(Mr)), where Mis an upper bound on the maximum value of f. In our case, the value of fis at most the number of hyperedges in WΓ, namely n, so Cunningham’s algorithm runs in time O(nr3log(nr)). We may take g(n, r) = nr3log(nr). Remark 3.2. The efficient minimization of submodular functions is an active research topic, and more recent work offers different algorithms which 24 ABD ´ O ROIG, ENRIC VENTURA, AND PASCAL WEIL can be used for our purpose just as well as Cunningham’s. We refer the reader for instance to Iwata, Fleischer and Fujishige [10], Schrijver [21] and Iwata [9]. ⊓⊔ 3.1.2. The graph case. In the case where the cyclically reduced graph Γ is a cyclic word, the Whitehead hypergraph WΓis in fact a graph. The Whitehead graph min-cut problem is a particular case of the more general min-cut problem, also a standard problem in operational research, for the solution of which there exists a vast literature. In its generality, the min-cut problem for graphs is the following. We are given a directed graph G= (V, E) with vertex set Vand edge set E, and a pair (s, t) of distinct vertices of G. In this problem, there may be several edges from a vertex xto a vertex y. An (s, t)-cut of Gis a subset Yof V, containing sand avoiding t. The capacity capG(Y) of such a set is equal to the number of edges that start in Yand end in the complement of Y. The min-cut problem consists in finding an (s, t)-cut Ythat minimizes capG(Y). There are many algorithms to efficiently solve the min-cut problem, see below. In order to solve the Whitehead min-cut problem on instance Wu and v(see Section 2.3), we may first turn Wuinto a directed graph W+ u as follows: we replace each undirected edge between vertices xand yby a pair of directed edges, one from xto yand the other from yto x. Next, we observe that a v-cut in the sense of Section 1.4 is a (v, ¯v)-cut in the sense of the min-cut problem, and conversely. Finally, we verify that if Yis a (v, ¯v)-cut, then both notions of capacity of Ycoincide, that is, capWu(Y) = capW+ u(Y). Thus a (v, ¯v)-cut with minimum capacity in W+ uis also a v-cut with minimum capacity in Wu. In particular, we may take g′(n, r) to be the time complexity of any algorithm solving the min-cut problem in a directed graph with nedges and 2rvertices. Finally, we note that Dinic’s algorithm solves the min-cut problem in time O(nr2) [2], see [15, p. 97], that is, we may take g′(n, r) = nr2. Remark 3.3. There are many polynomial time algorithms to solve the mincut problem, and we refer the reader to Kozen’s book [15, Chaps. 15–17] for a review of some of those algorithms that rely on the max-flow min-cut theorem (Ford and Fulkerson [3]), that is, that consist in maximizing a flow function associated with the graph. Dinic’s algorithm mentioned above falls in that category. We note also that Galil’s more recent algorithm [4] works in time O(n2/3r5/3). ⊓⊔ 3.2. Fully polynomial algorithms. Putting together the results of Sections 2.3 and 3.1, we get the expected result. COMPLEXITY OF THE WHITEHEAD MINIMIZATION PROBLEM 25 Theorem 3.4. One can solve the WMP in time polynomial in the size n of the input and the rank rof the ambient free group. More precisely, on the basis of Facts 2.7 and 2.8, the discussion in Section 3.1 implies the following. Fact 3.5. The WMP for finitely generated subgroups and for conjugacy classes of finitely generated subgroups can be solved in time O((n2r4+ n3r2) log(nr)), where nis the size of the input and r=rank(F). ⊓⊔ Fact 3.6. The WMP for words and for cyclic words can be solved in time O(n2r3), where nis the size of the input and r=rank(F). ⊓⊔ Our main concern in this paper is the fact that the above complexity functions are polynomial in nand r, and we are less concerned with the exact polynomial that can be achieved. In fact, we have phrased our algorithms in a modular way: an algorithm solving the Whitehead (hypergraph or graph) min-cut problem is called by our algorithm, and any improvement in the efficiency of the computation of a min-cut leads to an improvement in the efficiency of our algorithm. It is also worth noting that in the input of the WMP, we may assume r≤n. Indeed, letters of Athat do not occur in the input word or subgroup may be ignored, for instance by restricting ourselves to Whitehead automorphisms that fix them (say, leaving them and their inverses outside any v-cut). This implies immediately the following more compact results. Fact 3.7. The WMP for finitely generated subgroups and for conjugacy classes of finitely generated subgroups can be solved in time O(n6log n), where nis the size of the input, independently of the rank of the ambient free group. ⊓⊔ Fact 3.8. The WMP for words and for cyclic words can be solved in time O(n5), where nis the size of the input, independently of the rank of the ambient free group. ⊓⊔ 3.3. Consequences. Recall that a subgroup H≤fg F(A) is a free factor of Fif any of its bases can be extended to a basis of F. The free factor problem consists in deciding, given H, whether His a free factor of F. It is immediate that this is the case if and only if the minimum size of an element of the automorphic orbit of His 1. Therefore we obtain the following corollary. Corollary 3.9. There is an algorithm that decides the free factor problem (for a subgroup given by a set of generators of total length nin a rank rfree group) in time polynomial in both nand r.