Approximating the correction of weighted and unweighted orthology and paralogy relations

Background Given a gene family, the relations between genes (orthology/paralogy), are represented by a relation graph, where edges connect pairs of orthologous genes and “missing” edges represent paralogs. While a gene tree directly induces a relation graph, the converse is not always true. Indeed, a relation graph is not necessarily “satisfiable”, i.e. does not necessarily correspond to a gene tree. And even if that holds, it may not be “consistent”, i.e. the tree may not represent a true history in agreement with a species tree. Previous studies have addressed the problem of correcting a relation graph for satisfiability and consistency. Here we consider the weighted version of the problem, where a degree of confidence is assigned to each orthology or paralogy relation. We also consider a maximization variant of the unweighted version of the problem. Results We provide complexity and algorithmic results for the approximation of the considered problems. We show that minimizing the correction of a weighted graph does not admit a constant factor approximation algorithm assuming the unique game conjecture, and we give an n-approximation algorithm, n being the number of vertices in the graph. We also provide polynomial time approximation schemes for the maximization variant for unweighted graphs. Conclusions We provided complexity and algorithmic results for variants of the problem of correcting a relation graph for satisfiability and consistency. For the maximization variants we were able to design polynomial time approximation schemes, while for the weighted minimization variants we were able to provide the first inapproximability results.


Background
Genes are the basic molecular units of heredity holding the information for producing all proteins required to build and maintain cells. They are the key for understanding genetic diversity, adaptation to environmental variation, drug resistance, and many other genetic features. Therefore, a first step of most genomic studies is to group genes into families. Gene families are usually inferred from sequence similarity, the underlying idea being that similar sequences reflect homologous genes that have diverged from a common ancestral sequence.
However, homology alone is not sufficient to decipher the properties of genes. Given a gene family, it is important to discriminate between two types of homologs: orthologs being gene copies originating from a speciation event, and paralogs originating from a duplication event. According to the orthology conjecture [1], orthologous genes are expected to be more similar in function than paralogs.
Various methods have been developed to discriminate between orthologous and paralogous genes. Tree-based methods consist in first constructing a phylogenetic tree for the gene family, and then, given a species tree, applying a reconciliation approach for inferring speciation and duplication nodes [2]. On the other hand, tree-free methods are based on gene clustering according to sequence similarity (c.f. for example the COG database [3], OrthoMCL [4], InParanoid [5], Proteinortho [6]), synteny [7,8] or functional annotation of genes [9]. Results of these methods are pairwise orthology relations, or groups of orthologs, that can be represented as relation graphs, where vertices are genes and edges represent orthology relations between genes. Assuming a full inference of pairwise orthology relations, "missing" edges of the relation graph represent paralogy. In addition, as different inference methods may lead to different predictions, instead of a yes or no orthology assignment, existing methods can rather motivate a way of assigning a score to a given relation [10], leading to a weighted relation graph. For example, orthology predictions with OrthoMCL [4] are based on a weighted graph, where edge weights are related to the sequence similarity score of the adjacent genes, while InParanoid [5] provides a confidence value that shows how closely related a paralog is to its "seed ortholog". Surprisingly, as far as we know, weighted orthology/paralogy relation graphs have not been formally considered in the literature.
While a gene tree induces a set of relations betwen genes, the converse is not always true, as a set of relations may or may not represent a valid history for the gene family. Two underlying questions are: (1) is the set of relations "satisfiable" i.e. is there a tree, with internal nodes labeled as duplication or speciation, containing them all? (2) is the set of relations "S-consistent" with the known species tree S, i.e. is there a tree containing the relations that is a "valid" gene tree "in agreement" with S? Polynomial-time algorithms exist for deciding satisfiability and S-consistency for a full [11][12][13] or partial [10] set of pairwise gene relations.
In this paper, we address both the weighted and unweighted variants of the full relation graph correction problem. First, for a full weighted relation graph R, we consider two minimization versions for the problem of correcting the graph by minimizing edit operations, i.e. adding or removing edges of minimum total weight, so that it represents a satisfiable or S-consistent set of relations. Then, we consider two maximization versions for the unweighted variant were we are given a full unweighted relation graph that has to be corrected with edit operations, so that the maximum number of relations is not modified.
In the unweighted case, the minimization variant of the satisfiability correction problem reduces to editing a minimum number of edges of R in order to make it P 4 -free, which is known to be NP-hard [14]. In [13], an integer linear programming formulation is used to correct relation graphs of small size, which is also applicable to weighted graphs. In [15], the authors propose an approximation algorithm of factor 4 , where is the maximum degree of the input graph. The algorithm, however, offers no guarantees in the case of weighted graphs, as there are weighted instances on which the correction is arbitrarily far from optimal. It is shown in [16] that the minimum edge editing problem cannot be approximated within an "additive" factor of n 2−ǫ , for any ǫ > 0. Yet, the authors give a class of polynomial time algorithms that are approximable within an additive factor of ǫn 2 , for any ǫ > 0. This implies a constant factor algorithm for graphs with an edit distance of �(n 2 ), but offers no guarantee in the other cases. Moreover, this algorithm only applies to unweighted graphs, and does not consider that two genes from the same species must remain paralogs. Finally in [14], parameterized versions of the algorithm are explored. As for the S-consistency correction problem, we proved in a previous paper [17] that it is NP-hard, which is the only result so far.
We show in, "Hardness of approximation of minimum weighted editing for satisfiability and consistency" section, that the weighted satisfiability and S-consistency problems are not approximable within a constant factor, assuming the unique games conjecture. We complement this result by showing in "A bounded approximation algorithm for minimum weighted editing for satisfiability and consistency" section that they can be approximated within a factor of n (the number of vertices of the relation graph). The maximization variants for unweighted graphs are then considered in "PTASs for maximum CoGraph editing and maximum consistency editing" section. We show that a result in [16] implies a polynomial time approximation scheme (PTAS) for satisfiability. Furthermore, we prove that, by applying more involved arguments, a PTAS also exists for the S-consistency problem. We conclude the paper with some open problems.

Trees and orthology relations
where V H is its set of vertices (or nodes if H is a tree) and E H its set of edges. If H is a tree, degree one nodes are leaves.

Trees
All considered trees are rooted and binary. Given a set X, a tree T for X is a tree whose leafset, which we denote by L(T ), is in bijection with X. Given an internal node u of T, the subtree rooted at u is denoted T u and we call the leafset L(T u ) the clade of u. A node u is an ancestor of v if u is on the (inclusive) path between v and the root. If u and v are connected by an edge of T, then v is a direct descendant of u. We denote by ch(u) the set of direct descendants (children) of u. The lowest common ancestor (lca) of u and v, denoted lca T (u, v), is the ancestor common to both nodes that is the most distant from the root. We define lca T (U) analogously for a set U ⊆ V (T ).
A species tree S for a species set represents an ordered set of speciation events that have led to : an internal node is an ancestral species at the moment of a speciation event, and its children are the new descendant species.
A gene family Ŵ is a set of genes accompanied with a function s : Ŵ → � mapping each gene to its corresponding species. The evolutionary history of Ŵ can be represented as a node-labeled gene tree for Ŵ, where each internal node refers to an ancestral gene at the moment of an event (either speciation or duplication), and is labeled as a speciation (Spec) or duplication (Dup) accordingly. Formally, we call a DS-tree for Ŵ a pair (G, ev G ), where G is a tree with L(G) = Ŵ, and ev G : V G \ L(G) → {Dup, Spec} is a function labeling each internal node of G as a duplication or a speciation. We may write ev instead of ev G when the context is clear. For example, in Fig. 1, G 1 and G 2 are two DS-trees.
According to the Fitch [18] terminology, we say that two genes x, y of Ŵ are orthologous in G if ev(lca G (x, y)) = Spec , and paralogous in G if ev(lca G (x, y)) = Dup.
A DS-tree G for Ŵ does not necessarily represent a valid history. For this to hold, any speciation node of G should reflect a clustering of species "in agreement" with S [10]. Formally G should be S-consistent, as defined below, where s G is the LCA-mapping function, mapping each gene, ancestral or extant, to a species as follows: if g ∈ L(G), then s G (g) = s(g); otherwise, s G (g) = lca S ({s(g ′ ) : g ′ ∈ L(G g )}).

Definition 1 Let S be a species tree and G be a DS-tree.
Let v be an internal node of G such that ev(v) = Spec . Then the speciation node v, with children v 1 and v 2 , is S-consistent iff none of s G (v 1 ) and s G (v 2 ) is an ancestor of the other. We say that G is S-consistent iff every speciation node of G is S-consistent.
For example, in Fig. 1, G 1 is not S-consistent as the root of G 1 is not S-consistent.

Relation graphs
A relation graph R on a gene family Ŵ is a graph with vertex set V R = Ŵ, in which we interpret each edge {u, v} of E R as an orthology relation between u and v, and each "missing" edge {u, v} ∈ E R , also called non-edge, as a paralogy relation. Notice that if s(u) = s(v), then {u, v} must be a non-edge (u and v are paralogous). We denote n = |V R |.
A DS-tree G leads to a relation graph, denoted R(G), with vertex set L(G) and edge set corresponding to all gene pairs that are orthologous in G. Conversely, a relation graph R does not necessarily lead to a DS-tree. If this is the case, i.e. if there is a DS-tree G such that R(G) = R , then R is said satisfiable. As shown in [12], a relation graph R is satisfiable if and only if R is P 4 -free, meaning that, for any four vertices of R, the induced graph is not a path of length 3 (number of edges). The P 4 -free graphs are sometimes called cographs. See Fig. 1 for an example.
As a DS-tree does not necessarily represent a true history for Ŵ, satisfiability of a relation graph does not ensure a possible translation in terms of a history for Ŵ. For this to hold, R should also be consistent with the species tree, according to the following definition. Definition 2 Let S be a species tree. A relation graph R for Ŵ is S-consistent if and only if R is satisfiable by a DStree G which is itself S-consistent.

Problem statements
We call a weight for a relation graph R = (V R , E R ) a function w : V R 2 → R + on its vertex pairs. Notice that w assigns a weight to both edges (orthologies) and nonedges (paralogies). We shall assume that if s(u) = s(v) for two genes u and v, then {u, v} ∈ E R and w({u, v}) = ∞ . The weight function w is extended to any I R ⊆ V R 2 by defining w(I R ) = {x,y}∈I R w({x, y}).
. In other words, E + R (respectively E − R ) denotes inserted (respec. removed) edges. Given a relation graph R ′ = (V R ′ , E R ′ ) computed from R by edge insertion and removal, the set of removed edges is E − R = E R \ E R ′, and the set of inserted edges is E + R = E R ′ \ E R . For example, for the graph R ′ of Fig. 1 The problems considered in "Hardness of approximation of minimum weighted editing for satisfiability and consistency" section and "A bounded approximation algorithm for minimum weighted editing for satisfiability and consistency" section are the following. The first problem asks for a satisfiable relation graph, hence no species tree is considered, while the second asks for an S-consistent relation graph, hence the input contains also a species tree.

Minimum weighted editing for satisfiability (MinWES)
Input: A relation graph R = (V R , E R ) and a weight function w;

Minimum weighted editing for consistency (MinWEC)
Input: A relation graph R = (V R , E R ), a weight function w and a species tree S for (the set of species containing the genes represented by R); Below is a formal statement of the corresponding maximization version of MinWES for unweighted graphs, considered in "PTASs for maximum CoGraph editing and maximum consistency editing" section. Remember that edges represent orthologies, while non-edges are paralogies. Maximizing conservation therefore requires accounting for both edges and non-edges.

Maximum editing for consistency (MaxEC)
Input: A relation graph R = (V R , E R ) for a gene family with genes belonging to genomes in , a species tree S for ;

Hardness of approximation of minimum weighted editing for satisfiability and consistency
We show that MinWES is unlikely to be approximable within a constant factor, by presenting a gap-preserving reduction from Minimum Multi-Cut.
, and hence there are no "forced" paralogs. As for E R , it is defined as follows, where q = |V H | 5 + 1.
Notice however, that, since edge insertion is not allowed in Minimum Weighted Co-Graph Deletion, the weight of {u R , v R } never contributes to the cost of a solution of Minimum Weighted Co-Graph Deletion. We first show that there is a correspondance between solutions to the two problems on our constructed instances.
We first bound the number of edges of weight 1 in R.
Consider the edges connecting vertices Any other edge has weight >1, hence the lemma follows. Now, we present the main results needed to prove the inapproximability of Minimum Weighted Co-Graph Deletion.
Proof Given a set E ′ that defines a multicut in H, let V H ,1 , . . . , V H ,p be the sets of vertices of the connected components in the graph We define a solution of Minimum Weighted Co-Graph Deletion over instance R as follows. We construct the partition V R,1 , . . . , V R,p of the vertices of R such that v j,R and v ′ j,R belong to set V R,i if and only if v j ∈ V H ,i . All edges having their endpoints in two distinct V R,i , V R,j are removed.
We claim that the computed graph R ′ induced by the partition is P 4 -free. By construction, for each v j, Moreover, there is no edge between v j,R and v h,R , nor between v ′ j,R and v ′ h,R . Thus any path on four vertices in the graph on vertex set In both cases, the endpoints of the path share an edge, and thus cannot induce a P 4 . Now, consider the edges obtain R ′ , since the weight of such an edge is greater than Assume by contradiction that this does not hold, and that v ′ i,R , v ′ j,R belong to the same connected component of R ′ . Consider the shortest path P that connects vertices v i,R and v j,R in R ′ . Then P has length at least 2. Note that as P is a shortest path, it has no chord, i.e. non-consecutive vertices of P cannot share an edge.
Suppose that P does not include the vertex v ′ i,R . Then we can assume that t,R , then P has length at least 3 and it must therefore contain an induced P 4 .
So suppose instead that P includes the vertex v ′ i,R . Since by construction v ′ i,R is not adjacent to v j,R and it is not adjacent to any v ′ t,R , with t � = i, while it is adjacent to v i,R , P has length at least 3, and again must have an induced P 4 .
We can conclude that when {v i , v j } ∈ X, the corresponding vertices v ′ i,R , v ′ j,R belong to disconnected connected components of R ′ . Hence we can compute a multi-cut of H as follows: Assuming the unique games conjecture, the proof of inapproximability of Minimum Weighted Co-Graph Deletion is deduced from the inapproximability of Minimum Multi-Cut [19]. We have that where we assume OPT M (H) ≥ 1 for the second inequality (the case OPT M (H) = 0 can be checked in polynomial time). Since Minimum Multi-Cut is not approximable within a constant factor assuming the unique games conjecture [19], even on unweighted graphs, it follows that on an infinity of instances of H for any constant α ≥ 1. As a consequence, for any constant α ≥ 1, an infinity of instances of R yield: Since q = n 5 + 1, AP M (H) ≤ n 2 and z ≤ n 2 , it follows that AP M (H )z OPT M (H )q+z ≤ 1/n. Combining the last two inequalities, we have that for any constant β ≥ 1, which concludes the proof.
The result of Theorem 1 can be easily extended to Minimum Weighted Co-Graph Editing.

Corollary 1 Minimum Weighted Co-Graph
Editing is not approximable within a constant factor assuming the unique games conjecture.
Proof The result follows by a gap-preserving reduction similar to that for Minimum Weighted Co-Graph Deletion. Recall that for each pair {u R , v R } ∈ E R , a weight of q ′ is associated with {u R , v R }. Consider a solution R ′ of Minimum Weighted Co-Graph Editing on instance R that has cost not greater than It is easy to see that R ′ is obtained without any edge insertion.
The inapproximability result for Minimum Weighted Co-Graph Editing is easily extended to MinWEC. This is achieved by defining a species tree S on V R such that the root of S is connected to two subtrees, one with leafset {v i,R : v i ∈ V H }, one with leafset {v ′ i,R : v i ∈ V H }, and showing that any solution to our instance of Minimum Weighted Co-Graph Deletion must agree with this species tree.

Corollary 2
MinWEC is not approximable within a constant factor assuming the unique games conjecture.
Proof The result follows by a gap-preserving reduction similar to that for Minimum Weighted Co-Graph Deletion and Minimum Weighted Co-Graph Editing. Define a species tree S on V R such that the root of S is connected to two subtrees, one with leafset Consider the partition V R,1 , . . . , V R,p of the vertices of a solution R ′ of Minimum Weighted Co-Graph Deletion and Minimum Weighted Co-Graph R,i and G 2 R,i is associated with a duplication. G R,i is obtained by joining G 1 R,i and G 2 R,i in a root, associated with a speciation. Finally, the subtrees G R,1 , . . . , G R,p are joined in a gene tree G by duplication nodes (with any topology). By construction, G is S-consistent, thus the hardness result can be extended to MinWEC.

A bounded approximation algorithm for minimum weighted editing for satisfiability and consistency
While MinWES and MinWEC are not approximable within a constant factor, we show here that they can be approximated within factor n = |V (R)|, and we give the corresponding algorithms. Despite being a large approximation factor, this is the best known bound so far and shows that the problems have polynomially bounded approximability. We first describe the approximation algorithm for MinWES.
Denote by R = (V R , E R ) the complement of the graph R = (V R , E R ). A well-known property of cographs is given by the following lemma.

Lemma 3 [20] A graph R is P 4 -free if and only if for any X ⊆ V R , one of R[X] or R[X] is disconnected.
This motivates a greedy min-cut approach for Min-WES, performing an edge-editing of minimum weight disconnecting the graph or its complement, and iterating recursively on the resulting components. This is the main idea of Algorithm MinCut-Cograph-Editing below. Note that assuming forced paralogs have infinite weight, this algorithm will never make two genes from the same species orthologs.
More formally, let R = (V R , E R ) be a relation graph accompanied with a weight function w. Define a cut C = {X, Y } as a partition of V R with X and Y being non-empty sets, and denote E R (C) = {{x, y} ∈ E R : x ∈ X, y ∈ Y }. The weight of C is w(C) = w(E R (C)). The cut C is a minimum cut or MinCut if no other cut has a smaller weight w(C). Applying a cut C to R consists in removing all edges of E R (C) from R.

Algorithm MinCut-Cograph-Editing(R):
If R has at most 2 vertices Then Return; Remove all edges between X and Y in R;

MinCut-Cograph-Editing(R[X]); MinCut-Cograph-Editing(R[Ŷ ]); End If End Algorithm
Complexity: A MinCut of a given graph of n vertices and m edges can be found in time O(nm + n 2 log n) using the Stoer-Wagner algorithm [21]. In the Min-Cut-Cograph-Editing algorithm, MinCut is applied to both R and R. As at least one of these two graphs has �(n 2 ) edges, the required time for MinCut is therefore O(n 3 ). This step is repeated at most n times, hence the overall time complexity of MinCut-Cograph-Editing is O(n 4 ).
The remaining of this section is dedicated to proving Theorem 2, which states that MinCut-Cograph-Editing is an n-approximation algorithm. We denote by σ R the minimum weight of a P 4 -free edge-editing of R.
Lemma 4 Let C be a minimum cut of R, and let Ĉ be a minimum cut of R. Then σ R ≥ min{w(C), w(Ĉ)}.
Proof Let E * R be a P 4 -free edge-editing of R. By Lemma 3, either R(E * R ) or its complement is disconnected, implying that E * R must apply some cut on either R or R. This cut is at best a minimum cut. Proof Let E * R be a P 4 -free edge-editing of weight σ R , and let R ′ = R(E * R ). Assume that E * R has a weight stricly smaller than σ X + σ Y . Then, since R ′ [X] and R ′ [Y ] are P 4 -free, there must either be an edge-editing of R[X] of weight smaller than σ X , or an edge-editing of R[Y] of weight smaller than σ Y , contradicting the definition of σ X and σ Y .

Theorem 2 MinCut-Cograph-Editing is an n factor approximation algorithm for MinWES.
Proof Denote by β(R) the weight of the edge-editing found by the algorithm on R. We proceed by induction on n = |V R | to show that β(R) ≤ nσ R . The statement is trivial for n ≤ 3 (as there is nothing to correct), so assume that the algorithm finds a solution of weight β(R) ≤ kσ R for any graph of size at most k < n. The algorithm applies a minimum cut C = {X, Y } on R or R, and proceeds recursively on X and Y, with |X|, |Y | ≤ n − 1. By the induction hypothesis, we have where the last inequality holds due to Lemmas 4 and 5.
It is possible to show that the approximation factor of MinCut-Cograph-Editing is tight, as shown in Fig. 2. Suppose all weights are equal to one. Clearly, an optimal solution of weight 1 is obtained by removing the middle edge. However, a minimum cut {X, Y } can be found by taking X as a single vertex of degree one, and Y as the rest. In this manner, the algorithm might remove up to n − 3 edges before H becomes P 4 -free, which is n − 3 times worse than optimal.
Notice however that a solution of MinCut-Cograph-Editing on the example of Fig. 2 cannot be 2�(H ) times worse than the optimal solution, where �(H) is the degree of H (by putting half the leaves left and the other half right). We do not know whether MinCut-Cograph-Editing offers any guarantee in relation to �(H ) or �(H ).
By modifying MinCut-Cograph-Editing, it is possible to design an n factor approximation algorithm for MinWEC. The main difference with respect to MinCut-Cograph-Editing, is that the algorithm considers a minimum cut on a subset of R and a cut on a subset of R induced by the species tree S.
We first provide the detailed MinCut-Cograph-Editing-Cons algorithm, and show that it also is a n-factor approximation. Given a species tree S and a set Z ⊆ V R , let �(Z) = {s(x) : x ∈ Z}. Let S|�(Z) be the subtree of S restricted to �(Z) and let X S , Y S be the clades of the left and right child, respectively, of the root of S|�(Z). Consider the sets X = {x : s(x) ∈ X S } and Y = {y : is the only possible cut on R that maintains S-consistency, as this cut corresponds to a speciation in a DS-tree, and speciations must separate genes according to S. Therefore, it suffices to modify MinCut-Cograph-Editing by forcing the cut Ĉ to be C S (Z). Call this modified algorithm MinCut-Cograph-Editing-Cons. Proof Denote by β(R) the weight of the edge-editing found by the algorithm on R. We proceed by induction on n = |V R | to show that β(R) ≤ nσ R . The statement is trivial for n ≤ 2 (as there is nothing to correct), so assume that the algorithm finds a solution of weight β(R) ≤ kσ R for any graph of size at most k < n.
The algorithm applies a cut C = {X, Y } which is either a minimum cut on R or it is the cut C S (V R ), and proceeds recursively on X and Y, with |X|, |Y | ≤ n − 1. By the induction hypothesis, we have Now, similarly to Lemma 4, we have that w(C) ≤ σ R . First, let G ′ be the gene tree associated with a solution ... ... of MinWEC over instance R. If C is a minimum cut on R, it holds due to the proof Lemma 4. If C is C S (V R ), then notice that, in order to guarantee the consistency with S, the root of G ′ must induce exactly the cut C S (V R ).
Lemma 5 holds also for MinWEC, hence thus concluding the proof.

PTASs for maximum CoGraph editing and maximum consistency editing
In this section, we consider the MaxES and the MaxEC problems. Although sharing the same objectives, the minimization and maximization variants are not equivalent from an approximation point of view. Given a relation graph R, the value of a solution R ′ for MaxES (MaxEC, respectively) over instance R [over instance (R, S), respectively] is called the agreement value of R ′ and it is denoted by A(R ′ , R). Moreover, given a gene tree G, we denote by A(G, R) the agreement between the relation graph associated with G and R.
Next, we give a bound on the agreement value returned by an optimal solution of MaxES and MaxEC.

Lemma 6 Given a relation graph R (a relation graph R and a species tree S, respectively), an optimal solution of
MaxES over instance R [an optimal solution of MaxEC over instance (R, S), respectively] has an agreement value of at least n 2 8 .
Proof Consider a relation graph R and a species tree S for the MaxEC problem. Let R ′ = (V (R), ∅) and Let OPT(R) be the value of an optimal solution on R, and let c be such that OPT (R) = cn 2 . The additive εn 2 approximation algorithm for cograph editing [16] yields a solution of value (c − ε)n 2 . As c ≥ 1/8 by Lemma 6, ε can be adjusted so that, for any 0 < ε ′ < 1, (c − ε)n 2 ≥ (1 − ε ′ )cn 2 , hence yielding a PTAS. In the more general case, this algorithm does not ensure that genes from the same species remain paralogs. However, the authors of [16] claim that their approximation algorithm applies to any hereditary graph property (i.e. preserved after vertex-deletion), which holds for satisfiability.

A PTAS for MaxEC
The PTAS for MaxES does not guarantee that the returned relation graph R ′ (and its corresponding gene tree G ′ ) is S-consistent with the given species tree S. In this section, we present a PTAS for MaxEC based on smooth-polynomial integer programming [22], a technique that has been applied to design PTAS for problems like maximum quartet consistency [23] or maximum consensus clustering [24]. As for maximum quartet consistency, the MaxEC problem is reduced to the assignment of leaves in Ŵ to a tree, and the resulting tree is then used to to reconstruct a gene tree G ′ that is consistent with S and whose relation graph requires at most εn 2 modifications with respect to the original graph. In order to guarantee the S-consistency of the reconstructed gene tree, we need several technical arguments that are not used for maximum quartet consistency. Recall that we are considering binary trees.
Before giving the details, we present an overview of the PTAS. First, in "The compressed tree G k " section, we show that starting from a gene tree G ′ we can compute a compressed tree G k that has at most k internal nodes and at most k leaves, where k > 0 is a constant. In order to construct such a compressed tree, first in "The unlabeled compressed tree T k " section we compute an unlabeled compressed tree T k , and then in "A PTAS of MaxLA by smooth polynomial integer programming" section we compute a compressed tree G k from T k by using smoothpolynomial integer programming. Finally, we show in "Building a feasible solution" section how to reconstruct an S-consistent gene tree from G k .

The compressed tree G k
First, we will focus on the compressed tree, and we show that, given an optimal solution R ′ of MaxEC, there exists a compressed tree that respects a (large) subset of the speciation/duplication relations for R ′ .
Consider an optimal solution R ′ of MaxEC, and let (G ′ , ev G ′ ) be a DS-tree, where G ′ is the gene tree corresponding to R ′ . Recall that each internal node of G ′ is associated by ev G ′ either with a duplication (Dup) or with a speciation (Spec). We present the formal definition of compressed tree G k associated with (G ′ , ev G ′ ) (see Fig. 3).

Definition 3 Given a constant k > 0 and a DS-tree
is a tree that has at most k internal nodes and at most k leaves, which are called leaf-sets. An internal node v can be a regular internal node or can belong to a two-set internal node u, v such that v ∈ ch(u), and both u and v have exactly one leaf-set as a child. The two-set internal nodes of G k are disjoint, that is u, v and v, w cannot be two-set internal nodes of G k . Moreover, the following properties hold: • the leaf-sets of G k induce a partition of Ŵ and each leaf-set contains at most 8n / k elements of Ŵ • each internal node of G k is associated with two possible events, Dup or Spec, by the function ev G k • let I v 1 , I v 2 be two leaf-sets connected to nodes u 1 and u 2 , respectively, such that u 1 , u 2 is not a two-set internal node, let l 1 ∈ I v 1 , l 2 ∈ I v 2 , and x = lca G ′ (l 1 , l 2 ) and y = ev G k (lca G k (I v 1 , I v 2 )), then ev G ′ (x) = ev G k (y).
Note that a leaf-set I v of G k is both a set of leaves of G ′ , and a leaf of G k . It will sometimes be useful to clarify which one we wish to refer to, and so we denote by L(I v ) the set of leaves that belong to I v . Now, we provide a constructive proof that shows that, starting from a solution R ′ (whose corresponding gene tree is G ′ ) of MaxEC over instance (R, S), there exists such a compressed tree G k .
Consider the following algorithm. First, the algorithm initializes G k to G ′ and all internal nodes are unmarked. Then, the algorithm traverses G ′ and construct the tree G k as described in Algorithm Compressed Tree (G ′ ).

Algorithm Compressed Tree (G ):
Every node of G is unmarked; traverse G from the leaves; While there exists an unmarked vertex v of G If G v contains at least 8n/k unassigned leaves has no marked vertex Then Define a corresponding node v k of G k Let {y, z} = ch(v), and define the two children Iy and Iz of v k Assign all the leaves of G y to Iy, and all the leaves of G z to Iz Every vertex of G v is marked, and ev G k (v k ) = ev G (v) Else If G v contains at least 8n/k unassigned leaves and has some marked vertex y or v is the least common ancestor of two marked internal nodes y and z Then Define a corresponding node v k of G k If there exists a set W of internal nodes between v and a marked node q ∈ {y, z} in G v Then define a two-set internal node v1, v2 and two leaf-sets Iz 1 and Iz 2 in G k Iz i is the leaf-set connected to vi, i = 1, 2; For ALl w ∈ W , consider an unassigned leaf l of G w If ev(lca G (l, y)) = Spec Then assign l to Iz 2 Else assign l to Iz 1 End If End For connect v k to v1, v2 to the node q k corresponding to q Else connect v k to the nodes y k and z k corresponding to y and z End If Every unmarked vertex of G v is marked and ev G k (v k ) = ev G (v) Define a new leaf-set Iv containing the unassigned leaves of G v /* Notice that |Iv| < 8n/k */ Connect Iv to v k ; End While End Algorithm Dondi et al. Algorithms Mol Biol (2017) 12:4 When the algorithm stops it follows that each leaf-set has size at most 8n / k. Notice that, given a two-set internal node v 1 , v 2 , the leaves assigned to the leaf-sets I z 1 , I z 2 connected to v 1 and v 2 are considered as a single leaf-set with reference to the relation between elements in L(I z 1 ) ∪ L(I z 2 ).
Next, we show that the algorithm returns a compressed tree G k , with at most k internals node and k leaf-sets.

Lemma 7
Given a gene tree G ′ , Algorithm Algorithm Compressed Tree (G ′ ) returns a tree G k , with at most k internal nodes and k leaf-sets.
Proof First, consider the set of regular nodes of G k . Consider the set V k 1 of those nodes of G k that the algorithm defines because the subtree rooted at one of such nodes contains at least 8n / k unassigned leaves. It follows that at most k / 8 such nodes are chosen.
Consider the set V k 2 of nodes of G k defined as internal nodes because they are the least common ancestor of two internal nodes of V k 1 . Now, if we restrict G k to V k 1 ∪ V k 2 , we obtain a tree having at most k / 8 leaves, as the leaves by construction are only nodes in V k 1 , where each internal node, except for the root, has degree at least three. Hence |V k 2 | ≤ |V k 1 | ≤ k/8. Let v and z be two nodes in V k 1 ∪ V k 2 , such that z is an ancestor of v in G k , and there are no other ancestor of v in G k that belongs to V k 1 ∪ V k 2 . It follows that, by construction, at most one two-set internal node on the path between v and z is defined in G k . Hence at most two internal nodes are defined on the path between v and z in G k , and since |V k 1 ∪ V k 2 | ≤ k/4, it follows that G k contains at most k / 4 two-set internal nodes. Thus G k consists of at most k/4 + k/2 = (3/4)k internal nodes. Now, consider the defined leaf-sets. For each two-set internal node v 1 , v 2 , there exists at most two leaf-sets connected with one of v 1 , v 2 , hence at most k / 2 leafsets. For each of the k / 4 internal node v ∈ V k 1 ∪ V k 2 , the leaves assigned to leaf-set connected to v are at most two, as G ′ is binary. Hence there exists hence at most k / 2 leafsets connected to internal nodes of v ∈ V k 1 ∪ V k 2 . Hence, the number of leaf-set is bounded by k/2 + k/2 = k.
In order to prove that G k is a compressed tree, in addition to Lemma 7 we need the following result. Lemma 8 Given a gene tree G ′ and a species tree S, let G k be the tree computed by Algorithm Algorithm Compressed Tree (G ′ ). Given two distinct leaf-sets I u and I w of G k connected to the internal nodes z and v, such that z, v is not a two-set internal node, let l 1 ∈ L(I u ) and l 2 ∈ L(I w ). Let x k = lca G k (I u , I w ) and x = lca G ′ (l 1 , l 2 ).
Proof Let lca G k (I u , I w ) = x k . Assume that I u and I w are connected to the same internal node of G k (which must be x k ). Then when x k is defined by Algorithm Algorithm Compressed Tree (G ′ ), its event is the same as the corresponding node x of G ′ . Assume that I u and I w are connected to different internal nodes of G k , u k and w k , respectively, corresponding to node u and w of G ′ . Consider x = lca G ′ (u, w) then Algorithm Algorithm Compressed Tree (G ′ ) defines a corresponding node x k in G k such that ev G k (x k ) = ev G ′ (x). Assume that x k belongs to a two-set internal node z, v . Then, by construction, exactly one of I u , I w (w.l.o.g. I u ) must be a leaf-set which is a child of x k , and exactly one of I u , I w (w.l.o.g. I w ) is a leaf-set connected to a strict descendant c of x k , such that c � = z, v. Let y = lca G ′ (l 1 , l 2 ) , for a leaf l 1 in L(I u ) and a leaf l 2 in L(I w ). By construction, l 1 ∈ I u only if ev G k (x k ) = ev G ′ (y), thus concluding the proof.
Lemmas 7 and 8 implies that Algorithm Algorithm Compressed Tree (G ′ ) constructs a compressed gene tree G k , as by construction the leaf-sets induce a partition of Ŵ.
Next, we show a lower bound on the agreement value of an optimal assignment of leaves to the leaf-sets I v . We denote by A(G k , R) (the agreement between R and G k ) as the agreement for each pair of leaves l 1 , l 2 ∈ Ŵ that belong to two distinct leaf-sets I u and I w of G k connected to the internal nodes u and v, such that u, v is not a two-set internal node (notice that u and v may be the same node).

Lemma 9
Given an optimal solution G * of MaxEC over instance (R, S) and a constant k > 0, let G k be the compressed tree computed starting from G * . Then Proof Consider an optimal solution G * of MaxEC over instance (R, S) and the compressed tree G k constructed from G * . From Lemma 8, the pairs of leaves that belong to different leaf-sets (not connected to the same two-set internal node) have the same relations in G * and in G k .
Consider the leaves of a same leaf-set I v or of two leafsets I w and I u which are connected to the same two-set internal node. Since |I v | ≤ 8n k and |I w ∪ I u | ≤ 8n k , the number of relations between two leaves belonging to a common leaf-set is at most 64n 2 k 2 . Since there are at most k leaf-sets, the overall number of relations between pairs of leaves in G k with respect to G * are at most 64n 2 k , hence

The unlabeled compressed tree T k
The tree G k described above is of course not known, and it needs to be found. In this subsection we introduce the unlabeled compressed tree T k that is used to construct the compressed tree G k . An unlabeled compressed tree T k is a compressed tree whose leaf-sets are empty. Here we introduce some properties of T k and we reduce the MaxEC problem to a second problem, called MaxLA (to be defined later). The PTAS iterates through the possible unlabeled compressed trees T k . In particular, the PTAS iterates through (1) the structure of T k , (2) the events associated with internal nodes of T k , and (3) a set of labels that are allowed to be assigned to a leaf-set.
First, consider the structure of T k . Since by Lemma 7 G k consists of at most k internal nodes and k leaf-sets, it follows that there are at most 2 4k 2 possible topologies for the unlabeled compressed tree T k . Indeed, the adjacency matrix of T k has size 4k 2 , and the possible adjacency matrices are at most 2 4k 2 . Moreover, for each topology, we define in time O(2 k ) the two-set internal nodes of T k . Now, consider the events associated with the internal nodes of T k . For each unlabeled compressed tree T k , the events associated with the internal nodes of T k are at most 2 k (two possible cases, Dup or Spec, for each of the k internal nodes). Overall we iterate though O(2 4k 2 ) possible unlabeled compressed tree T k .
Consider now an unlabeled compressed tree T k . In order to ensure that the gene tree G ′ constructed from T k is S-consistent with the given species tree S, we must ensure that the speciation nodes of G ′ are consistent with S. We define a mapping s T k of the nodes of T k , except the leaf-nodes connected to two-set internal nodes, to the nodes of S so that the mapping is feasible, that is the following conditions hold: • if v is an ancestor of u in T k , then s T k (v) is an ancestor (not necessarily proper) of s T k (u) • if v is an ancestor of u in T k and ev T k (v) = Spec, then s T k (v) is a proper ancestor of s T k (u) Based on the mapping s T k, define for each leaf-set I v , the allowed set A(I v ) of labels that can be assigned to a leafset I v . If I v is a leaf-set not connected to a two-set internal node: If I v is a leaf-set connected to an internal node u, with u, w a two-set internal node (recall that ev T k (u) = Dup): If I v is a leaf-set connected to a two-set internal node u, with w, u a two-set internal node (recall that ev T k (u) = Spec), such that z is the only child of u in T k which is an internal node: Since T k contains at most 2k nodes, the set of the feasible mappings s T k are at most O(n 2k ). Moreover, once the mapping s T k is computed, A(I v ) can be computed in O(nk) time.
Finally, for each set leaf-set I v , we assign one leaf (denoted by P(I v )) of A(I v ) to I v , in time O(n k ). These leaves are called preassigned leaves and are assigned such that for each internal node x of T k , the lca mapping of the preassigned leaves maps x to a node y of S such  12:4 Similarly to the previous case if s G ′ (v ′ ) = s G ′ (z ′ ) or s G ′ (v ′ ) = s G ′ (q ′ ), then we claim that there exists a leaf l that is assigned to I w with l / ∈ A(I w ) for either I w = I z or for some leaf-set I w in G k q . In order to prove the claim, first notice that, by definition, the set A(I z ) contains only leaves of L(S x ) \ L(S y ), where x and y are the nodes of S where v and q are mapped by s G k. Therefore, if s G ′ (z ′ ) is not a proper descendant of x, there must be a leaf l / ∈ A(I z ) assigned to I z . Similarly, if s G ′ (q ′ ) is not a proper descendant of x, because s G k (q) = y is a proper descendant of x, there must be a leaf l assigned to I w in G k q such that l / ∈ A(I w ) (otherwise, q ′ would be mapped to y). We can conclude that the lemma holds.

Conclusion
We considered the minimization weighted and maximization unweighted variants of the problems of editing a relation graph for satisfiability and consistency. We provided complexity and algorithmic results for these variants. We showed that the problems that ask for the minimization of corrections on a weighted graph do not admit a constant factor approximation algorithm assuming the unique game conjecture and we gave an n-approximation algorithm, n being the number of vertices in the graph. We then provided polynomial time approximation schemes for the maximization variants of for unweighted graphs.
For future investigations, there are several interesting problems both from a theoretical and experimental point of view. First, from a theoretical point of view, it is open whether the minimization variant on unweighted graphs is approximable within constant factor or not. Moreover, another interesting direction would be to study whether it is possible to close the gap between the inapproximability result we have proved and the n-approximation algorithm.
From an experimental point of view, the main open problem is to test our approach to weighted graphs, and in particular to give a definition of weights that integrate those defined in different methods for orthology detection.