WorksComputer Science
Claw-Free and Line Graph Edge Deletion on Block Graphs
Abstract
Edge deletion problems ask for the fewest edges whose deletion gives a graph with a specified property. We study two such problems on block graphs. First making the graph claw-free, and second making it a line graph. Since every line graph is claw-free, the second problem is at least as difficult as the first. We show that on block graphs the two optimum values are always equal, and both are attained by the line graph of a forest. The main step is a completion argument, in which starting from any claw-free solution, we put back edges to get some nice structure inside each block still maintaining the claw-free property. This reduces both edge-deletion problems to the same problem of selecting vertices within the blocks of the input graph. We solve it by dynamic programming in time, which also produces an optimal deletion set and a forest whose line graph is what remains after the completion argument. We also extend the method to -free edge deletion for every fixed .
Introduction
Graph modification problems ask for a minimum set of changes to a graph so that the resulting graph has a desired property or belongs to a prescribed graph class. Depending on the allowed operation, one may delete vertices, add edges (completion), delete edges, or both add and delete edges (editing), see, for example, [10, 4]. In the edge-deletion problems, given a graph and a target class , we try to find a smallest set for which . Even when membership in is easy to test, finding the minimum deletion set can be difficult. For instance, -free edge deletion is NP-complete on general graphs whenever the fixed forbidden induced graph has at least two edges [1]. This includes claw-free edge deletion. Edge deletion to several tree-like target classes is also hard on general inputs [9].
For an induced-subgraph condition, deleting edges can create an obstruction as well as remove one. If a vertex has three neighbors with just one edge between them, deleting that edge creates an induced claw. Thus a solution cannot in general be obtained just by destroying the claws present in the original graph. We study how the structure of a block graph makes it possible to optimize all deletion problems together.
A block is a maximal connected subgraph without a cut vertex. A block on two vertices is called a bridge. A block graph is a graph whose blocks are all cliques. It is easy to check that trees and cliques are trivially block graphs. The cliques of a block graph intersect at cut vertices, and their incidences have a forest structure. This provides a natural setting for dynamic programming, although edges deleted within a clique may leave a subgraph with no obvious structure.
Our two target classes are claw-free graphs and line graphs. A claw is an induced , so a graph is claw-free precisely when no vertex has three pairwise nonadjacent neighbors. The line graph of a graph has a vertex for each edge of . Two vertices of are adjacent when the corresponding edges of share an endpoint. We call a root graph. It is easy to see that every line graph is claw-free. The neighbors of the vertex corresponding to an edge are covered by the clique (in ) of edges incident with and the clique of edges incident with . The containment is strict. For example, the wheel on 6 vertices, is claw-free, but the neighborhood of its hub is a and cannot be covered by two cliques (see § 7).
Several related modification problems have been studied on or towards block graphs. The classical characterization of connected claw-free block graphs as line graphs of trees is due to Chartrand, check [8 Theorem 8.5]. Bonomo et al. [2] gave a polynomial-time algorithm for weighted cluster deletion on block graphs, with disjoint unions of cliques as the target. Bonomo-Braberman et al. obtained a linear-time algorithm for claw-free vertex deletion on weighted block graphs [3]. Dumas et al. studied edge modification towards block graphs, with arbitrary input graphs and block graphs as the target. They showed that edge deletion and editing to block graphs are NP-complete, and gave -vertex kernels for these variants when parameterized by the number of changes [6]. For general inputs, Cygan et al. obtained a polynomial kernel for simultaneous claw-and-diamond-free edge deletion, and Eiben and Lochet obtained one for line-graph edge deletion [5, 7]. Here the input is a block graph and the task is to find a spanning claw-free or line subgraph after deleting least number of edges. We show that every claw-free solution can be completed to a claw-free block graph, and optimize this structure in linear time.
Our Result
For a graph with vertices and edges, let be the minimum number of edges whose deletion makes claw-free, that is,
Let be the minimum number of edges whose deletion makes a line graph, that is,
We also define as the minimum number of edges whose deletion makes the line graph of a forest:
A line graph of a forest is a line graph, and every line graph is claw-free, so for every graph
The inequalities can be strict on general graphs. On block graphs, all three values coincide.
Theorem 1. For every block graph ,
Moreover, an optimal set of edges to delete, together with a forest such that , can be computed in time.
For example, let consist of three triangles , , sharing only . Any single edge deletion leaves a neighbor of in each triangle, and these three neighbors induce a claw. Deleting and leaves two triangles sharing and a separate edge , which is claw-free. Thus the optimum is two and the remaining graph is also the line graph of a forest.
Here is the idea of the proof. Start with any claw-free spanning subgraph of a block graph . For each block , let consist of the vertices incident with an edge of inside . If a vertex belonged to three such sets, one of its neighbors from each of the three blocks would form a claw in . Hence each vertex belongs to at most two sets .
Complete every to a clique, adding back only edges of the original block . The resulting graph contains and remains claw-free, since every vertex has neighbors in at most two completed cliques. In fact, is the line graph of a forest. To see this represent each completed clique by a vertex of the root graph, and each vertex of by an edge incident with the one or two clique vertices that contain it, using a private endpoint when needed. The block-vertex forest of ensures that this root has no cycle.
We are thus left with choosing sets so that no vertex is chosen in more than two blocks while
is as large as possible. A dynamic program on the block-vertex forest solves this selection problem in time. The same selection method, with a larger bound on the number of blocks using each vertex, also handles induced -free edge deletion for every fixed (Section 8) At it specializes to unweighted cluster deletion.
Blocks and the Block-Vertex Incidence graph
If we delete a set of edges from , we get the graph on the same vertex set, called a spanning subgraph of . Deleting few edges is the same as keeping many, therefore
and similarly for LGD() and LFD(). From now on we will think about the edges we keep and not the ones deleted, unless otherwise stated.
We can assume does not contain any isolated vertices. Let be the set of blocks in . Note that every edge of lies in exactly one block. Also, two different blocks share at most one vertex, which is then a cut vertex. The blocks can be found in time by depth-first search. In a block graph every block is a clique, so it contains all edges between its vertices.
The block-vertex tree has the vertex set , and a vertex is joined to a block exactly when . A cycle in would yield a cycle in using edges from distinct blocks, whereas all edges on a cycle lie in one block. Thus must be a forest. It has one tree per component of . See Figure 1 for an example. If has connected components, then has vertices and edges. The edges of are exactly the pairs with , hence

Figure 1. A block graph and its block-vertex tree. Round vertices are vertices of and square vertices are the blocks , , and .
Since every block has at least two vertices, and hence . Thus
So the total size of all blocks is only , even though can be much larger.
Lemma 1. Let be distinct blocks that all contain a vertex , and let for each . Then are pairwise nonadjacent.
Proof. Suppose were an edge for some . Then the three edges , and form a triangle, and a triangle lies inside a single block. This would put and in the same block, contradicting that they are distinct.
Completing Claw-Free Solutions
An arbitrary claw-free solution need not respect the block structure of . The surviving edges in a block need not form a clique. The next lemma shows that we may complete the active vertices inside each block without losing claw-freeness.
Lemma 2. Let be a block graph and let be any claw-free spanning subgraph of . For every block let
and let be the graph on obtained from by adding all the edges inside for all . Then , the graph is claw-free, and every vertex of belongs to at most two of the sets .
Proof. An edge of lies in a unique block , and both of its endpoints belong to , so . Every block of is a clique, so every pair inside is an edge of , which gives .
We now show that no vertex lies in three of the sets, say , and for three distinct blocks. For each , since , there is a neighbour with . By Lemma 1 the vertices are pairwise nonadjacent in , and hence also in . Together with they form an induced claw in , a contradiction. So every vertex belongs to at most two of the sets .
Finally, we show that is claw-free. The neighbours of a vertex in are the vertices of the sets that contain , other than itself. There are at most two such sets, and each is a clique in . So the neighbourhood of is the union of at most two cliques, and it cannot contain three pairwise nonadjacent vertices.
Lemma 2 completes any claw-free solution inside the original blocks without deleting an additional edge. We will refer to adding of the edges to get the above clique structure inside each block as completion. We next construct a forest whose line graph is the completed graph.
Lemma 3. Let be a set for every block such that every vertex lies in at most two of the sets . Let be the graph on with edge set
Then is the line graph of a forest , and can be built in time from the sets .
Proof. We can get rid of all sets of size at most one, since they contribute no edges to . In the rest of the construction, membership always refers to these retained sets. For each retained , create a vertex of . For every vertex of create an edge of as follows. If lies in two sets and , let . If lies in exactly one set , let join to a new private leaf. If lies in no set, let be a new edge on two new vertices, disjoint from other vertices of .
No two of these edges are parallel. If and both joined and , then , but distinct blocks share at most one vertex. Any cycle in would use only vertices , since all other vertices are private endpoints. A cycle in would give an incidence cycle in , which is a forest. Hence is a forest.
For every vertex , the construction creates a unique edge . Hence the map
is a bijection. It remains to show that preserves adjacency. By definition, are adjacent in if and only if they lie in some retained . Every vertex of such an corresponds to an edge incident with and private endpoints are never shared. Thus for some retained block if and only if and share an endpoint, or equivalently . Hence
and therefore .
The construction of takes time. Since every vertex belongs to at most two original sets , we have
We go through the sets and discard those of size at most one, create for each retained set, and record only retained memberships for each vertex . This takes time. Processing each vertex once then creates in constant time from its zero, one, or two retained memberships. Hence has exactly edges and vertices.
A Common Selection Problem
We will show that Lemmas 2 and 3 turn all three deletion problems into the same problem. Choose in every block a set of vertices that will will have all possible edges inside it, such that no vertex is chosen in more than two blocks.
Definition 1. A selection is a family of sets such that every vertex of lies in at most two of the sets .
Given a selection, we keep exactly those edges of whose two endpoints lie in a common set , and we delete all other edges. Every block is a clique, so all pairs inside are edges of , and different blocks have disjoint edge sets. Hence the number of kept edges is . Let
Proposition 1. For every block graph ,
Proof. Take an optimal selection . By Lemma 3 the graph is the line graph of a forest, and it is a spanning subgraph of with edges. Deleting the other edges of therefore gives a line graph of a forest, so .
Conversely, let be any claw-free spanning subgraph of . By Lemma 2 the sets form a selection, and , so
So every claw-free solution deletes at least edges, that is, .
Putting these inequalities together with the general inequality in Equation (1) we get
so all these numbers are equal.
Corollary 1. Let be the minimum number of edges whose deletion makes both claw-free and diamond-free, where a diamond is minus one edge. For every block graph ,
An optimal deletion set can be found in time.
Proof. Clearly . For any two forest edges meeting at , an edge adjacent to both must also meet at , since otherwise those three edges form a cycle. Thus the common neighbors of an adjacent pair in the line graph form a clique, as a result there are no induced diamond. Therefore, the line graph of a forest is claw-free and diamond-free.
Hence , and Proposition 1 gives the equality. The algorithm in § 5 and § 6 returns the corresponding set.
This proves the equality part of Theorem 1. We next compute and an optimal selection in linear time.
Dynamic Programming on the Block-Vertex Tree
We now show how to compute . Recall that in a selection every vertex can be chosen in at most two blocks. One can think of each vertex as having two slots, one for each block in which that vertex may be chosen.
Root every component of the block-vertex forest at a vertex node. We process the tree from the leaves upward. The main observation is that, when we reach a vertex , we only need to know whether has already been chosen in its parent block. If it has, then one of its two slots is already used, otherwise both slots are still available. Thus only two states are needed.
For , let denote the maximum number of edges that can be kept in the blocks corresponding the block nodes in the tree below , where means that is chosen in its parent block and means that it is not. Hence can be chosen in at most of its child blocks.
Similarly, for a block with parent vertex , let denote the maximum number of edges that can be kept in and blocks below it, where means that is chosen in and means that it is not.
We first consider a vertex . The question is how should use its available slots among its child blocks. Let be a child block of . If is not chosen in , the contribution of the subtree rooted at is . If it is chosen, the contribution is . Thus the gain from using one of the slots of on is
This gain is nonnegative, since any solution counted by remains feasible when the parent vertex is also added to the chosen set of .
Therefore, to obtain the best solution at , we start with
where denotes the set of child blocks of , and use the available slots on the child blocks with the largest gains. Let be the two largest values of among the child blocks of , using 0 when there are fewer than two child blocks. Then
Thus, if is chosen in its parent block, it loses the opportunity to use its second-best child block. We call this loss the cost of choosing in its parent block, and denote it as
We next consider a block . Once the values for its child vertices are known, we decide which of these vertices should be chosen in . Let be the parent of . The other vertices of , namely , are its children in the rooted block-vertex forest.
Suppose that we choose a set of these child vertices in . If the parent is also chosen, then the chosen set in has vertices, otherwise it has vertices. Thus, in state , the number of kept edges contributed by is
There is, however, a cost to choosing a child vertex in . If is not chosen in , its subtree contributes , whereas if it is chosen, its subtree contributes . By (6), the loss is exactly . Therefore,
Here we begin with the best value obtainable below every child of when none of them is chosen in . We then choose some of these children. Doing so creates clique edges inside , but choosing a child costs because one of its two slots is now used by .
Proposition 2. If the values and are computed from the leaves of the rooted block-vertex forest upward using the recurrences above, then for each component with root , the value is the maximum number of edges that can be kept in that component. Consequently,
where the sum is over the roots of all components of the block-vertex forest. Moreover, if we store the choices attaining the maxima in the recurrences, then an optimal selection can be recovered by tracing these choices from the roots downward.
Proof. We argue by induction from the leaves of the rooted block-vertex forest. Suppose first that the current node is a vertex . Once we decide in which child blocks is chosen, the subtrees rooted at those child blocks are independent. The only restriction linking them is that can be chosen in at most child blocks when its state is . Hence the best value is obtained by using the available slots on the child blocks with the largest gains, which gives (5). Thus is the optimum value for the subtree rooted at .
Now suppose the current node is a block . Once we fix the set of child vertices chosen in , the subtrees rooted at these children are independent. A chosen child contributes instead of , a loss of , while the vertices chosen in contribute edges inside the clique . Maximizing over all choices of therefore gives (7), so is the optimum value for the subtree rooted at .
At a root vertex no parent block is present, so both slots are free and the optimum for that component is . Since different components are independent, their values add, giving
Finally, by storing the choices attaining each maximum, an optimal selection can be recovered by tracing the decisions from the roots downward.
Linear-Time Algorithm
At a vertex node, the dynamic program scans the child blocks, sums their values , and keeps the two largest gains . The remaining difficulty is the block computation in (7), where it appears to examine every subset of child vertices.
Let be a block of size , with parent vertex . Its child vertices are . Recall that choosing a child in has cost , because one of the two available slots of is then used by .
Suppose first that we decide to choose exactly child vertices in . In state , the parent is chosen in exactly when , so the chosen set in contains vertices. Since is a clique, these vertices contribute kept edges.
For a fixed value of , this contribution depends only on the number of chosen children, and not on which ones are chosen. Thus the best choice of children is simply to take the children with the smallest costs. If the costs are ordered as
then (7) can be written as
This removes the need to examine all subsets of the children. However, sorting the costs separately at every block would introduce an additional logarithmic factor. We next show that the relevant costs lie in a small range, which allows us to replace sorting by grouping.
Lemma 4. Let be a block of size . If a child vertex of has cost , then no set attaining the maximum in (7) contains .
Proof. Suppose that an optimal set contains . Remove from , so it is no longer chosen in the current block . This does not remove from the graph or its child blocks. Its state changes from to , so the optimum contribution below increases from to , a gain of .
Inside , removing from the chosen set loses only the edges joining to the other chosen vertices of . Since has vertices, at most such edges are lost. Hence the total change in the objective is at least .
Thus removing from strictly improves the solution, contradicting the optimality of .
Therefore, for a block of size , only costs can be relevant. We create groups, indexed by these values. Each child with is placed in the group indexed by , while children with are ignored by Lemma 4. Reading the groups from left to right gives all relevant costs in non-decreasing order without using a comparison sort.
Let
be the relevant costs obtained in this way, and define
Here is exactly the minimum total cost of choosing child vertices of . Hence
The groups can be created and scanned in time, and the values and the two maxima can be computed during the same scan. Thus both states of a block can be computed in time. We also store, for each state, a value of attaining the maximum, this will later help us know how many of the cheapest children are chosen in .
First, the blocks of and the block-vertex forest can be constructed in time. We root every component of at a vertex node and evaluate the dynamic program from the leaves upward.
At a vertex , all its child blocks have already been processed. We scan these child blocks once, compute the sum of their values, and keep track of the two largest gains . This gives , , and hence the cost , in time proportional to the number of child blocks of . At a block , as shown above, both and can be computed in time using the groups.
Thus every block-vertex incidence is examined only a constant number of times. Since
all vertex and block computations together take time. By Proposition 2, when the bottom-up computation reaches the roots, we obtain
To recover the sets , we traverse once more, now from the roots downward. During the bottom-up computation, we store the choices attaining each maximum.
Every root vertex starts in state , since it has no parent block. Suppose that a vertex is reached in state . Then has slots available for its child blocks. We choose in the child blocks corresponding to the largest gains used in the computation of , these blocks receive state , while the remaining child blocks receive state .
Now suppose that a block with parent is reached in state . For this state we have stored a value attaining the maximum in (9). We rebuild the groups and choose children of smallest cost. These vertices, together with when , form the set . Thus
Each chosen child receives state 1, and every unchosen child receives state 0. Continuing in this way determines all the sets . Since the same block-vertex incidences are scanned only a constant number of times, this top-down reconstruction also takes time.
During the initial depth-first block decomposition, label each input edge with its unique block. Once the optimal selection is known, mark each vertex-block incidence . We scan the edge set once and delete an edge labeled precisely when and are not both marked in . Each test is constant time, so this produces a deletion set in time. Since the selection is optimal, the remaining graph has exactly edges, and hence
By Proposition 1, is optimal for both Claw-Free Edge Deletion and Line Graph Edge Deletion.
Finally, Lemma 3 constructs in time a forest such that . Therefore an optimal deletion set and the corresponding root forest can be obtained in time. Together with Proposition 1, this completes the proof of Theorem 1.
Why Block Graphs Are Special
The equality
relies strongly on the structure of block graphs. There are three features behind the proof. First, every block is a clique, so whenever some vertices of a block remain active in a claw-free solution, we may safely add back all missing edges among them without leaving the original graph. This is the completion step of Lemma 2. Second, distinct blocks intersect in at most one vertex. Consequently, if a vertex belongs to several blocks, its neighbors coming from different blocks are pairwise nonadjacent. This is what turns the claw-free condition into the simple restriction that a vertex can belong to at most two selected sets . Also, the block-vertex incidence graph is acyclic. This acyclic structure is what ensures in Lemma 3 that the root graph obtained from the selected sets is itself a forest.
General graphs may not have these special properties. Consider the Wheel graph on 6 vertices, , with as the hub vertex. The graph is claw-free. Indeed, the neighborhood of is a , which contains no independent set of size three, while for every cycle vertex the centre is adjacent to both of its other neighbors.
However, is not a line graph. In a line graph, the neighbors of a vertex corresponding to an edge are covered by two cliques, root edges incident with and root edges incident with . In , the neighborhood of the centre is a , and two cliques can cover at most four vertices of this cycle. Hence .
Extension to Larger Stars
Now we will see that the slot idea for the vertices works for other stars as well. Fix an integer and consider deleting the fewest edges so that the graph has no induced (a vertex with pairwise nonadjacent neighbours). For this is the claw-free problem.
Theorem 2. For every fixed , the minimum number of edges whose deletion makes a block graph -free can be computed in time.
Proof. We follow the proof for and list only what changes. In a -free spanning subgraph , a vertex lies in at most of the sets , since of them would give pairwise nonadjacent neighbors by Lemma 1. The completed graph is again -free, because the neighbourhood of a vertex is the union of at most cliques. Conversely, any family of sets in which every vertex lies in at most of them gives a -free graph in the same way. So the problem is (4) with “at most two” replaced by “at most ”. Pad the child-block gains with zeros and let be the largest values. In state , vertex has free slots, so
The block step (7) and Lemma 4 are unchanged, so the grouping method still takes time per block, and for fixed the largest gains at a vertex can be kept up to date in time per child. Recovering the solution works as before.
For , the forbidden graph is , and -free graphs are disjoint unions of cliques. This gives a linear-time algorithm for the unweighted Cluster Deletion problem on block graphs, the weighted version was previously shown polynomial-time solvable by Bonomo, Durán and Valencia-Pabon [2]. For we recover claw-free deletion. Here each vertex belongs to at most two selected sets, permitting the root-forest construction of Lemma 3. For , this line-graph construction need not apply.
Conclusion
We gave a common structural and algorithmic treatment of claw-free and line-graph edge deletion on block graphs. Completing a claw-free solution inside the original blocks costs no extra deleted edges and creates no claw, and the completed graph is the line graph of a forest. This makes the two optimum values equal, and leaves a selection problem that a two-state dynamic program solves in time. The same idea covers -free deletion for fixed .
Our proof depends on two properties of block graph, two blocks meet in at most one vertex, and the block incidences form a forest. Therefore, it does not extend directly to chordal graphs. It would be interesting to find larger graph classes on which the two deletion problems still have the same optimum.
Declaration of generative AI use
During the preparation of this manuscript, the authors used ChatGPT to help develop the idea for the linear-time algorithm, particularly the treatment of block nodes in the dynamic program on the block-vertex tree. ChatGPT also assisted with improving the language, TikZ code, and organization of the manuscript. The authors take full responsibility for the mathematical results, proofs, complexity analysis, and final content of the manuscript.
References
- [1]Aravind, N., Sandeep, R., Sivadasan, N.: Dichotomy results on the hardness of h-free edge modification problems. SIAM Journal on Discrete Mathematics 31(1), 542–561 (2017)DOI
- [2]Bonomo, F., Duran, G., Valencia-Pabon, M.: Complexity of the cluster deletion problem on subclasses of chordal graphs. Theoretical Computer Science 600, 59–69 (2015)
- [3]Bonomo-Braberman, F., Nascimento, J.R., Oliveira, F.S., Souza, U.S., Szwarcfiter, J.L.: Linear-time algorithms for eliminating claws in graphs. International Transactions in Operational Research 31(1), 296–315 (2024)
- [4]Crespelle, C., Drange, P.G., Fomin, F.V., Golovach, P.: A survey of parameterized algorithms and the complexity of edge modification. Computer Science Review 48, 100556 (2023)arxiv.org/abs/2001.06867
- [5]Cygan, M., Pilipczuk, M., Pilipczuk, M., Van Leeuwen, E.J., Wrochna, M.: Polynomial kernelization for removing induced claws and diamonds. Theory of Computing Systems 60(4), 615–636 (2017)
- [6]Dumas, M., Perez, A., Rocton, M., Todinca, I.: Polynomial kernels for edge modification problems towards block and strictly chordal graphs. Discrete Mathematics & Theoretical Computer Science 27(Discrete Algorithms) (2025)DOI
- [7]Eiben, E., Lochet, W.: A polynomial kernel for line graph deletion. In: 28th Annual European Symposium on Algorithms (ESA 2020). Schloss Dagstuhl-Leibniz-Zentrum für Informatik (2020)arxiv.org/abs/2006.15584
- [8]Harary, F.: Graph Theory. Addison-Wesley, Reading, MA (1969)
- [9]Koch, I., Pardal, N., dos Santos, V.F.: Edge deletion to tree-like graph classes. Discrete Applied Mathematics 348, 122–131 (2024)
- [10]Natanzon, A., Shamir, R., Sharan, R.: Complexity classification of some edge modification problems. Discrete Applied Mathematics 113(1), 109–128 (2001)