betaFeedback

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 O(n+m)O(n+m) 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 K1,r+1K_{1,r+1}-free edge deletion for every fixed rr.

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 GG and a target class C\mathcal{C}, we try to find a smallest set D⊆E(G)D \subseteq E(G) for which G−D∈CG-D \in\mathcal{C}. Even when membership in C\mathcal{C} is easy to test, finding the minimum deletion set can be difficult. For instance, HH-free edge deletion is NP-complete on general graphs whenever the fixed forbidden induced graph HH 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 K1,3K_{1,3}, so a graph is claw-free precisely when no vertex has three pairwise nonadjacent neighbors. The line graph L(R)L(R) of a graph RR has a vertex for each edge of RR. Two vertices of L(R)L(R) are adjacent when the corresponding edges of RR share an endpoint. We call RR a root graph. It is easy to see that every line graph is claw-free. The neighbors of the vertex corresponding to an edge xyxy are covered by the clique (in L(R)L(R)) of edges incident with xx and the clique of edges incident with yy. The containment is strict. For example, the wheel on 6 vertices, W6≅K1∨C5W_6 \cong K_1 \vee C_5 is claw-free, but the neighborhood of its hub is a C5C_5 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 O(k2)O(k^2)-vertex kernels for these variants when parameterized by the number kk 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 GG with nn vertices and mm edges, let CFD⁡(G)\operatorname{CFD}(G) be the minimum number of edges whose deletion makes GG claw-free, that is,

CFD⁡(G)=min⁡{∣D∣∣D⊆E(G), G−D is claw-free}.\operatorname{CFD}(G)=\min\{ \lvert D\rvert\mid D\subseteq E(G),\ G-D\text{ is claw-free}\}.

Let LGD⁡(G)\operatorname{LGD}(G) be the minimum number of edges whose deletion makes GG a line graph, that is,

LGD⁡(G)=min⁡{∣D∣∣D⊆E(G), G−D is a line graph}.\operatorname{LGD}(G)=\min\{ \lvert D\rvert\mid D\subseteq E(G),\ G-D\text{ is a line graph}\}.

We also define LFD⁡(G)\operatorname{LFD}(G) as the minimum number of edges whose deletion makes GG the line graph of a forest:

LFD⁡(G)=min⁡{∣D∣∣D⊆E(G), G−D≅L(F) for some forest F}.\operatorname{LFD}(G)=\min\{|D|\mid D\subseteq E(G),\,G-D\cong L(F)\text{ for some forest }F\}.

A line graph of a forest is a line graph, and every line graph is claw-free, so for every graph

CFD⁡(G)≤LGD⁡(G)≤LFD⁡(G).(1)\operatorname{CFD}(G)\leq\operatorname{LGD}(G)\leq\operatorname{LFD}(G). \tag*{(1)}

The inequalities can be strict on general graphs. On block graphs, all three values coincide.

Theorem 1. For every block graph GG,

CFD⁡(G)=LGD⁡(G)=LFD⁡(G).\operatorname{CFD}(G)=\operatorname{LGD}(G)=\operatorname{LFD}(G).

Moreover, an optimal set DD of edges to delete, together with a forest RR such that G−D≅L(R)G-D\cong L(R), can be computed in O(n+m)O(n+m) time.

For example, let GG consist of three triangles {c,ai,bi}\{c,a_i,b_i\}, i=1,2,3i=1,2,3, sharing only cc. Any single edge deletion leaves a neighbor of cc in each triangle, and these three neighbors induce a claw. Deleting ca3ca_3 and cb3cb_3 leaves two triangles sharing cc and a separate edge a3b3a_3b_3, 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 HH of a block graph GG. For each block BB, let SBS_B consist of the vertices incident with an edge of HH inside BB. If a vertex belonged to three such sets, one of its neighbors from each of the three blocks would form a claw in HH. Hence each vertex belongs to at most two sets SBS_B.

Complete every SBS_B to a clique, adding back only edges of the original block BB. The resulting graph JJ contains HH and remains claw-free, since every vertex has neighbors in at most two completed cliques. In fact, JJ 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 JJ 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 GG ensures that this root has no cycle.

We are thus left with choosing sets SB⊆BS_B\subseteq B so that no vertex is chosen in more than two blocks while

∑B(∣SB∣2)\sum_B \binom{|S_B|}{2}

is as large as possible. A dynamic program on the block-vertex forest solves this selection problem in O(n+m)O(n+m) time. The same selection method, with a larger bound on the number of blocks using each vertex, also handles induced K1,r+1K_{1,r+1}-free edge deletion for every fixed rr (Section 8) At r=1r=1 it specializes to unweighted cluster deletion.

Blocks and the Block-Vertex Incidence graph

If we delete a set DD of edges from GG, we get the graph G−DG-D on the same vertex set, called a spanning subgraph of GG. Deleting few edges is the same as keeping many, therefore

CFD⁡(G)=m−max⁡{∣E(H)∣:H is a claw-free spanning subgraph of G},\operatorname{CFD}(G)=m-\max\{|E(H)|:H\text{ is a claw-free spanning subgraph of }G\},

and similarly for LGD(GG) and LFD(GG). From now on we will think about the edges we keep and not the ones deleted, unless otherwise stated.

We can assume GG does not contain any isolated vertices. Let B\mathcal{B} be the set of blocks in GG. Note that every edge of GG 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 O(n+m)O(n + m) time by depth-first search. In a block graph every block BB is a clique, so it contains all (∣B∣2)\binom{|B|}{2} edges between its vertices.

The block-vertex tree T=T(G)T = T(G) has the vertex set V(G)∪BV(G) \cup\mathcal{B}, and a vertex vv is joined to a block BB exactly when v∈Bv \in B. A cycle in TT would yield a cycle in GG using edges from distinct blocks, whereas all edges on a cycle lie in one block. Thus TT must be a forest. It has one tree per component of GG. See Figure 1 for an example. If GG has cc connected components, then TT has n+∣B∣n + |\mathcal{B}| vertices and n+∣B∣−cn + |\mathcal{B}| - c edges. The edges of TT are exactly the pairs (v,B)(v, B) with v∈Bv \in B, hence

A block graph and its block-vertex tree

Figure 1. A block graph and its block-vertex tree. Round vertices are vertices of GG and square vertices are the blocks B1={1,2,3}B_1 = \{1, 2, 3\}, B2={3,4,5,6}B_2 = \{3, 4, 5, 6\}, B3={6,7}B_3 = \{6, 7\} and B4={5,8,9}B_4 = \{5, 8, 9\}.

∑B∈B∣B∣=n+∣B∣−c.(2)\sum_{B \in\mathcal{B}} |B| = n + |\mathcal{B}| - c. \tag*{(2)}

Since every block has at least two vertices, 2∣B∣≤∑B∈B∣B∣2|\mathcal{B}| \le\sum_{B \in\mathcal{B}} |B| and hence ∣B∣≤n−c|\mathcal{B}| \le n - c. Thus

∑B∈B∣B∣=n+∣B∣−c≤2(n−c).(3)\sum_{B \in\mathcal{B}} |B| = n + |\mathcal{B}| - c \le2(n - c). \tag*{(3)}

So the total size of all blocks is only O(n)O(n), even though mm can be much larger.

Lemma 1. Let B1,…,BtB_1, \ldots, B_t be distinct blocks that all contain a vertex vv, and let ui∈Bi∖{v}u_i \in B_i \setminus\{v\} for each ii. Then u1,…,utu_1, \ldots, u_t are pairwise nonadjacent.

Proof. Suppose uiuju_i u_j were an edge for some i≠ji \ne j. Then the three edges vuiv u_i, vujv u_j and uiuju_i u_j form a triangle, and a triangle lies inside a single block. This would put BiB_i and BjB_j in the same block, contradicting that they are distinct. □\square

Completing Claw-Free Solutions

An arbitrary claw-free solution HH need not respect the block structure of GG. 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 GG be a block graph and let HH be any claw-free spanning subgraph of GG. For every block B∈BB \in\mathcal{B} let

SB={v∈B:there exists an edge of H incident to v that lies in B},S_B = \{v \in B : \text{there exists an edge of } H \text{ incident to } v \text{ that lies in } B\},

and let JJ be the graph on V(G)V(G) obtained from HH by adding all the edges inside SBS_B for all B∈BB \in\mathcal{B}. Then H⊆J⊆GH \subseteq J \subseteq G, the graph JJ is claw-free, and every vertex of GG belongs to at most two of the sets SBS_B.

Proof. An edge of HH lies in a unique block BB, and both of its endpoints belong to SBS_B, so H⊆JH \subseteq J. Every block of GG is a clique, so every pair inside SB⊂BS_B \subset B is an edge of GG, which gives J⊆GJ \subseteq G.

We now show that no vertex vv lies in three of the sets, say SB1S_{B_1}, SB2S_{B_2} and SB3S_{B_3} for three distinct blocks. For each ii, since v∈SBiv \in S_{B_i}, there is a neighbour ui∈Bi∖{v}u_i \in B_i \setminus\{v\} with vui∈E(H)vu_i \in E(H). By Lemma 1 the vertices u1,u2,u3u_1,u_2,u_3 are pairwise nonadjacent in GG, and hence also in HH. Together with vv they form an induced claw in HH, a contradiction. So every vertex belongs to at most two of the sets SBS_B.

Finally, we show that JJ is claw-free. The neighbours of a vertex vv in JJ are the vertices of the sets SBS_B that contain vv, other than vv itself. There are at most two such sets, and each is a clique in JJ. So the neighbourhood of vv is the union of at most two cliques, and it cannot contain three pairwise nonadjacent vertices. □\square

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 SB⊆BS_B \subseteq B be a set for every block B∈BB \in\mathcal{B} such that every vertex lies in at most two of the sets SBS_B. Let JSJ_S be the graph on V(G)V(G) with edge set

⋃B∈B(SB2).\bigcup_{B \in\mathcal{B}} \binom{S_B}{2}.

Then JSJ_S is the line graph of a forest RR, and RR can be built in O(n)O(n) time from the sets SBS_B.

Proof. We can get rid of all sets SBS_B of size at most one, since they contribute no edges to JSJ_S. In the rest of the construction, membership always refers to these retained sets. For each retained SBS_B, create a vertex rBr_B of RR. For every vertex vv of GG create an edge eve_v of RR as follows. If vv lies in two sets SBS_B and SCS_C, let ev=rBrCe_v = r_Br_C. If vv lies in exactly one set SBS_B, let eve_v join rBr_B to a new private leaf. If vv lies in no set, let eve_v be a new edge on two new vertices, disjoint from other vertices of RR.

No two of these edges are parallel. If eue_u and eve_v both joined rBr_B and rCr_C, then u,v∈B∩Cu,v \in B \cap C, but distinct blocks share at most one vertex. Any cycle in RR would use only vertices rBr_B, since all other vertices are private endpoints. A cycle rB1rB2⋯rBkr_{B_1}r_{B_2}\cdots r_{B_k} in RR would give an incidence cycle B1v1B2v2⋯BkvkB_1v_1B_2v_2\cdots B_kv_k in TT, which is a forest. Hence RR is a forest.

For every vertex v∈V(G)v \in V(G), the construction creates a unique edge ev∈E(R)e_v \in E(R). Hence the map

ϕ:V(JS)⟶E(R),ϕ(v)=ev,\phi: V(J_S) \longrightarrow E(R), \qquad\phi(v)=e_v,

is a bijection. It remains to show that ϕ\phi preserves adjacency. By definition, u,v∈V(G)u,v \in V(G) are adjacent in JSJ_S if and only if they lie in some retained SBS_B. Every vertex of such an SBS_B corresponds to an edge incident with rBr_B and private endpoints are never shared. Thus u,v∈SBu,v \in S_B for some retained block if and only if eue_u and eve_v share an endpoint, or equivalently euev∈E(L(R))e_ue_v \in E(L(R)). Hence

uv∈E(JS)⟺euev∈E(L(R)),uv \in E(J_S) \Longleftrightarrow e_ue_v \in E(L(R)),

and therefore JS≅L(R)J_S \cong L(R).

The construction of RR takes O(n)O(n) time. Since every vertex belongs to at most two original sets SBS_B, we have

∑B∈B∣SB∣≤2n.\sum_{B\in\mathcal{B}} |S_B| \le2n.

We go through the sets and discard those of size at most one, create rBr_B for each retained set, and record only retained memberships for each vertex vv. This takes O(n)O(n) time. Processing each vertex once then creates eve_v in constant time from its zero, one, or two retained memberships. Hence RR has exactly nn edges and O(n)O(n) 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 S=(SB)B∈BS=(S_B)_{B\in\mathcal{B}} of sets SB⊆BS_B\subseteq B such that every vertex of GG lies in at most two of the sets SBS_B.

Given a selection, we keep exactly those edges of GG whose two endpoints lie in a common set SBS_B, and we delete all other edges. Every block is a clique, so all pairs inside SBS_B are edges of GG, and different blocks have disjoint edge sets. Hence the number of kept edges is ∑B(∣SB∣2)\sum_{B}\binom{|S_B|}{2}. Let

OPT⁡(G)=max⁡{∑B∈B(∣SB∣2)∣(SB)B∈B is a selection}.(4)\operatorname{OPT}(G)=\max\left\{\sum_{B\in\mathcal{B}}\binom{|S_B|}{2}\mid(S_B)_{B\in\mathcal{B}}\text{ is a selection}\right\}. \tag*{(4)}

Proposition 1. For every block graph GG,

CFD⁡(G)=LGD⁡(G)=LFD⁡(G)=m−OPT⁡(G).\operatorname{CFD}(G)=\operatorname{LGD}(G)=\operatorname{LFD}(G)=m-\operatorname{OPT}(G).

Proof. Take an optimal selection SS. By Lemma 3 the graph JSJ_S is the line graph of a forest, and it is a spanning subgraph of GG with OPT⁡(G)\operatorname{OPT}(G) edges. Deleting the other m−OPT⁡(G)m-\operatorname{OPT}(G) edges of GG therefore gives a line graph of a forest, so LFD⁡(G)≤m−OPT⁡(G)\operatorname{LFD}(G) \le m-\operatorname{OPT}(G).

Conversely, let HH be any claw-free spanning subgraph of GG. By Lemma 2 the sets SBS_B form a selection, and H⊆JH \subseteq J, so

∣E(H)∣≤∣E(J)∣=∑B(∣SB∣2)≤OPT⁡(G).|E(H)| \le|E(J)| = \sum_B \binom{|S_B|}{2} \le\operatorname{OPT}(G).

So every claw-free solution deletes at least m−OPT⁡(G)m-\operatorname{OPT}(G) edges, that is, CFD⁡(G)≥m−OPT⁡(G)\operatorname{CFD}(G) \ge m-\operatorname{OPT}(G).

Putting these inequalities together with the general inequality in Equation (1) we get

LFD⁡(G)≤m−OPT⁡(G)≤CFD⁡(G)≤LGD⁡(G)≤LFD⁡(G),\operatorname{LFD}(G) \le m-\operatorname{OPT}(G) \le\operatorname{CFD}(G) \le\operatorname{LGD}(G) \le\operatorname{LFD}(G),

so all these numbers are equal.

Corollary 1. Let CDFD⁡(G)\operatorname{CDFD}(G) be the minimum number of edges whose deletion makes GG both claw-free and diamond-free, where a diamond is K4K_4 minus one edge. For every block graph GG,

CDFD⁡(G)=CFD⁡(G)=LGD⁡(G)=LFD⁡(G)=m−OPT⁡(G).\operatorname{CDFD}(G) = \operatorname{CFD}(G) = \operatorname{LGD}(G) = \operatorname{LFD}(G) = m-\operatorname{OPT}(G).

An optimal deletion set can be found in O(n+m)O(n+m) time.

Proof. Clearly CFD⁡(G)≤CDFD⁡(G)\operatorname{CFD}(G) \le\operatorname{CDFD}(G). For any two forest edges meeting at xx, an edge adjacent to both must also meet at xx, 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 CDFD⁡(G)≤LFD⁡(G)\operatorname{CDFD}(G) \le\operatorname{LFD}(G), 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 OPT⁡(G)\operatorname{OPT}(G) and an optimal selection in linear time.

Dynamic Programming on the Block-Vertex Tree

We now show how to compute OPT⁡(G)\operatorname{OPT}(G). 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 TT at a vertex node. We process the tree from the leaves upward. The main observation is that, when we reach a vertex vv, we only need to know whether vv 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 x∈{0,1}x \in\{0,1\}, let Dv(x)D_v(x) denote the maximum number of edges that can be kept in the blocks corresponding the block nodes in the tree below vv, where x=1x=1 means that vv is chosen in its parent block and x=0x=0 means that it is not. Hence vv can be chosen in at most 2−x2-x of its child blocks.

Similarly, for a block BB with parent vertex pp, let MB(x)M_B(x) denote the maximum number of edges that can be kept in BB and blocks below it, where x=1x=1 means that pp is chosen in BB and x=0x=0 means that it is not.

We first consider a vertex vv. The question is how vv should use its available slots among its child blocks. Let BB be a child block of vv. If vv is not chosen in BB, the contribution of the subtree rooted at BB is MB(0)M_B(0). If it is chosen, the contribution is MB(1)M_B(1). Thus the gain from using one of the slots of vv on BB is

ΔB=MB(1)−MB(0).\Delta_B = M_B(1) - M_B(0).

This gain is nonnegative, since any solution counted by MB(0)M_B(0) remains feasible when the parent vertex vv is also added to the chosen set of BB.

Therefore, to obtain the best solution at vv, we start with

∑B∈ch⁡(v)MB(0)\sum_{B \in\operatorname{ch}(v)} M_B(0)

where ch⁡(v)\operatorname{ch}(v) denotes the set of child blocks of vv, and use the available slots on the child blocks with the largest gains. Let g1(v)≥g2(v)≥0g_1(v) \ge g_2(v) \ge0 be the two largest values of ΔB\Delta_B among the child blocks of vv, using 0 when there are fewer than two child blocks. Then

Dv(0)=∑B∈ch⁡(v)MB(0)+g1(v)+g2(v),Dv(1)=∑B∈ch⁡(v)MB(0)+g1(v).(5)D_v(0) = \sum_{B \in\operatorname{ch}(v)} M_B(0) + g_1(v) + g_2(v), \qquad D_v(1) = \sum_{B \in\operatorname{ch}(v)} M_B(0) + g_1(v). \tag*{(5)}

Thus, if vv 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 vv in its parent block, and denote it as

cv=Dv(0)−Dv(1)=g2(v).(6)c_v = D_v(0) - D_v(1) = g_2(v). \tag*{(6)}

We next consider a block BB. Once the values for its child vertices are known, we decide which of these vertices should be chosen in BB. Let pp be the parent of BB. The other vertices of BB, namely B∖{p}B \setminus\{p\}, are its children in the rooted block-vertex forest.

Suppose that we choose a set A⊆B∖{p}A \subseteq B \setminus\{p\} of these child vertices in BB. If the parent pp is also chosen, then the chosen set in BB has ∣A∣+1|A|+1 vertices, otherwise it has ∣A∣|A| vertices. Thus, in state x∈{0,1}x \in\{0,1\}, the number of kept edges contributed by BB is

(∣A∣+x2).\binom{|A|+x}{2}.

There is, however, a cost to choosing a child vertex uu in BB. If uu is not chosen in BB, its subtree contributes Du(0)D_u(0), whereas if it is chosen, its subtree contributes Du(1)D_u(1). By (6), the loss is exactly cuc_u. Therefore,

MB(x)=∑u∈B∖{p}Du(0)+max⁡A⊆B∖{p}{(∣A∣+x2)−∑u∈Acu}.(7)M_B(x) = \sum_{u\in B\setminus\{p\}} D_u(0) + \max_{A\subseteq B\setminus\{p\}} \left\{ \binom{|A|+x}{2} - \sum_{u\in A} c_u \right\}. \tag*{(7)}

Here we begin with the best value obtainable below every child of BB when none of them is chosen in BB. We then choose some of these children. Doing so creates clique edges inside BB, but choosing a child uu costs cuc_u because one of its two slots is now used by BB.

Proposition 2. If the values Dv(x)D_v(x) and MB(x)M_B(x) are computed from the leaves of the rooted block-vertex forest upward using the recurrences above, then for each component with root rr, the value Dr(0)D_r(0) is the maximum number of edges that can be kept in that component. Consequently,

OPT⁡(G)=∑rDr(0),\operatorname{OPT}(G) = \sum_r D_r(0),

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 vv. Once we decide in which child blocks vv is chosen, the subtrees rooted at those child blocks are independent. The only restriction linking them is that vv can be chosen in at most 2−x2-x child blocks when its state is xx. Hence the best value is obtained by using the available slots on the child blocks with the largest gains, which gives (5). Thus Dv(x)D_v(x) is the optimum value for the subtree rooted at vv.

Now suppose the current node is a block BB. Once we fix the set AA of child vertices chosen in BB, the subtrees rooted at these children are independent. A chosen child uu contributes Du(1)D_u(1) instead of Du(0)D_u(0), a loss of cuc_u, while the vertices chosen in BB contribute (∣A∣+x2)\binom{|A|+x}{2} edges inside the clique BB. Maximizing over all choices of AA therefore gives (7), so MB(x)M_B(x) is the optimum value for the subtree rooted at BB.

At a root vertex rr no parent block is present, so both slots are free and the optimum for that component is Dr(0)D_r(0). Since different components are independent, their values add, giving

OPT⁡(G)=∑rDr(0).\operatorname{OPT}(G) = \sum_r D_r(0).

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 MB(0)M_B(0), and keeps the two largest gains MB(1)−MB(0)M_B(1)-M_B(0). The remaining difficulty is the block computation in (7), where it appears to examine every subset of child vertices.

Let BB be a block of size ss, with parent vertex pp. Its child vertices are B∖{p}B \setminus\{p\}. Recall that choosing a child uu in BB has cost cu=Du(0)−Du(1)c_u = D_u(0) - D_u(1), because one of the two available slots of uu is then used by BB.

Suppose first that we decide to choose exactly jj child vertices in BB. In state x∈{0,1}x \in\{0,1\}, the parent pp is chosen in BB exactly when x=1x=1, so the chosen set in BB contains j+xj+x vertices. Since BB is a clique, these vertices contribute (j+x2)\binom{j+x}{2} kept edges.

For a fixed value of jj, this contribution depends only on the number of chosen children, and not on which ones are chosen. Thus the best choice of jj children is simply to take the jj children with the smallest costs. If the costs are ordered as

q1≤q2≤⋯≤qs−1,q_1 \le q_2 \le\cdots\le q_{s-1},

then (7) can be written as

MB(x)=∑u∈B∖{p}Du(0)+max⁡0≤j≤s−1{(j+x2)−∑i=1jqi}.(8)M_B(x) = \sum_{u \in B \setminus\{p\}} D_u(0) + \max_{0 \le j \le s-1} \left\{ \binom{j+x}{2} - \sum_{i=1}^{j} q_i \right\}. \tag*{(8)}

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 BB be a block of size ss. If a child vertex vv of BB has cost cv≥sc_v \ge s, then no set attaining the maximum in (7) contains vv.

Proof. Suppose that an optimal set AA contains vv. Remove vv from AA, so it is no longer chosen in the current block BB. This does not remove vv from the graph or its child blocks. Its state changes from 11 to 00, so the optimum contribution below vv increases from Dv(1)D_v(1) to Dv(0)D_v(0), a gain of cv≥sc_v \ge s.

Inside BB, removing vv from the chosen set loses only the edges joining vv to the other chosen vertices of BB. Since BB has ss vertices, at most s−1s-1 such edges are lost. Hence the total change in the objective is at least cv−(s−1)≥1c_v-(s-1) \ge1.

Thus removing vv from AA strictly improves the solution, contradicting the optimality of AA.

Therefore, for a block of size ss, only costs 0,1,…,s−10,1,\ldots,s-1 can be relevant. We create ss groups, indexed by these values. Each child uu with cu<sc_u < s is placed in the group indexed by cuc_u, while children with cu≥sc_u \ge s 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

q1≤q2≤⋯≤qhq_1 \le q_2 \le\cdots\le q_h

be the relevant costs obtained in this way, and define

Cj=∑i=1jqi,C0=0.C_j = \sum_{i=1}^{j} q_i,\qquad C_0 = 0.

Here CjC_j is exactly the minimum total cost of choosing jj child vertices of BB. Hence

MB(x)=∑u∈B∖{p}Du(0)+max⁡0≤j≤h{(j+x2)−Cj}.(9)M_B(x) = \sum_{u\in B\setminus\{p\}} D_u(0) + \max_{0\le j\le h} \left\{\binom{j+x}{2} - C_j\right\}. \tag*{(9)}

The groups can be created and scanned in O(s)O(s) time, and the values CjC_j and the two maxima can be computed during the same scan. Thus both states of a block BB can be computed in O(∣B∣)O(|B|) time. We also store, for each state, a value of jj attaining the maximum, this will later help us know how many of the cheapest children are chosen in BB.

First, the blocks of GG and the block-vertex forest TT can be constructed in O(n+m)O(n+m) time. We root every component of TT at a vertex node and evaluate the dynamic program from the leaves upward.

At a vertex vv, all its child blocks have already been processed. We scan these child blocks once, compute the sum of their MB(0)M_B(0) values, and keep track of the two largest gains MB(1)−MB(0)M_B(1)-M_B(0). This gives Dv(0)D_v(0), Dv(1)D_v(1), and hence the cost cvc_v, in time proportional to the number of child blocks of vv. At a block BB, as shown above, both MB(0)M_B(0) and MB(1)M_B(1) can be computed in O(∣B∣)O(|B|) time using the groups.

Thus every block-vertex incidence is examined only a constant number of times. Since

∑B∈B∣B∣=O(n),\sum_{B\in\mathcal{B}} |B| = O(n),

all vertex and block computations together take O(n)O(n) time. By Proposition 2, when the bottom-up computation reaches the roots, we obtain

OPT⁡(G)=∑rDr(0).\operatorname{OPT}(G) = \sum_r D_r(0).

To recover the sets SBS_B, we traverse TT 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 00, since it has no parent block. Suppose that a vertex vv is reached in state xx. Then vv has 2−x2-x slots available for its child blocks. We choose vv in the child blocks corresponding to the largest gains used in the computation of Dv(x)D_v(x), these blocks receive state 11, while the remaining child blocks receive state 00.

Now suppose that a block BB with parent pp is reached in state xx. For this state we have stored a value jj attaining the maximum in (9). We rebuild the groups and choose jj children of smallest cost. These vertices, together with pp when x=1x=1, form the set SBS_B. Thus

SB={{the j chosen children},x=0,{p}∪{the j chosen children},x=1.S_B = \begin{cases} \{\text{the }j\text{ chosen children}\}, & x=0,\\ \{p\}\cup\{\text{the }j\text{ chosen children}\}, & x=1. \end{cases}

Each chosen child receives state 1, and every unchosen child receives state 0. Continuing in this way determines all the sets SBS_B. Since the same block-vertex incidences are scanned only a constant number of times, this top-down reconstruction also takes O(n)O(n) 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 v∈SBv \in S_B. We scan the edge set once and delete an edge uvuv labeled BB precisely when uu and vv are not both marked in SBS_B. Each test is constant time, so this produces a deletion set DD in O(n+m)O(n+m) time. Since the selection is optimal, the remaining graph has exactly OPT⁡(G)\operatorname{OPT}(G) edges, and hence

∣D∣=m−OPT⁡(G).|D| = m - \operatorname{OPT}(G).

By Proposition 1, DD is optimal for both Claw-Free Edge Deletion and Line Graph Edge Deletion.

Finally, Lemma 3 constructs in O(n)O(n) time a forest RR such that G−D≅L(R)G-D \cong L(R). Therefore an optimal deletion set and the corresponding root forest can be obtained in O(n+m)O(n+m) time. Together with Proposition 1, this completes the proof of Theorem 1.

Why Block Graphs Are Special

The equality

CFD⁡(G)=LGD⁡(G)=LFD⁡(G)\operatorname{CFD}(G) = \operatorname{LGD}(G) = \operatorname{LFD}(G)

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 SBS_B. 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, W6W_6, with cc as the hub vertex. The graph is claw-free. Indeed, the neighborhood of cc is a C5C_5, which contains no independent set of size three, while for every cycle vertex the centre cc is adjacent to both of its other neighbors.

However, W6W_6 is not a line graph. In a line graph, the neighbors of a vertex corresponding to an edge xyxy are covered by two cliques, root edges incident with xx and root edges incident with yy. In W6W_6, the neighborhood of the centre cc is a C5C_5, and two cliques can cover at most four vertices of this cycle. Hence CFD⁡(W6)=0<LGD⁡(W6)\operatorname{CFD}(W_6)=0<\operatorname{LGD}(W_6).

Extension to Larger Stars

Now we will see that the slot idea for the vertices works for other stars as well. Fix an integer r≥1r \ge1 and consider deleting the fewest edges so that the graph has no induced K1,r+1K_{1,r+1} (a vertex with r+1r+1 pairwise nonadjacent neighbours). For r=2r=2 this is the claw-free problem.

Theorem 2. For every fixed r≥1r \ge1, the minimum number of edges whose deletion makes a block graph K1,r+1K_{1,r+1}-free can be computed in O(n+m)O(n+m) time.

Proof. We follow the proof for r=2r=2 and list only what changes. In a K1,r+1K_{1,r+1}-free spanning subgraph HH, a vertex lies in at most rr of the sets SBS_B, since r+1r+1 of them would give r+1r+1 pairwise nonadjacent neighbors by Lemma 1. The completed graph JJ is again K1,r+1K_{1,r+1}-free, because the neighbourhood of a vertex is the union of at most rr cliques. Conversely, any family of sets in which every vertex lies in at most rr of them gives a K1,r+1K_{1,r+1}-free graph in the same way. So the problem is (4) with “at most two” replaced by “at most rr”. Pad the child-block gains with zeros and let g1(v)≥⋯≥gr(v)≥0g_1(v) \ge\cdots\ge g_r(v) \ge0 be the rr largest values. In state x∈{0,1}x \in\{0,1\}, vertex vv has r−xr-x free slots, so

Dv(x)=∑B∈ch⁡(v)MB(0)+∑i=1r−xgi(v),cv=Dv(0)−Dv(1)=gr(v).D_v(x)=\sum_{B\in\operatorname{ch}(v)} M_B(0)+\sum_{i=1}^{r-x}g_i(v),\qquad c_v=D_v(0)-D_v(1)=g_r(v).

The block step (7) and Lemma 4 are unchanged, so the grouping method still takes O(∣B∣)O(|B|) time per block, and for fixed rr the rr largest gains at a vertex can be kept up to date in O(r)O(r) time per child. Recovering the solution works as before.

For r=1r=1, the forbidden graph is K1,2=P3K_{1,2}=P_3, and P3P_3-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 r=2r=2 we recover claw-free deletion. Here each vertex belongs to at most two selected sets, permitting the root-forest construction of Lemma 3. For r>2r>2, 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 O(n+m)O(n + m) time. The same idea covers K1,r+1K_{1,r+1}-free deletion for fixed rr.

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. [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. [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. [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. [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. [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. [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. [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. [8]Harary, F.: Graph Theory. Addison-Wesley, Reading, MA (1969)
  9. [9]Koch, I., Pardal, N., dos Santos, V.F.: Edge deletion to tree-like graph classes. Discrete Applied Mathematics 348, 122–131 (2024)
  10. [10]Natanzon, A., Shamir, R., Sharan, R.: Complexity classification of some edge modification problems. Discrete Applied Mathematics 113(1), 109–128 (2001)

Paper details

vlnc:W_gawzq3z6
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 2

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

ChatGPT

View statement
Looking for related papers…
Contents