The firefighter problem with more than one firefighter on trees
Abstract
In this paper we study the complexity of the firefighter problem and related problems on trees when more than one firefighter is available at each time step, and answer several open questions of [finbow2009]. More precisely, when firefighters are allowed at each time step, the problem is NPcomplete for trees of maximum degree and polynomialtime solvable for trees of maximum degree when the fire breaks out at a vertex of degree at most . Moreover we present a polynomialtime algorithm for a subclass of trees, namely caterpillars.
1 Introduction
Modeling a spreading process in a network is a widely studied topic and often relies on a graph theoretical approach (see [chen2008, dreyer2009, finbow2009, kempe2003, ng2008, scott2006]). Such processes occur for instance in epidemiology and social sciences. Indeed, the spreading process could be the spread of an infectious disease in a population or the spread of opinions through a social network. Different objectives may then be of interest, for instance minimizing the total number of infected persons by vaccinating at each time step some particular individuals, or making sure that some specific subset of individuals does not get infected at all, etc…
The spreading process may also represent the spread of a fire. The associated firefighter problem, introduced in [hartnell1995], has been studied intensively in the literature (see for instance [anshelevich2009, cai2008, develin2007, finbow2007, finbow2009, hartnell1995, hartnell2000, IKM11, king2010, macgillivray2003, ng2008]). In this paper, we consider some generalizations and variants of this problem which is defined as follows. Initially, a fire breaks out at some special vertex of a graph. At each time step, we have to choose one vertex which will be protected by a firefighter. Then the fire spreads to all unprotected neighbors of the vertices on fire. The process ends when the fire can no longer spread, and then all vertices that are not on fire are considered as saved. The objective consists of choosing, at each time step, a vertex which will be protected by a firefighter such that a maximum number of vertices in the graph is saved at the end of the process.
The firefighter problem was proved to be NPhard for bipartite graphs [macgillivray2003]. Much stronger results were proved later [finbow2007] implying a dichotomy: the firefighter problem is NPhard even for trees of maximum degree three and it is solvable in polynomialtime for graphs with maximum degree three, provided that the fire breaks out at a vertex of degree at most two. Moreover, the firefighter problem is NPhard for cubic graphs [king2010]. From the approximation point of view, the firefighter problem is approximable on trees [cai2008] and it is not approximable on general graphs for any [anshelevich2009], if P NP. Moreover for trees where vertices have at most three children, the firefighter problem is approximable [IKM11]. Finally, the firefighter problem is polynomialtime solvable for caterpillars and Ptrees [macgillivray2003].
A problem related to the firefighter problem, denoted by Fire, was introduced in [king2010]. It consists of deciding if there is a strategy of choosing a vertex to be protected at each time step such that all vertices of a given set are saved. Fire was proved to be NPcomplete for trees of maximum degree three in which every leaf is at the same distance from the vertex where the fire starts and is the set of leaves.
In this paper, we consider a generalized version of Fire. We denote by Save, where is an integer, the problem which consists of deciding if we can choose at most vertices to be protected by firefighters at each time step and save all the vertices from a given set . Thus, Fire is equivalent to Save. The optimization version of Save will be denoted by Max Save. This problem consists of choosing at most vertices to be protected at each time step and saving as many vertices as possible from a given set . Hence, Max Save corresponds to the firefighter problem when is the set of all vertices of the graph. Max Save is known to be 2approximable for trees when is the set of all vertices [hartnell2000].
A survey on the firefighter problem and related problems can be found in [finbow2009]. In this survey, the authors presented a list of open problems. Here, we will answer three of these open questions (questions 2, 4, and 8).
The first question asks for finding algorithms and complexity results of Save when . We show that for any fixed , Save is NPcomplete for trees of maximum degree when is the set of all leaves. Moreover, we show that for any fixed , Max Save is NPhard for trees of maximum degree when is the set of all vertices. Finally, we show that for any , Save is polynomialtime solvable for trees of maximum degree when the fire breaks out at a vertex of degree at most .
The second question asks if there exists a constant such that the greedy strategy of protecting, at each time step, a vertex of highest degree adjacent to a burning vertex gives a polynomialtime approximation for the firefighter problem on trees. We give a negative answer to this question.
Finally, the third question asks for finding classes of trees for which the firefighter problem can be solved in polynomial time. We present a polynomialtime algorithm to solve Max Save, , in caterpillars a subclass of trees.
Our paper is organized as follows. Definitions, terminology and preliminaries are given in Section 2. In Section 3 we establish a dichotomy on the complexity of Save and show that the greedy strategy mentioned above gives no approximation guarantee. In Section 4 we show that Max Save is polynomialtime solvable for caterpillars. Some variants of the Max Save problem are considered in Section 5. Conclusions are given in Section 6.
2 Preliminaries
All graphs in this paper are undirected, connected, finite and simple. Let be a graph. An edge in between vertices will be denoted by . The degree of a vertex , denoted by , is the number of edges incident to . We write for the subgraph obtained by deleting a vertex and all the edges incident to . Similarly, for , we denote by the subgraph of obtained by deleting the set and all the edges incident to some vertex in .
In order to define the firefighter problem, we use an undirected graph and notations of [anshelevich2009]. Each vertex in the graph can be in exactly one of the following states: burned, saved or vulnerable. A vertex is said to be burned if it is on fire. We call a vertex saved if it is either protected by a firefighter — that is the vertex cannot be burned in subsequent time steps — or if all paths from any burned vertex to it contains at least one protected vertex. Any vertex which is neither saved nor burned is called vulnerable. At time step , all vertices are vulnerable, except vertex , which is burned. At each time , at most vertices can be protected by firefighters and any vulnerable vertex which is adjacent to a burned vertex becomes burned at time , unless it is protected at time step . Burned and saved vertices remain burned and saved, respectively.
Given a graph and a vertex initially on fire, a protection strategy is a set where . We say that a vertex is protected at time according to the protection strategy if . A protection strategy is valid with respect to a budget , if the following two conditions are satisfied:

if then is not burned at time ;

let ; then for .
Thus at each time , if a vulnerable vertex is adjacent to at least one burned vertex and , then gets burned at time .
We define in the following the problems we study.
Save
Input: An undirected graph , a burned vertex , and a subset .
Question: Is there a valid strategy with respect to budget such that all vertices from are saved?
Max Save
Input: An undirected graph , a burned vertex , and a subset .
Output: A valid strategy with respect to budget which maximizes the number of saved vertices that belong to .
In the figures of the paper, the burned vertices are represented by black vertices and the vertices from are represented by . A protected vertex is represented by .
Notice that the NPhardness of Save implies the NPhardness of Max Save. Furthermore, if Max Save is solvable in polynomialtime then so is Save.
3 Trees
It has been shown in [finbow2007] that Save is NPcomplete for trees of maximum degree three using a reduction from notallequal 3SAT. Furthermore, Save is polynomialtime solvable for graphs of maximum degree three if the fire breaks out at a vertex of maximum degree two. In this section we generalize these results for any fixed .
First of all, we need to define some notions. Let be a tree and let be the vertex which is initially burned. From now on, will be considered as the root of . We define the level of to be the set of vertices that are at distance exactly from . The height of is the length of a longest path from to a leaf. An ancestor (resp. descendant) of a vertex in is any vertex on the path from to (resp. from to a leaf). A child of a vertex in is an adjacent descendant of . The tree is said complete if every nonleaf vertex has exactly the same number of children.
Remark 1.
Without loss of generality, we may assume that strategies do not protect a vertex that has a protected ancestor in a tree.
Remark 2.
For Save on trees, we may assume without loss of generality that is the set of leaves. Otherwise for each nonleaf vertex , since we have to save , we can remove the subtree rooted at such that becomes a leaf.
We denote by a complete tree of height and root such that every nonleaf vertex has exactly children and every leaf is at the same distance from the root (see Figure 1).
For such a tree we obtain the following property.
Lemma 1.
Let be the number of available firefighters at each time step. Consider a complete tree . If the fire breaks out at , then at least one leaf will not be saved.
Proof.
Since each nonleaf vertex has exactly children, it follows that at each time step there will be at least one new burning vertex. Thus at the end of the process, at least one leaf will be burned. ∎
We also give the following preliminary results.
Lemma 2.
Among the strategies that save all the leaves (resp. a maximum number of a given subset of vertices) of a tree, there exists one such that each protected vertex is adjacent to a burning vertex.
Proof.
This is a straightforward adaptation of observation 4.1 in [macgillivray2003]. ∎
Lemma 3.
Let be a tree and let be a strategy that saves all the leaves of using at most firefighters at each time step. Suppose there exists levels and containing and firefighters, respectively. Then there exists a strategy saving all the leaves of and such that levels and contain and firefighters, respectively.
Proof.
Let be a protected vertex by strategy at a level , and let be the ancestor of at level . It follows from Remark 1 that we may assume that is not protected. We transform strategy into a strategy as follows (see Figure 2): protect at time step and do not protect at time step , that is . Since is an ancestor of , it follows that using strategy , we save a subset of vertices that contains the vertices saved by using . Since level contains at most firefighters it follows that is a valid strategy that saves all the leaves of and levels and contain respectively and firefighters.
∎
We now give the main result of this section.
Theorem 1.
For any fixed , Save is NPcomplete for trees of maximum degree .
Proof.
Clearly, Save belongs to NP. In order to prove its NPhardness, we use a polynomialtime reduction from Save for trees of maximum degree to Save for trees of maximum degree , for any . Since Save is NPhard for (see [king2010]), it follows that Save is NPcomplete for any fixed .
Let be an instance of Save consisting of a tree of maximum degree rooted at some vertex and a subset which corresponds to the set of leaves. Let be the height of . We construct an instance of Save consisting of a tree of maximum degree rooted at some vertex and a subset which corresponds to the leaves of as follows (see Figure 3): add a vertex ; add two paths , , make adjacent to and make adjacent to ; add vertices and make them adjacent to ; for every vertex , , add vertices and make them adjacent to ; for add a path and make adjacent to . This clearly gives us a tree of maximum degree rooted at vertex and the set of leaves is given by .
We prove now that there exists a strategy for that saves all the vertices in if and only if there exists a strategy for that saves all the vertices in .
Suppose there exists a strategy for that saves all the vertices in . In order to save all vertices in , we will apply strategy defined as follows: at time step , we have to protect the vertices ; at each time step , we have to protect the vertices ; thus after time step , vertex is burning as well as vertices ; at each time step , we protect the vertices in according to and we use the additional firefighter to protect the leaf . This clearly gives us a valid strategy saving all the vertices in .
Suppose now that there exists a strategy for that saves all the vertices in . At time step , this strategy necessarily consists in protecting vertices . Furthermore, at each time step , we have to protect the vertices . It follows from Lemma 2 that we may assume that is a strategy which, at each time step, protects vertices adjacent to burning vertices. Thus protects, at each time step , at most vertices at level in for . Let be the number of firefighters in the subtree of at level used by and let . If , then for any , and thus the strategy , restricted to the tree , is a valid strategy for that saves all the leaves of . So we may assume now that .
Let be the smallest value in . Consider the case . Suppose that for any , . From the definition of , it follows that we cannot have , thus for any . By construction, this means that, at each time step , the additional firefighter protects the vertex , . At time step , since , the vertex is not protected and burns which is a contradiction. Thus there exists a level such that . It follows from Lemma 3 that there exists a strategy saving the leaves of such that and . Applying this argument iteratively for , we obtain a strategy that saves all the vertices in and such that for any level , . Thus, the strategy restricted to the tree is a valid strategy that saves all the leaves of . ∎
Theorem 1 implies that Max Save is NPhard for trees of maximum degree when is the set of leaves. Notice that Theorem 1 does not imply that Max Save is NPhard when is the set of all vertices. However, the following theorem shows that this is indeed the case.
Proposition 1.
For any fixed , Max Save is NPhard for trees of maximum degree when is the set of all vertices.
Proof.
We construct a polynomialtime reduction from Save to Max Save where . Let be an instance of Save consisting of a tree of maximum degree with , a burned vertex , and a subset which corresponds to the set of leaves. We construct an instance of Max Save consisting of a tree , a set , and a positive integer as follows (see Figure 4). For every leaf of , add copies , …, of the tree such that the root of is adjacent to , for . Let denote the cardinality of each of those trees. Notice that each tree has vertices. Set . We will prove that there exists a strategy for that saves all the vertices in if and only if there exists a strategy for that saves at least vertices in .
Suppose there exists a strategy for that saves all the vertices in . Since is the set of all leaves in , it follows that the strategy applied to saves all the vertices of the trees . Notice that we have such trees. Thus saves at least vertices in .
Conversely, suppose that no strategy for can save all the vertices in . Thus, at least one leaf of is burned at the end. This necessarily implies that for any strategy for there is at least one vertex, say , of which is burned. It follows from the construction of , that in this case there are at least vertices which will be burned for strategy . Thus saves at most vertices. ∎
The following proposition shows that the sharp separation between the NPhardness and polynomiality of Save on trees pointed out in [king2010] is preserved for any fixed .
Proposition 2.
Let be any fixed integer and a tree of maximum degree . If the fire breaks out at a vertex of degree at most then all the leaves of can be saved if and only if is not complete. Thus Save is polynomialtime solvable for trees of maximum degree if the fire breaks out at a vertex of degree at most .
Proof.
Notice that in this case we protect the vertices such that there is at most one new burning vertex at each time step. Moreover, the fire stops when the vertex has degree at most .
Suppose that is not complete. Then there exists a nonleaf vertex of degree at most . From the previous remark we can direct the fire from to and stop it. Hence all the leaves of are saved.
Suppose that is complete. Then at each time step, there is at least one new burning vertex. Thus there will be a leave which will burn at the end of the process.
Clearly, verifying whether a tree is complete can be done in polynomialtime. ∎
Remark 3.
Notice that Proposition 2 also holds for Max Save. Given a subset of vertices, we direct the fire to a vertex of degree at most such that the number of burned vertices in is minimum.
In [finbow2009], the authors asked whether there exists a constant such that the degree greedy algorithm that consists, at each time step, to protect a highest degree vertex adjacent to a burning vertex, gives a polynomialtime approximation for Max Save for trees. The following proposition answers this question in the case when firefighters are available at each time step for any .
Proposition 3.
For any , there exists no function such that the degree greedy algorithm is an approximation algorithm for Max Save for trees where is the set of all vertices.
Proof.
Consider a tree where is a positive integer. Add a vertex adjacent to and a vertex adjacent to ; for , add a path of length with endpoints and such that is adjacent to ; finally, for , add vertices adjacent to (see Figure 5).
Notice that the degree greedy algorithm protects vertices in the following order: . Thus it saves vertices. However, it is not difficult to see that the optimal solution protects vertices in the following order: . Thus, in an optimal solution we save vertices. Since when , the result follows. ∎
4 caterpillars
In this section, we will present a subclass of trees for which Max Save is polynomialtime solvable for .
A caterpillar is a tree such that the vertices of with degree at least induce a path. In other words, a caterpillar consists of a path such that all edges have at least one endpoint in . A caterpillar, , is a caterpillar in which any pending edge , with , (i.e., any edge with exactly one endpoint in ) may be replaced by a path of length at most (see Figure 6). This path is then called a leg of the caterpillar at vertex . Thus a caterpillar is a caterpillar.
A star is a tree consisting of one vertex, called the center of the star, adjacent to all the others. Thus a star on vertices is isomorphic to the complete bipartite graph . A star, , is a tree obtained from a star in which any edge may be replaced by a path of length at most (see Figure 6). Thus a star is a star. Notice that a star is a special case of a caterpillar
In [macgillivray2003], the authors showed that the degree greedy algorithm gives an optimal solution for Max Save on caterpillars when . However, this result does not hold for caterpillars, see for instance Figure 7.
In this section, we give a polynomialtime algorithm for Max Save for caterpillars for any and . In order to prove our main result of this section we first need to show the following.
Theorem 2.
For any , , Max Save is polynomialtime solvable for stars.
Proof.
We construct a polynomialtime reduction from Max Save to the Min Cost Flow problem which is known to be polynomialtime solvable (see for instance [orlin]). Let be a star. First assume that is the center of . Let . Let , be the maximal paths of starting at vertex , with and , for , if it exists. Let . For each vertex in these paths, we define . Notice that we may assume that every path contains at least one vertex of (otherwise we may delete ).
We construct an auxiliary digraph (see Figure 8), where and . In this digraph , we associate with each arc , a cost . All other arcs have cost zero. Furthermore we associate with each arc a capacity , with each arc a capacity and with each arc a capacity . Finally we associate a supply of value with vertex and a demand of value with vertex (all other vertices have a supply and a demand equal to zero). Thus we obtain an instance of Min Cost Flow (we want to satisfy the supply and demand of each vertex with a minimum total cost and such that the capacity constraints are respected) and clearly can be obtained from in polynomialtime.
We show now that solving Max Save in is equivalent to solving Min Cost Flow in . Consider a feasible solution of Max Save in of value . We may assume without loss of generality (see Remark 1) that at most one vertex is protected in each path , , and (see Lemma 2) that at most vertices are protected in each set , (notice that some of these vertices , may not exist in ). Let . Thus . Consider now some vertex . Then in , we will use one flow unit on the path . Repeating this procedure for every vertex in , we obtain a flow in of value and of cost . Since at most vertices are protected in each set , it follows that at most units of flow use the arc , for . Furthermore, since exactly one vertex is protected in each path , it follows that exactly one flow unit uses the arc for . Hence, we obtain a feasible solution of Min Cost Flow in .
Conversely, consider now a feasible solution of Min Cost Flow in of value . Let be the set of arcs used by a flow unit, , . Thus . For each flow unit on a path , we choose vertex in to be protected, for , . Since the capacity of an arc is , at most vertices in will be chosen to be protected, . Let us denote by the set of vertices in chosen to be protected. Furthermore, since the capacity of an arc is one, exactly one vertex in each path will be chosen to be protected, . Thus, if we protect at each time step the vertices in , we obtain a feasible solution of Max Save in of value .
Finally, we have to consider the case when is not the center of . The case when has degree one is trivial. Thus we may assume now that . If , we are done. Thus we may assume now that . If both neighbors of are in , then the optimal solution is clearly . If both neighbors of are not in , then the optimal solution is clearly . Hence the only case remaining is when exactly one neighbor of is in . Let be the neighbors of such that . If is not the center of , the optimal solution is clearly . Thus we may assume now that is the center of . Let denote the set of vertices of the unique maximal path starting at vertex and containg . In that case we have to compare the value of two solutions: (i) which is the value of the solution obtained by protecting first and then, during the second time step, we protect the neighbor of which is not (if it exists); (ii) the value of the solution obtained by protecting first and then applying our algorithm described above to the graph (i.e., by reducing our problem to a Min Cost Flow problem). ∎
Remark 4.
Notice that the polynomial reduction from Max Save to Min Cost Flow described in the proof of Theorem 2 is still valid if the number of vertices that can be protected at each time step is not constant (for instance if we are allowed to protect at most vertices during the first time step, vertices during the second time step, etc…). In that case we just need to adapt the capacity of the arcs accordingly.
Furthermore the polynomial reduction remains valid in the case where some of the vertices in a set are not allowed to be protected during time step . In this case we simply do not put an arc from to the corresponding vertices in .
Consider now a caterpillar . Let be the path in the caterpillar from which has been obtained, which is induced by vertices of degree at least two. We will call the spine of the caterpillar.
We are now ready to prove the main result of this section.
Theorem 3.
For any , , Max Save is polynomialtime solvable for caterpillars.
Proof.
Let be a caterpillar and let be the spine of . First assume that is a vertex of , say , . Let and . It follows from Remark 1 that we may assume that at most one vertex is protected in and at most one vertex is protected in . Consider a strategy in which we decide to protect exactly two vertices of , say vertex , for and vertex , for . We may assume that is protected during time step and vertex is protected during time step (see Lemma 2). Notice that the vertices will not be protected in this strategy. Construct a star as follows (see Figure 9):

delete all vertices as well as the legs at these vertices (all these vertices are saved in our strategy);

delete all vertices as well as the legs at these vertices (all these vertices are saved in our strategy);

delete all edges of ;

for every , let be the neighbors of not belonging to ; delete and replace it by vertices such that is adjacent to for ;

join every vertex , for and , to by a path of length ;

join every vertex , for and , to by a path of length ;
From the above construction it follows that is a star with center . Now in order to solve our initial problem, we need to solve Max Save in with the following additional constraints: for every and every we are not allowed to protect the vertices of . Indeed, since we decided to protect and , the vertices will not be saved. Notice that these vertices are represented by the vertices of paths in . Moreover, if then at time steps and only firefighters are available (since we protect and at these time steps); if then only firefighters are available at time step . It follows from Theorem 2 and Remark 4 that this problem can be solved in polynomialtime.
Since the number of choices of a pair of vertices to be protected on is , we can determine in polynomialtime the best strategy to adopt if we want to protect exactly two vertices on . Notice that a similar procedure to the one described above can be used if we decide to protect exactly one vertex on respectively if we decide not to protect any vertex of . Clearly the number of choices of exactly one vertex , , to be protected on is . Thus we conclude that if we can determine an optimal strategy in polynomialtime.
It remains the case when . Similar to the proof of Theorem 2, we will distinguish several cases. The case when has degree one is trivial. Thus we may assume now that . If , we are done. Thus we may assume now that . If both neighbors of are in , then the optimal solution is clearly . If both neighbors of are not in , then the optimal solution is clearly . Hence the only case remaining is when exactly one neighbor of is in . Let be the neighbors of such that . If , the optimal solution is clearly . Thus we may assume now that . In this case we have to compare the value of two solutions: (i) which is the value of the solution obtained by protecting first and then, during the second time step, we protect the neighbor of which is not (if it exists); (ii) the value of the solution obtained by protecting first and then applying our algorithm described above to the graph , where is the set of vertices of the unique maximal path starting at and containing . ∎
5 Variants of Max Save
In this section, we give some results for a weighted version of Max Save as well as for its complementary version.
5.1 Weighted version
We would like to mention that our positive results (Proposition 2, Theorem 2, and Theorem 3) may be generalized to a weighted version of Max Save.
Suppose that we are given a weight for each vertex . These weights may for instance reflect the importance of the vertices: if , vertex is considered as more important than vertex . Then we may define the following problem:
Max Weighted Save
Input: An undirected graph , a burned vertex , a subset , and a weight function .
Output: A valid strategy with respect to budget which maximizes the total weight of the saved vertices that belong to .
In the proof of Proposition 2, if we direct the fire to a vertex of degree at most such that the total weight of the burned vertices in is minimum then we get the following result.
Proposition 4.
For any , Max Weighted Save is polynomialtime solvable for trees of maximum degree if the fire breaks out at a vertex of degree at most .
Now by replacing the costs in the proof of Theorem 2 by and adapting the case when is not the center of according to the weights, it is not difficult to see that we obtain the following.
Theorem 4.
For any , , Max Weighted Save is polynomialtime solvable for stars.
Using this result and adapting the case when according to the weights, it is straightforward that we obtain the following result.
Theorem 5.
For any , , Max Weighted Save is polynomialtime solvable for caterpillars.
5.2 Min version
Let us consider now the minimum version of the Max Save problem which is defined as follows.
Min Save
Input: An undirected graph , a burned vertex , a subset .
Output: A valid strategy with respect to budget which minimizes the number of burned vertices that belong to .
In contrast to Max Save which is constant approximable on trees, the following theorem shows a strong inapproximability result for Min Save even when restricted to trees.
Theorem 6.
For any and any , Min Save is not approximable even for trees on vertices when is the set of all vertices, unless .
Proof.
We construct a polynomialtime reduction from Save to Min Save. Let be an instance of Save consisting of a tree with , a burned vertex , and a subset which corresponds to the set of leaves. We construct an instance of Min Save consisting of a tree with , a burned vertex , and as follows. For every leaf of , add vertices adjacent to where . Notice that .
If there exists a strategy that saves all the vertices in then at most vertices are burned in . Conversely, if there is no strategy that saves all the vertices in then at least vertices are burned in .
Suppose that there exists a polynomialtime approximation algorithm for Min Save. Thus, if is a yesinstance, the algorithm gives a solution of value . If is a noinstance, the solution value is . Hence, the approximation algorithm can distinguish in polynomial time between yesinstances and noinstances for Save implying that . ∎
6 Conclusion
In this paper, we studied some generalizations and variants of the firefighter problem when more than one firefighter is available at each time step and we answered three open questions of [finbow2009]. Several interesting questions remain open. The complexity of Save and Max Save in the following cases are not known: when the number of firefighters at each time step depends on the number of vertices; when every leaf is at the same level. The complexity of Max Save for trees of maximum degree is not establish. Finally, the problem is 2approximable for trees when is the set of vertices. Establishing non approximability results or better approximability results is another open problem.