Computing well-covered vector spaces of graphs using modular decomposition

A graph is well-covered if all its maximal independent sets have the same cardinality. This concept was introduced by Plummer in 1970 and naturally generalizes to the weighted case. Given a graph G, a real-valued vertex weight function w is said to be a well-covered weighting of G if all its maximal independent sets are of the same weight with respect to w. The set of all well-covered weightings of a graph G forms a vector space over the field of real numbers, called the well-covered vector space of G. Since the problem of recognizing well-covered graphs is co\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textsf{co}$$\end{document}-NP\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textsf{NP}$$\end{document}-complete, the problem of computing the well-covered vector space of a given graph is co\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textsf{co}$$\end{document}-NP\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textsf{NP}$$\end{document}-hard. Levit and Tankus showed in 2015 that the problem admits a polynomial-time algorithm in the class of claw-free graphs. In this paper, we give two general reductions for the problem, one based on anti-neighborhoods and one based on modular decomposition, combined with Gaussian elimination. Building on these results, we develop a polynomial-time algorithm for computing the well-covered vector space of a given fork-free graph, generalizing the result of Levit and Tankus. Our approach implies a polynomial-time recognition algorithm for the class of well-covered fork-free graphs and also generalizes some known results on cographs.


Introduction
An independent set in a graph G is a set of pairwise nonadjacent vertices.An independent set in a graph G is said to be maximum if it has maximum cardinality and maximal if it is not contained in any larger independent set.The problem of finding a maximum independent set in a given graph, known as Maximum Independent Set, is one of the classical NP-hard problems [25].While every maximum independent set in a graph is also a maximal one, the opposite implication does not hold in general.If every maximal independent set in a graph G is also a maximum one, the graph G is said to be well-covered.Well-covered graphs were introduced by Plummer in 1970 [35] and have been extensively studied in the literature (see [23] for an introduction and [36] for a survey).One of the motivations for the study of well-covered graphs stems from the fact that Maximum Independent Set is solvable in linear time in the class of well-covered graphs by a simple greedy algorithm that computes a maximal independent set.
Two central research directions on well-covered graphs are the study of their recognition and their characterizations in special graph classes.As proved independently by Sankaranarayana and Stewart in 1992 [39] and by Chvátal and Slater in 1993 [14], the recognition of wellcovered graphs is co-NP-complete.In Plummer's survey from 1993 (see [36]) one can find results on various restrictions of the well-coveredeness property defining special subclasses of well-covered graphs, as well as an overview of the study of well-coveredeness versus the girth and the maximum degree.After Plummer's survey, the study of well-covered graphs focused mostly on the recognition problem in special cases.In particular, Caro, Sebő, and Tarsi showed that the recognition of well-covered graphs remains co-NP-complete even for K 1,4free graphs [11], Brown and Hoshino established co-NP-completeness for the class of circulant graphs [7], and a careful examination of the reduction due to Sankaranarayana and Stewart [39] shows that the problem remains co-NP-complete in the class of weakly chordal graphs, that is, graphs such that neither the graph nor its complement contain an induced cycle of length at least five.On the positive side, Tankus and Tarsi showed that the problem is polynomialtime solvable in the class of claw-free graphs (see [40,41]).The well-coveredness property can also be tested efficiently in the classes of bipartite graphs [19,38], graphs with girth at least 5 [20], graphs without cycles of lengths 4 and 5 [21], chordal graphs [37], graphs of bounded degree [10], perfect graphs with bounded clique number [16], various generalizations of the class of cographs [3,26], and graphs of bounded cliquewidth [2].The problem has also been studied from the parameterized complexity point of view, by Alves, Dabrowski, Faria, Klein, Sau, and Souza [2] and Araújo, Costa, Klein, Sampaio, and Souza [3].
In this paper we focus on a weighted generalization of well-coveredness.If every vertex of a graph G is assigned a real number, that is, the weight of a vertex, we speak about a weighted graph.Maximum Weight Independent Set is the problem of computing an independent set of maximum weight in a given weighted graph, where the weight of a set of vertices is defined as the sum of the weights of its members.Given a graph G and a weight function w : V (G) → R, a graph G is said to be w-well-covered if all maximal independent sets in G are of the same weight with respect to the weight function w.The concept of w-well-covered graphs was introduced by Caro, Ellingham, and Ramey in 1998 [10], in the more general context of weight functions mapping the vertices of a graph to the elements of an abelian group (see also [8]).Graphs that are w-well-covered with respect to some nonnegative weight function w : V (G) → R + that is not identically equal to 0 are exactly the complements of the so-called stochastic graphs studied already in 1983 by Berge [4], and generalize the equistable graphs introduced in 1980 by Payan [34] and defined as the graphs that admit a weight function w : V (G) → R + such that a set S ⊆ V (G) is a maximal independent set if and only if the total weight of S equals 1.
Given a graph G, a well-covered weighting of G is any real-valued weight function w on the vertices of G such that G is w-well-covered.For every graph G, the set WCW(G) of all well-covered weightings of G forms a vector space over the field of real numbers (see [8,12]); we refer to it as the well-covered vector space of G. Similar vector spaces can be defined for more general situations, for example for hypergraphs and for vertex weight functions that assign to each vertex of G a value from some fixed field F (see Caro and Yuster [12] and Brown and Nowakowski [8]).In this paper we restrict our attention to the case of graphs and the field of real numbers.Any system of equations representing the vector space WCW(G) will be referred to as a well-covering system of G. (Precise definitions will be given in Section 2.) We consider the following problem.

Our results and relation with existing works
In this paper, we give two general reductions for the Well-Covering System problem, one based on modular decomposition and one based on anti-neighborhoods.Building on these results, we develop a polynomial-time algorithm for solving the problem in the class of fork-free graphs, thereby generalizing the analogous result of Levit and Tankus on claw-free graphs [27].The algorithm decomposes a given fork-free graph G into a polynomial number of induced subgraphs of G and recursively computes a well-covering system for every graph H constructed at some step of the decomposition of G. To keep the well-covering systems polynomially bounded in size, Gaussian elimination is applied at each step.In the base case, when the subgraph H cannot be decomposed further, we use a structural result on fork-free graphs due to Lozin and Milanič [29,30] (see also [18]) to infer that H is claw-free; hence, in this case the algorithm of Levit and Tankus applies.
The class of fork-free graphs generalizes the class of cographs, hence our results generalize the result of Brown and Nowakowski [8] that the well-covered dimension of cographs can be computed in polynomial time.Furthermore, our reduction involving modular decomposition generalizes the analogous reduction for the (unweighted) well-covered graphs due to Klein, de Mello, and Morgana [26], who used modular and primeval decompositions to develop efficient algorithms for the problem of recognizing well-covered graphs in several extensions of the class of cographs.
Our main result, a polynomial-time algorithm for computing a well-covering system of a given fork-free graph, is another example of an application of the structural result from [29,30] relating fork-free graphs to claw-free graphs (the exact statement of the result is given in Theorem 6.3).This result was first used for developing a polynomial-time algorithm for Maximum Weight Independent Set in the class of fork-free graphs [29,30].More recently it has been used by Dyer, Martin, Jerrum, Müller, and Vušković [18] for developing a fully polynomial randomized approximation scheme (FPRAS) for the problem of counting all weighted independent sets in a (fork, odd hole)-free graph [18] and by Dębski, Lonc, Okrasa, Piecyk, and Rzążewski [17] for developing a polynomial-time algorithm for W 5 -Coloring (a certain homomorphism problem) in the class of fork-free graphs.

Structure of the paper
In Section 2 we collect the necessary definitions and preliminaries, including preliminaries on modular decomposition and precise definitions about well-covering systems.In Section 3 we show how to use modular decomposition, combined with Gaussian elimination, to reduce the problem of computing a well-covering system of a graph to the same problem on certain prime induced subgraphs of the graph.In Section 4 we develop an algorithm for computing a well-covering system of a given cograph that is faster than the algorithm following from the main result of Section 3. In Section 5 we show how to reduce the problem of computing a well-covering system of a graph to the same problem on the subgraphs of a given graph obtained by deleting the closed neighborhood of some vertex.In Section 6 we apply the results from Sections 3 and 5 to develop a polynomial-time algorithm for computing a wellcovering system of a given fork-free graph.We conclude the paper with a summary and some open problems in Section 7.

Preliminaries
Given a positive integer n, we denote by [n] the set {1, . . ., n} (and [0] := ∅).All graphs in this paper are finite, simple, and undirected.Given a graph G, we denote by V (G) the vertex set of G and by E(G) the edge set of G. Two vertices u and v are adjacent in For integers m, n ≥ 0 we denote by K m,n the complete bipartite graph with parts of sizes m and n, that is, the graph whose vertices can be partitioned into two independent sets A and B, such that |A| = m, |B| = n, and A and B are complete to each other.A claw is the graph K 1,3 .A fork is the graph obtained from a claw by a single subdivision of one of its edges, that is, the graph with vertex set {v 1 , v 2 , v 3 , v 3 , v 5 } and edge set {v 1 v 2 , v 2 v 3 , v 3 v 4 , v 3 v 5 }.By P n we denote the n-vertex path graph, that is, a graph whose vertices can be linearly ordered so that two vertices are adjacent if and only if they appear consecutively in the ordering.Given two graphs G and H, the graph G is said to be H-free if it contains no induced subgraph isomorphic to H.
A rooted tree is a pair (T, r) where T is a tree and r ∈ V (T ) is the root of T .Given two nodes u and v in a rooted tree T , we say that v is a child (or successor ) of u if uv ∈ E(T ) and u belongs to the unique v, r-path in T .A leaf of a rooted tree T is a node without any successors, while an internal node of T is a node that is not a leaf.Note that if T is a one-vertex rooted tree, then the unique vertex in T is both the root and a leaf of T , but it is not an internal node.Given a rooted tree T , we denote by ℓ(T ) the number of leaves of T and by i(T ) = |V (T )| − ℓ(T ) the number of internal nodes of T .We will need the following well-known property of rooted trees.To keep the paper self-contained, we include a proof.Lemma 2.1.Let T be a tree in which each internal node has at least two successors.Then ℓ(T ) ≥ i(T ) + 1.

Proof. By induction on i(T ).
If i(T ) = 0, then the unique vertex in T is a leaf and the inequality holds.Let now T be a tree with i(T ) ≥ 1 such that each internal node of T has at least two successors, and assume that every tree T ′ with i(T ′ ) < i(T ) in which each internal node has at least two successors satisfies that ℓ(T ′ ) ≥ i(T ′ ) + 1.Let r be the root of T and let d be the number of successors of r.Since i(T ) ≥ 1, the root of T is an internal node.Hence d ≥ 2. Let T 1 , . . ., T d be the rooted trees obtained by the deletion of r from T , where for each j ∈ [r], the root of T j is the unique successor of r in T j .Then for all j ∈ [r] we have that i(T j ) < i(T ), and by the induction hypothesis every T j satisfies that ℓ(T j ) ≥ i(T j ) + 1. Observe that every internal node of T j , j ∈ [d], is also internal in T , and node r is internal in T as well, so we have i(T Corollary 2.2.Let T be a tree in which each internal node has at least two successors.Then

Modular decomposition
Given a graph G and a nonempty set M ⊆ V (G), we say that M is a module in G if every vertex not in M is either adjacent to all vertices in M or to none of them.If M 1 and M 2 are two disjoint modules in a graph G, then either G contains all possible edges between M 1 and M 2 in G, or none of them.A module M is maximal if M ⊂ V (G) and there is no module M ′ in G with M ⊂ M ′ ⊂ V (G).If G and its complement are both connected, then any two maximal modules in G are disjoint; in particular, the set of maximal modules of G forms a partition of V (G).A module M of a graph G is said to be strong if for every other module Every graph with at least two vertices has a unique partition of its vertex set into maximal strong modules (see, e.g., [22]).If G is disconnected, then the partition is given by the vertex sets of its components; if the complement of G is disconnected, then the partition is given by the vertex sets of its co-components.The representative graph R(G) of G is any induced subgraph of G obtained by taking an arbitrary but fixed vertex from each maximal strong module of G.Note that the representative graph of G depends on how the vertices from the maximal strong modules are chosen; however, any two such graphs are isomorphic to each other, which explains the notation R(G).The representative graph of G is a special case of the following more general construction.Given a graph G and an arbitrary partition P = {M 1 , . . ., M k } of V (G) into modules of G, we denote by G/P the corresponding quotient graph, which is the induced subgraph of G obtained by taking one vertex from each module M j ∈ P.
Partitioning the vertex set of a graph G recursively into maximal strong modules leads to the so-called modular decomposition of G, represented with the so-called modular decomposition tree.This is a rooted tree T G such that every node of T G is labeled with an induced subgraph H t of G, and every internal node of T G is of one of the types parallel, series, or prime.The tree T G is defined recursively as follows.
• If G is the one-vertex graph, then T G has one node t, labeled with H t = G, and t is the root of T G .
• Otherwise, T G is the rooted tree obtained by creating a root node r, labeling the root by the representative graph of G (that is, setting H r = R(G)), and joining the root r with edges to the roots of the modular decomposition trees T 1 , . . ., T k of the subgraphs of G induced by the maximal strong modules M 1 , . . ., M k of G.The root node of G is of type parallel if G is disconnected, series if the complement of G is disconnected, and prime if both G and its complement are connected.Each internal node t of T G with t = r belongs to a unique tree T i and its type in T G is the same as in T i .
Given a graph G, the modular decomposition tree T G of G can be computed in linear time (see [32,42]).By construction, for every node t ∈ V (T G ), the subtree of T G rooted at t is the modular decomposition tree of the subgraph G t of G induced by the vertices appearing in the one-vertex subgraphs labeling the leaves of this subtree.Furthermore, if the node t is of type prime, then the graph H t labeling the node is a prime graph.

Well-covering systems
A weighted graph is a pair (G, w) where G is a graph and w ∈ R V (G) , that is, w : V (G) → R is a real-valued vertex weight function.Given a weighted graph (G, w) and a set S ⊆ V (G), the weight of S (with respect to w) is defined as we denote by w S the restriction of w to S, that is, the function w S : S → R defined by setting w S (v) = w(v) for all v ∈ S. Given a weighted graph (G, w), we say that w is a well-covered weighting of G and that G is w-well-covered if all maximal independent sets in G have the same weight with respect to w, that is, for every two maximal independent sets I and I ′ in G, we have w(I) = w(I ′ ).Recall that for every graph G, the set WCW(G) of all well-covered weightings of G forms a vector space over the field of real numbers, called the well-covered vector space of G. Since we only work with finite graphs, the well-covered vector space WCW(G) is always finite-dimensional and thus has a finite basis (an inclusion-wise maximal linearly independent set of vectors); furthermore, all bases of WCW(G) have the same cardinality, which is referred to as the wellcovered dimension of G. Clearly, for every graph G, its well-covered dimension is an integer between 0 and |V (G)|.
Well-covered vector spaces of graphs can also be represented using systems of linear equations.Let G be a graph with n vertices.Fix an arbitrary ordering v 1 , . . ., v n of the vertices of G and an arbitrary ordering I 1 , . . ., I k of all maximal independent sets in G.By definition, a weight function w : V (G) → R is a well-covered weighting of G if and only if w satisfies the following system of k 2 equations: To distinguish between vectors of abstract variables of a system and vectors of their concrete real values, we use the following convention throughout the paper.To each vertex v ∈ V (G) we associate a variable x v , and write the systems of equations using such variable names.For example, following this convention, the system (1) corresponds to the following homogeneous linear system over the set of variables {x v : v ∈ V (G)}: This system can be compactly represented with a single matrix equation where r = k 2 , A ∈ R r×n is the coefficient matrix, and the right-hand side 0 r is the all-zero vector in R r .Thus, a column vector w = (w(v 1 ), . . ., w(v n )) ⊤ ∈ R n belongs to the well-covered vector space WCW(G) if and only if Aw = 0 r .
There are many ways to represent the well-covered vector space of a given graph G with a linear system.For example, a system equivalent to (2) with k − 1 equations can be obtained by requiring that all maximal independents sets have the same weight as an arbitrary but fixed maximal independent set, say I k : Another equivalent system, also with k − 1 equations, is the following: A well-covering system of G is any system S of linear homogeneous equations over a set {x v : v ∈ V (G)} of variables indexed by the vertices of G such that a column vector w = (w(v 1 ), . . ., w(v n )) ⊤ ∈ R n belongs to the well-covered vector space WCW(G) if and only if it satisfies all the equations of the system.Given a well-covering system S of G, we denote by |S| the size of S, that is, the number of equations in S. As shown by systems ( 2) and ( 3), the same graph can admit well-covering systems of different sizes.
We will soon illustrate these concepts with a concrete example, but first let us discuss two important remarks about properties of well-covering systems.
A remark on the size of well-covering systems.The number of maximal independent sets in an n-vertex graph can be exponential in n. 1 However, using Gaussian elimination it can be shown that any well-covering system of an n-vertex graph admits a well-covering subsystem of size at most n (see Lemma 2.4).
Consider an arbitrary well-covering system S of an n-vertex graph G and let r be the size of S. Fix an arbitrary ordering of the vertices of G and an arbitrary ordering of the equations in S. Let A ∈ R r×n be the coefficient matrix of S. We say that a well-covering system S is linearly independent if the rows of the corresponding matrix A are linearly independent over the field of real numbers.In this case, the r rows of A form a basis of the orthogonal complement of the vector space WCW(G), and hence by standard linear algebra we have r + wcdim(G) = n.In particular, in this case we have r ≤ n, and equality holds if and only if wcdim(G) = 0, that is, the all-zero weighting is the only well-covered weighting of G.
A remark on the coefficients of well-covering systems.Since we consider the wellcovered vector space WCW(G) of a graph G as a vector space over the field of real numbers, any well-covering system of G consists of linear equations involving real numbers as coefficients.However, it often suffices to work with well-covering systems whose coefficients belong to a particular subset of the set of real numbers.We say that a well-covering system is unit if the matrix of the system has all the coefficients in the set {−1, 0, 1}, integer if the system consists of linear equations involving only integer coefficients, and rational if it consists of linear equations involving only rational coefficients.Note that systems (2), (3), and ( 4) are all unit.Furthermore, the well-covering systems of fork-free graphs constructed by the algorithm given by our main result (Theorem 6.5) are also unit.
Example 2.3.Let G be the bull graph, that is, the graph obtained from the 5-vertex path with vertices v 1 , . . ., v 5 in order along the path by adding to it the edge v 2 v 4 .Then G has exactly three maximal independent sets: Any well-covered weighting w of G must satisfy that w(I 1 ) = w(I 2 ) = w(I 3 ), or equivalently, w(I 1 ) − w(I 3 ) = 0 and w(I 2 ) − w(I 3 ) = 0.This yields the following linearly independent unit well-covering system S of G with size r = 2: Using this system of equations we can easily determine for any weighting w of G whether it is well-covered weighting or not.For example, letting it can be easily verified that each w = (w(v 1 ), . . ., w(v 5 )) ⊤ ∈ B satisfies both equations in S and thus belongs to the space WCW(G).Furthermore, since the two rows of the coefficient matrix of the system S, that is, (0, 0, −1, 1, −1) and (−1, 1, −1, 0, 0), form a basis of the orthogonal complement of the well-covered vector space, it follows that the well-covered dimension of the space WCW(G) equals |V (G)| − r = 3.Thus, since the vectors in the set B are linearly independent, we infer that B is a basis of the well-covered vector space WCW(G).
In some of our results, including the reduction based on modular decomposition (Theorem 3.6), the following lemma based on Gaussian elimination will be useful.We denote by ω < 2.373 the matrix multiplication exponent (see, e.g., [1]).Proof.Let r = | S|.If r ≤ n, we are done, so assume r > n.Fix an arbitrary ordering of the vertices of G and an arbitrary ordering of the equations in S. Let A ∈ Q r×n be the corresponding matrix and let A ⊤ be its transpose.Using Gaussian elimination, we compute a basis B of A ⊤ that is a maximal linearly independent subset of columns of A ⊤ .This can be done in time O(rn ω−1 ) (see [13]).Note that the vectors in B correspond to certain equations in S. Let S ⊆ S consist of equations corresponding to the vectors in B. Then S is a linearly independent well-covering system of G, and clearly |S| ≤ min{n, r}.Since ω ≥ 2 and the matrix A and its transpose can be computed in time O(rn), the algorithm runs in time O(rn ω−1 ).

Reduction to prime induced subgraphs
In this section we explain how to efficiently compute a well-covering system of a graph from well-covering systems of its maximal strong modules and of the representative graph.Then we combine this result with modular decomposition and Gaussian elimination to reduce the problem of computing a well-covering system of a graph to the same problem on certain prime induced subgraphs of the graph.
We start with a basic lemma characterizing the family of maximal independent sets in a graph G whose vertex set is equipped with an arbitrary partition into modules.Lemma 3.1.Let G be a graph, let P = {M 1 , . . ., M k } be an arbitrary partition of V (G) into modules, and let G ′ = G/P be the corresponding quotient graph, with Proof.First we show that the stated conditions are necessary.Let X ⊆ V (G) be a maximal independent set in G. Consider an arbitrary j ∈ [k] such that X ∩ M j = ∅.We want to prove that X ∩ M j is a maximal independent set in G[M j ].Since this set is a subset of X, it is an independent set in G and hence also in G[M j ].We have to prove that it is a maximal one.Suppose for a contradiction that this is not the case, and let x ∈ M j \ X satisfy that (X ∩ M j ) ∪ {x} is an independent set in G[M j ].Then x has no neighbors in X ∩ M j .Since X ∩ M j = ∅, there exists a vertex y ∈ S ∩ M j .Note that x and y are in the same module M j , so they have the same neighborhood outside M j in G.In particular, this implies that where the second equality follows from the fact that y ∈ X and X is independent in G.We already know that x has no neighbors in X ∩ M j , so it follows that x has no neighbors in the set X at all.This implies that X ∪ {x} is the independent set in G, a contradiction with the maximality of X in G. Hence, condition i) holds.
Next we show condition ii), that is, that the set Vertices in X are pairwise nonadjacent, so the modules M j , j ∈ J, that contain vertices from X are anticomplete to each other in G.By construction of the graph G ′ it follows that the corresponding vertices v j , j ∈ J, are pairwise nonadjacent in G ′ , hence X ′ is an independent set in G ′ .It remains to prove maximality.Suppose for a contradiction that there is a vertex ∈ S ′ , it follows that ℓ / ∈ J and thus X ∩ M ℓ = ∅.However, since X ′ ∪ {v ℓ } is an independent set in G ′ , for all j ∈ J we have that v ℓ / ∈ N G ′ (v j ), and it follows that modules M ℓ and M j are anticomplete to each other in G. Thus we can enlarge the independent set X in G by adding to it any vertex from M j .This contradicts the fact that X is a maximal independent set in G.
The two conditions are also sufficient.Let X ⊆ V (G) and assume that conditions i) and ii) from the lemma hold.We will prove that X is a maximal independent set in G.
. By condition i) we have that for all j ∈ J the set X ∩ M j ⊆ M j is independent in G j and hence in G.By condition ii) we have that the set X ′ = {v j ∈ V (G ′ ) : j ∈ J} is an independent set in G ′ .It follows that all the modules M j , j ∈ J, are pairwise anticomplete.Hence the set X = j∈J (X ∩ M j ) is independent in G.It remains to show maximality.Suppose for a contradiction that there exists a vertex v ∈ V (G) \ X such that the set X ∪ {v} is independent in G. Let ℓ ∈ [k] such that v ∈ M ℓ .Then (X ∪ {v}) ∩ M ℓ is an independent set in G ℓ , which implies that the set X ∩ M ℓ is not a maximal independent set in G ℓ .By condition i) it follows that X ∩ M ℓ = ∅ and thus ℓ / ∈ J. Since the set X ∪ {v} is independent in G, the vertex v has no neighbors in the set X = j∈J (X ∩ M j ).As all the sets M j are modules in G, this implies that v has no neighbors in the set j∈J M j .Consequently, the vertex v ℓ corresponding to the module M ℓ in G ′ has no neighbors in the set this is a contradiction with the maximality of X ′ , which is given by condition ii).This shows that the set X is a maximal independent set in G.
We now use Lemma 3.1 to show how to efficiently compute a well-covering system of a graph from well-covering systems of its maximal strong modules and of the representative graph.We state the result more generally, for any graph equipped with a partition of the vertex set into modules, since we will later apply this result to various scenarios depending on whether the graph is disconnected (in which case the modules are the vertex sets of its connected components), the complement of the graph is disconnected (in which case the modules are the vertex sets of its co-components), or the graph and its complement are both connected.Lemma 3.2.Let G be a graph, let P = {M 1 , . . ., M k } be an arbitrary partition of V (G) into modules, and let G ′ = G/P be the corresponding quotient graph, with V (G ′ ) = {v 1 , . . ., v k } where v j ∈ M j for all j ∈ [k].Let S j be a well-covering system for G[M j ] for all j ∈ [k] and let S ′ be a well-covering system of G ′ .Let I = {I j : j ∈ [k]} be an arbitrary but fixed collection of maximal independent sets I j in G[M j ] for all j ∈ [k].For each equation s ∈ S ′ , let us denote by ρ I (s) the equation indexed by the vertices of G obtained from s by iterating over all vertices v j of G ′ and substituting the variable x v j corresponding to the vertex v j with the sum v∈I j x v (in particular, the variables corresponding to vertices v of G that do not belong to the union j∈[k] I j appear with zero coefficient).Then is a well-covering system of G. Furthermore, if the systems S 1 , . . ., S k and S ′ are all rational (resp.integer or unit), then so is S.
The proof of the lemma will be based on the following observation.
Claim.Let w be a vertex weight function on G, and let w ′ : V (G ′ ) → R be defined as Then G is w-well-covered if and only if G ′ is w ′ -well-covered and for all j ∈ [k], the graph G j is w j -well-covered.
Let us first show that the claim implies the lemma.We show that the proposed system of equations S given by ( 5) is a well-covering system of G by showing that, for any vertex weight function w on G, it holds that w is a well-covered weighting of G if and only if w satisfies all the equations of the system.Assume first that w is a well-covered weighting of G.Then, by the claim G ′ is w ′ -well-covered and for all j ∈ [k], the graph G j is w jwell-covered.Since G ′ is w ′ -well-covered, w ′ is a solution of the system of equations S ′ .Consider an arbitrary equation s ∈ S ′ .Then there exist real numbers a v j , j ∈ [k], such that s equals the equation k j=1 a v j x v j = 0. Hence, the equation ρ I (s) is equivalent to the equation k j=1 a v j v∈I j x v = 0. Since setting x v j = v∈I j w(v) for all v j ∈ V (G ′ ) results in a solution of the equation s, we infer that setting x v = w(v) for all v ∈ V (G) results in a solution of the equation ρ I (s).Similarly, for each j ∈ [k], setting x v = w j (v) = w(v) for all v ∈ V (G j ) yields a solution of the system of equations S j .It follows that setting x v = w(v) for all v ∈ V (G) results in a solution of the system of equations k j=1 S j and thus of the entire system of equations (5).Similar arguments show that if w is a solution of the system of equations ( 5), then w is a well-covered weighting of G.The last statement of the lemma, that the system S is rational (resp.integer or unit) whenever this is the case for the systems S 1 , . . ., S k and S ′ , is straightforward.Now we show the claim.Assume that G is w-well-covered.First we show that G ′ is w ′well-covered.Let I and I ′ be two maximal independent sets in G ′ .Let J = {j ∈ [k] : v j ∈ I} and J ′ = {j ∈ [k] : v j ∈ I ′ } be the corresponding index sets.By Lemma 3.1, the sets j∈J I j and i∈J ′ I j are maximal independent sets in G. Since G is w-well-covered, it follows that w j∈J I j = w i∈J ′ I j .Furthermore, we have Altogether, the above equations imply that w ′ (I) = w ′ (I ′ ) and since I and I ′ were arbitrary maximal independent sets in G ′ , it follows that G ′ is w ′ -well-covered.
Next, we show that for all j ∈ [k], the graph G j is w j -well-covered.Let I and I ′ be arbitrary maximal independent sets in G j , and let S be a maximal independent set in G ′ such that v j ∈ S. Let also X = {I ℓ : v ℓ ∈ S \ {v j }}.By Lemma 3.1, the sets I ∪ X and I ′ ∪ X are maximal independent sets in G. Since G is w-well-covered, we have that w(I ∪X) = w(I ′ ∪X), and consequently Since I and I ′ were arbitrary maximal independent sets in G j , we infer that G j is w j -wellcovered.
For the proof of the other direction, assume that G ′ is w ′ -well-covered and that G j is w j -well-covered for all j ∈ [k].We want to show that G is w-well-covered.Let I and I ′ be maximal independent sets in G, and let J, J ′ ⊆ [k] be defined as and for all j ∈ J (resp.j ∈ J ′ ), the set I ∩ M j (resp.I ′ ∩ M j ) is a maximal independent set in G j .Since for all j ∈ [k] we have that G j is w j -well-covered, it follows that w(I ∩ M j ) = w j (I ∩ M j ) = w j (I j ) = w(I j ) = w ′ (v j ) for all j ∈ J and similarly w(I ′ ∩ M j ) = w j (I ′ ∩ M j ) = w j (I j ) = w(I j ) = w ′ (v j ) for all j ∈ J ′ .Thus, we have that w(I) = j∈J w(I ∩ M j ) = j∈J w ′ (v j ) = w ′ (S) and w(I ′ ) = j∈J ′ w(I ′ ∩ M j ) = j∈J ′ w ′ (v j ) = w ′ (S ′ ).Since G ′ is w ′ -well-covered, it follows that w ′ (S) = w ′ (S ′ ) and consequently w(I) = w(I ′ ), as we wanted to show.The sets I and I ′ were arbitrary maximal independent sets in G, hence it follows that G is w-well-covered.
We now apply Lemma 3.2 to three different cases: when G is disconnected, when the complement of G is disconnected, and when both G and its complement are connected.Corollary 3.3.Let G be a disconnected graph, with connected components G 1 , . . ., G k for some k ≥ 2, and let S j be a well-covering system of G j for all j ∈ [k].Then S = k j=1 S j is a well-covering system of G that can be computed in time O k j=1 |S j | .Furthermore, if the systems S 1 , . . ., S k are all rational (resp.integer or unit), then so is S.
Proof.Let G be a graph with connected components G 1 , . . ., G k .
Then P = {V (G 1 ), . . ., V (G k )} is a partition of V (G) into modules, and the corresponding quotient graph G ′ = G/P is the edgeless graph with k vertices.This implies that V (G ′ ) is the only maximal independent set in G ′ and hence S ′ = ∅ is a well-covering system of G ′ .By Lemma 3.2, it follows that the set k j=1 S j is a well-covering system of G.This system can be computed in time O k j=1 |S j | .Corollary 3.3 implies the fact that the well-covered dimension of a graph is the sum of the well-covered dimensions of its connected components (see [8]).
Corollary 3.4.Let G be a graph with disconnected complement, with co-components G 1 , . . ., G k , for some k ≥ 2, and let S j be a well-covering system of G j for all j ∈ [k].Let I j be a maximal independent set in G j for j ∈  is a well-covering system of G.In particular, given G, G 1 , . . ., G k , and S 1 , . . ., S k as above, a well-covering system of G with size . Furthermore, if the systems S 1 , . . ., S k are all rational (resp.integer or unit), then so is S.
Proof.Let G be a graph with co-components G 1 , . . ., G k .Then P = {V (G 1 ), . . ., V (G k )} is a partition of V (G) into modules, and the corresponding quotient graph G ′ = G/P is the complete graph on k vertices.Let V (G ′ ) = {v 1 , . . ., v k }.Since G ′ is complete graph, the maximal independent sets in G ′ are exactly the singletons {v j } for j ∈ We follow the notation from Lemma 3.2 and for each s ∈ S ′ denote by ρ I (s) the equation indexed by the vertices of G obtained from s by replacing each variable x v j corresponding to a vertex v j of G ′ with the sum v∈I j x v .By Lemma 3.2 it follows that k j=1 S j ∪ ρ I (s) : s ∈ S ′ is a well-covering system of G. Thus, the set ρ I (s) : s ∈ S ′ is equivalent to the set is a well-covering system of G, as claimed.Furthermore, this system is integer, resp.unit, if the systems S 1 , . . ., S k are integer, resp.unit.
It remains to justify the time complexity.First, we compute for all j ∈ [k] a maximal independent set I j in the graph G j .This can be done using a straightforward greedy algorithm in time We compute the system of equations k j=1 S j in time O( k j=1 |S j |) and the system of equations In the case when the graph and its complement are both connected, the corresponding algorithmic consequence of Lemma 3.2 is as follows.
Corollary 3.5.Let G = (V, E) be a connected and co-connected graph, let {M 1 , . . ., M k } be the partition of V (G) into maximal strong modules, and let G ′ be the representative graph of G. Let I j be a maximal independent set in the graph G[M j ], let S j be a well-covering system for G[M j ] for all j ∈ [k], and let S ′ be a well-covering system of G ′ .Then a well-covering system S of G with size k j=1 Furthermore, if the systems S 1 , . . ., S k and S ′ are all rational (resp.integer or unit), then so is S.
Proof.Let I = {I j : j ∈ [k]}.Using the notation of Lemma 3.2, the lemma implies that it suffices to compute the system of equations S = k j=1 S j ∪ ρ I (s) : s ∈ S ′ .This can be done in time We now prove the main result of this section, a reduction of the problem of computing a well-covering system of a graph to the same problem on certain prime induced subgraphs of the graph.We say that a function f : R holds for all x 1 , y 1 , x 2 , y 2 ∈ R + .Note that every superadditive function is nondecreasing.Theorem 3.6.Let G be a class of graphs and G * the class of all prime induced subgraphs of graphs in G. Assume that for each graph G in G * with n vertices and m ≥ 1 edges one can compute in time f (n, m) a rational (resp.integer or unit) well-covering system of G with size at most n, where f is a superadditive function.Then for any graph G in G with n vertices and m edges, one can compute in time O f (2n, m) + n ω+1 a rational (resp.integer or unit) well-covering system of G with size at most n.
Proof.Let G be a graph in G with n vertices and m edges.Let T G be the modular decomposition tree of G.This tree can be computed in time O(n + m) [32,42].Recall that for a node t of T G , we denote by G t the subgraph of G induced by the vertices appearing in the one-vertex subgraphs labeling the leaves of the subtree of T G rooted at t.
We traverse the tree T G bottom-up and for each node t ∈ V (T G ) we recursively compute a maximal independent set I t in G t and a well-covering system S t of G t with size at most n t .It is important to note that we do not store a complete representation of the graph G t via adjacency lists, as that would additionally increase the time and space complexity of the procedure.The ordering in which the nodes of tree T G are traversed can be computed in time O(|V (T G )|) = O(n + m), for example, by reversing the ordering in which the nodes of T G are visited by a breadth-first search from the root node.For each node t of T G , we denote by C t the set of all children of t in T G .
Assume first that t is a leaf node (that is, C t = ∅).Then V (G t ) = {v t } where v t is the vertex of G labeling t; in particular, n t = 1.Hence, I t = V (G t ) is the only maximal independent set in G t and S t = ∅ is a well-covering system of G t that trivially satisfies the inequality |S t | ≤ n t .Both I t and S t can be computed in constant time.
Assume now that t is an internal node in T G .Then t is one of the types parallel, series, or prime.Since the subtrees of T G rooted at the children of t are the modular decomposition trees of the subgraphs of G t induced by its maximal strong modules, which form a partition of V (G t ), it follows that n t = u∈Ct n u .For each child u of t we have already computed a maximal independent set I u in G u and a well-covering system S u of G u with size at most n u .We explain how to efficiently combine these into a maximal independent set I t in G t and a well-covering system S t of G t with size at most n t for each of the three cases separately.
• If t is of type parallel, then G t is a disconnected graph, with connected components G u , u ∈ C t .We can thus take I t = u∈Ct I u and by Corollary 3.3, S t = u∈Ct S u .We have Furthermore, by Corollary 3.3 the well-covering system S t of G t can be computed in time We select an arbitrary u ∈ C t and set I t = I u .Furthermore, we fix an arbitrary ordering u 1 , . . ., u p of the set C t and set By Corollary 3.4, S t is a well-covering system of G t that can be computed in time The size of S t is bounded as follows: Furthermore, Lemma 2.4 implies that a well-covering system S t ⊆ S t of G t such that Altogether, this implies that the independent set I t and a well-covering system S t of G t with size at most n t at the series node t can be computed in time • Consider now the case when the node t is of type prime.In this case, the graph H t labeling the node t is a prime induced subgraph of G t and hence of G.Each child u of t in T G corresponds to a unique maximal strong module M u of G.The graph H t is the representative graph of G t , hence it contains a unique vertex v u from each maximal strong module M u of G t .
Since H t is a prime induced subgraph of G, it belongs to G * and hence, a well-covering system S ′ of H t with size at most The total time complexity of computing S t at the node t is while the independent set Thus, the total time complexity at the prime node It remains to sum up the time complexities over all nodes of T G .We compute separately the sum over all leaves of T G and over all internal nodes of T G .Let us denote by L the set of all leaves of T G .Recall that by the definition of a modular decomposition tree, the leaves of T G are in a bijective correspondence with the vertices of G, and thus |L| = n.By Lemma 2.1 it follows that the number of internal nodes of T G is at most n−1.Note also that for each internal node t, the number of vertices of H t equals the number of children of t in T G , which implies that the total number of vertices of the graphs H t , summed up over all internal nodes t, equals the number of edges of T G , which is at most Furthermore, for each internal node t, the edges of H t correspond to distinct edges of G (joining two vertices of G t from distinct maximal strong modules), and no two edges from representative graphs of two different internal nodes correspond to the same edge of G.This implies that the total number of edges of the graphs H t , summed up over all internal nodes t, is at most m.
We already saw that in each leaf t of T G the algorithm computes the independent set I t and the well-covering system S t in constant time.Hence, summing over all leaves of T G we obtain the time complexity of O(n).If t is an internal node, then the algorithm computes I t and S t in time The sum of time complexities over all the internal nodes of T G can thus be bounded as follows.
where the first equality holds since f is a superadditive function and the last one since and f is nondecreasing.Since the time complexity over all leaves of T G is O(n), the total time complexity over all nodes in T G is equal to O f (2n, m) + n ω+1 .Finally, recall that the algorithm first needs O(n + m) time to compute the modular decomposition tree T G and an ordering in which the nodes of T G are visited.Thus, altogether, the algorithm runs in time Remark 3.7.One of the assumptions in Theorem 3.6 is that for each graph G in G * with n vertices and m edges one can compute in time f (n, m) a well-covering system of G with size at most n.If instead, only an algorithm is available for computing an arbitrary rational (resp.integer or unit) well-covering system of G ∈ G * in time f (n, m) (that is, without a bound of n on the size of the system), then one can first combine such an algorithm with Lemma 2.4.This would result in an algorithm that, given a graph G from G with n vertices and m edges, in time O f (2n, m) • n ω−1 + n ω+1 computes a rational (resp.integer or unit) well-covering system of G with size at most n.

Cographs
The proof of Theorem 3.6 relies on Gaussian elimination.If the input graph possesses some additional combinatorial structure, the use of Gaussian elimination may be avoided, and this can lead to faster algorithms.As we show in this section, this is the case for the class of cographs.Cographs are defined as graphs that can be constructed starting from copies of the one-vertex graph using the operations of disjoint union and complementation (see, e.g., [6]).Thus, the only prime cograph is the one-vertex graph, and the modular decomposition tree of a cograph contains only parallel and series nodes.
Cographs are known to be exactly the P 4 -free graphs, that is, graphs that contain no 4vertex path as an induced subgraph (see, e.g., [15]).In particular, every cograph is fork-free.Therefore, it follows from Theorem 3.6 that a well-covering system of a given cograph G with n vertices and m edges can be computed in time O(n ω+1 ).We improve this time complexity as follows.Proof.Let G be a cograph with n vertices and m edges.Let T G be the modular decomposition tree of G.As before, given a node t ∈ V (T G ), we denote by G t the subgraph of G induced by the vertices appearing in the one-vertex subgraphs labeling the leaves of the subtree of T G rooted at t. Let n t = |V (G t )| and m t = |E(G t )|.Since G is a cograph, every internal node of T G is of type either parallel or series.We traverse the tree T G bottom-up and for each node t ∈ V (T G ) we recursively compute a maximal independent set I t in G t and a well-covering system S t of G t with size at most n t − 1.For each node t of T G , we denote by C t the set of all children of t in T G .
If t is a leaf node (that is, C t = ∅), then I t = V (G t ) is a maximal independent set of G t and S t = ∅ is a well-covering system of G t , with size 0 = n t − 1.Both I t and S t can be computed in constant time.If t is an internal node in T G , then t is of type either parallel or series.For each child u of t we have already computed a maximal independent set I u in G u and a well-covering system S u of G u with size at most n u − 1.We explain how to efficiently combine these into a maximal independent set I t in G t and a well-covering system S t of G t with size at most n t − 1 for both cases.If t is of type parallel, then G t is a disconnected graph, with connected components G u , u ∈ C t .We can thus take I t = u∈Ct I u and by Corollary 3.3, S t = u∈Ct S u .We have Furthermore, by Corollary 3.3 the well-covering system S t of G t can be computed in time , the total time complexity at the parallel node t is O(n t + m t ).If t is of type series, then the complement of G t is disconnected, with co-components G u , u ∈ C t .We fix an arbitrary ordering u 1 , . . ., u p of the set C t of children of t and obtain the new maximal independent set I t and a well-covering system S t by setting I t = I u 1 and By Corollary 3.4, the system S t is indeed a well-covering system of G t and can be computed The size of S t is bounded as follows: Altogether, this implies that the independent set I t and a well-covering system S t of G t with size at most n t − 1 at the series node t can be computed in time O(n t + m t ).
Note that all the well-covering systems computed by the algorithm are integer.It remains to estimate the time complexity of the algorithm.The tree T G can be computed in time O(n + m) [32,42], and in the same time we can compute an ordering in which the nodes of tree T G are traversed.Recall that the number of leaves of T G is equal to n, while from Lemma 2.1 it follows that the number of internal nodes of T G is at most n−1.We already saw that in each leaf t of T G the algorithm spends only constant time, while in each internal node t of T G the independent set I t and a well-covering system S t of G t can be computed in time O(n t + m t ).Summing over all nodes of T G we get the time complexity O(n+(n−1)•(n+m)) = O(n(n+m)).We infer that the total time complexity of the algorithm is O(n(n + m)).
Let us mention two consequences of Theorem 4.1.First, applying the theorem to a given n-vertex cograph G, we obtain in polynomial time an integer well-covering system S with size at most n − 1.Using Gaussian elimination (cf.Lemma 2.4), we can then compute in time O(n ω ) a linearly independent well-covering subsystem S ⊆ S of G. Consequently, we can compute the well-covered dimension of G as the difference n − |S|.This implies a result of Brown and Nowakowski [8] that the well-covered dimension of cographs can be computed in polynomial time.
Second, a graph G has well-covered dimension equal to zero if and only if the only wellcovered weighting of G is the identically zero function, or, equivalently, if G admits no wellcovering system with size less than n.Therefore, Theorem 4.1 implies the following.Corollary 4.2.Every cograph has a strictly positive well-covered dimension.
An alternative proof of this result could be obtained by using the fact that every cograph is equistable (see [31]).

Reduction to anti-neighborhoods
In this section we focus on the subgraphs of a given graph obtained by deletion of the closed neighborhood of some vertex in the graph.Given a graph G with vertex set {v 1 , . . ., v n }, we denote by G j the graph G − N [v j ], for all j ∈ [n].We first show that, given a well-covering system of the graph G j , for all j ∈ [n], we can efficiently compute a well-covering system of G. Lemma 5.1.Let G be a graph with vertex set {v 1 , . . ., v n }.For each j ∈ [n] let S j be a rational (resp.integer or unit) well-covering system of G − N [v j ] and I j a maximal independent set of  is a rational (resp.integer or unit) well-covering system of G.
Proof.Let G be a graph and let w be a vertex weight function on G.For each j ∈ [n] let G j denote the graph G − N [v j ] and w j the restriction of w to V (G j ).We show the following claim: G w-well-covered if and only if for all j ∈ [n] it holds that G j is w j -well-covered and for all j ∈ [n − 1] it holds that w(I j ∪ {v j }) = w(I j+1 ∪ {v j+1 }).From the claim we get that the equations from the well-covering systems S j of G j , over all j ∈ [n], along with the equations of the form , form a well-covering system of G.
Let us prove the claim.Assume first that G is w-well-covered.Let j ∈ [n] and let I and I ′ be maximal independent sets in G j .Then the sets I ∪ {v j } and I ′ ∪ {v j } are maximal independent sets in G. Since G is w-well-covered, it holds that w(I ∪ {v j }) = w(I ′ ∪ {v j }).Consequently, we have that and G j is w j -well-covered.Consider now an arbitrary j ∈ [n − 1].Since I j and I j+1 are maximal independent sets in G j and G j+1 , respectively, the sets I j ∪ {v j } and I j+1 ∪ {v j+1 } are maximal independent sets in G. Since G is w-well-covered, it follows that w(I j ∪ {v j }) = w(I j+1 ∪ {v j+1 }), which is what we wanted to show.
For a proof of the other direction, assume that for all j ∈ [n] it holds that G j is w j -well-covered and for all j ∈ [n − 1] it holds that w(I j ∪ {v j }) = w(I j+1 ∪ {v j+1 }).In particular, this implies that w(I j ∪ {v j }) = w(I k ∪ {v k }) for all j, k ∈ [n].We want to prove that G is w-well-covered.Let I and I ′ be maximal independent sets in G and let v j ∈ I and v k ∈ I ′ .Note that I \ {v j } and I ′ \ {v k } are maximal independent sets in G j and G k , respectively.By assumption G j is w j -well-covered and G k is w k -well-covered, and thus we have that w(I \ {v j }) = w j (I \ {v j }) = w j (I j ) = w(I j ) and, similarly, w(I ′ \ {v k }) = w(I k ).Consequently, The above two expressions are equal by assumption, so we get w(I) = w(I ′ ) and thus G is w-well-covered.Using the above result, we give a more general statement, which will be an ingredient of the main algorithm in this paper.6 Fork-free graphs By Theorem 4.1, a well-covering system of a given cograph can be computed in polynomial time.In this section, we generalize the result of Theorem 4.1 to prove the main result of this paper, a polynomial-time algorithm for computing a well-covering system of a given fork-free graph.This is a significant generalization of Theorem 4.1, since the class of fork-free graphs also generalizes the class of claw-free graphs.Our approach combines the results from Sections 3 and 5 with a known structural result on fork-free graphs, which allows us to reduce the problem to the class of claw-free graphs, for which the following theorem applies.Theorem 6.1 (Levit and Tankus [27]).There exists an O(n3 m 3/2 ) algorithm, which receives as input a claw-free graph G with n vertices and m ≥ 1 edges and computes a unit well-covering system of G. Following Remark 3.7 and the fact that the function f defined by the rule f (n, m) = n ω+2 m 3/2 for all m, n ≥ 0, is superadditive, Theorem 6.1 has the following consequence.Corollary 6.2.Let C be the class of all graphs G such that every prime induced subgraph of G is claw-free.Then for any graph G in C with n vertices and m ≥ 1 edges, one can compute in time O n ω+2 m 3/2 a unit well-covering system of G with size at most n.
To apply Corollary 6.2, we use the following structural result on fork-free graphs due to Lozin and Milanič [29,30]. 2   Theorem 6.3.Let G be a prime fork-free graph, let x be a vertex of G, and let G ′ be a prime induced subgraph of the graph G − N [x].Then G ′ is claw-free.
Using Theorems 5.3 and 6.3 and Corollary 6.2, we can now derive the following.Lemma 6.4.Given a prime fork-free graph G with n vertices and m ≥ 1 edges, a unit wellcovering system of G with size at most n can be computed in time O(n ω+3 m 3/2 ).
Proof.Let F be the class of prime fork-free graphs and let F * be the class of all graphs G such that every prime induced subgraph of G is claw-free.By Theorem 6.3, for every graph G ∈ F and every vertex x ∈ V (G), the graph G−N [x] belongs to F * .By Corollary 6.2, given a graph G ∈ F * with n vertices and m edges one can compute in time O n + n ω+2 m 3/2 a unit wellcovering system of G with size at most n, where the additive O(n) term has only been added in order to allow for G to be edgeless.Thus, by Theorem 5. We now have everything ready to prove the main result of the paper.Theorem 6.5.Given a fork-free graph G with n vertices and m ≥ 1 edges, a unit well-covering system of G with size at most n can be computed in time O(n ω+3 m 3/2 ).
Proof.Let G be the class of fork-free graphs and G * the class of prime fork-free graphs.Lemma 6.4 implies that given a graph G in G * with n vertices and m ≥ 1 edges, a unit well-covering system of G with size at most n can be computed in time O(n ω+3 m 3/2 ).Let f (n, m) = n ω+3 m 3/2 .By Theorem 3.6, given a fork-free graph G with n vertices and m ≥ 1 edges, a unit well-covering system S of G with size at most n can be computed in time O(f (2n, m) + n ω+1 ) = O((2n) ω+3 m 3/2 + n ω+1 ), which simplifies to O(n ω+3 m 3/2 ).
We can determine if a graph G is well-covered by computing a well-covering system of G and checking if the weight function assigning 1 to each vertex of G satisfies all the equations in the system.This leads to the following consequence of Theorem 6.5.Corollary 6.6.There is a polynomial-time algorithm to determine if a given fork-free graph is well-covered.

Concluding remarks
In this paper we developed two general reductions for the problem of computing a well-covering system of a given graph, that is, a system of linear homogeneous equations representing the well-covered vector space of the graph.Using these reductions, we showed that the problem can be solved in polynomial time in the class of fork-free graphs.For the special case of cographs, a faster algorithm was developed.
As a promising avenue for future research, it would be interesting to study the problem in further generalizations of the class of cographs, for example, in the classes considered in [2,3], including classes of bounded cliquewidth, in which the well-coveredness property can be recognized in FPT time (with cliquewidth as the parameter, see [2]).The complexity of computing the well-covered dimension of a graph, as well as the special case of recognizing graphs with positive well-covered dimension also seem to be questions worthy of further consideration.

Statements and Declarations. Declaration of interest:
The authors have no conflicts of interest to declare that are relevant to the content of this article.
Given a subset S of vertices in G, we denote by G[S] the graph induced by S, that is, the subgraph of G with vertex set S and edge set {uv :u, v ∈ S, uv ∈ E(G)}.A connected component of G is a maximal connected subgraph of G.The complement of a graph G = (V,E) is a graph G with vertex set V in which two distinct vertices are adjacent if and only if they are nonadjacent in G.A co-connected component, or simply co-component, of G is the subgraph of G induced by the vertex set of a connected component of the complement of G.A graph is co-connected if its complement is connected.Given two disjoint subsets A and B of V (G), we say that A and B are complete (resp., anticomplete) to each other in

Lemma 2 . 4 .
Given an n-vertex graph G and a rational well-covering system S of G, one can compute in time O(n ω−1 | S|) a linearly independent well-covering system S ⊆ S of G such that |S| ≤ min{n, | S|}.

Theorem 4 . 1 .
Given a cograph G with n vertices and m edges, an integer well-covering system of G with size at most n − 1 can be computed in time O(n(n + m)).

Corollary 5 . 2 .
Let G be a graph with vertex set {v 1 , . . ., v n }.For each j ∈ [n] let S j be a rational (resp.integer or unit) well-covering system of G−N [v j ].Then a rational (resp.integer or unit) well-covering system of G with size n j=1 |S j |+n−1 can be computed in time O(n(n+ m) + n j=1 |S j |), where m = |E(G)|.Proof.In time O(n(n + m)) we compute the graphs G − N [v j ] for all j ∈ [n] and a maximal independent set I j in each such graph.Then, using Lemma 5.1 we compute a well-covering system of G in time O( n j=1 |S j | + n 2 ).The total complexity of this approach is O(n(n + m) + n j=1 |S j |), as claimed.

Theorem 5 . 3 .
Let G and G * be two graph classes such that for every graph G in G and every vertex v of G the graph G − N [v] is in G * .Assume that for each graph G in G * with n vertices and m edges one can compute in time f (n, m) a rational (resp.integer or unit) well-covering system of G with size at most g(n, m), where f and g are nondecreasing functions.Then for any graph G in G with n vertices and m edges, one can compute in time O(n•(n+m+f (n, m))) a rational (resp.integer or unit) well-covering system of G with size at most n •g(n, m)+ n − 1. Proof.Let G be a graph in G with vertex set V (G) = {v 1 , . . ., v n } and let m = |E(G)|.For all j ∈ [n], let G j = G − N [v j ].The graphs G j , j ∈ [n], can be computed in time O(n(n + m)).By assumption, for each j ∈ [n] the graph G j is in G * , and hence a rational (resp.integer or unit) well-covering system S j of G j with at most g(|V (G j )|, |E(G j )|) ≤ g(n, m) equations can be computed in time f (|V (G j )|, |E(G j )|) ≤ f (n, m).Note also that |S j | ≤ f (|V (G j )|, |E(G j )|) ≤ f (n, m).By Corollary 5.2, a well-covering system of G with size n j=1 |S j | + n − 1 ≤ n • g(n, m) + n − 1 can be computed in time O(n(n + m) + n j=1 |S j |) = O(n • (n + m + f (n, m)).
3, given a graph G ∈ F with n vertices and m ≥ 1 edges one can compute in time O n • n + m + n ω+2 m 3/2 = O n ω+3 m 3/2 a unit well-covering system S of G with size at most n 2 + n − 1.By Lemma 2.4, a unit well-covering subsystem S ⊆ S of G, with size at most n, can be computed in time O(n ω−1 | S|) = O(n ω+1 ).The total time complexity of this approach is O n ω+3 m 3/2 + O n ω+1 = O n ω+3 m 3/2 , as claimed.