1 Introduction
Consider the following game, played by an attacker and a defender on graph . The defender controls a set of guards, which he initially places on the vertices of . Each vertex can be occupied by at most one guard.
In each turn, the attacker first chooses one vertex, which he attacks. The defender then must defend against the attack by moving some or all of his guards along their adjacent edges, so that one of the guards moves to the attacked vertex.
If the attacked vertex is not occupied by a guard after the attack, the attacker wins. The defender wins if he can defend indefinitely. An meternal dominating set is a set of vertices, which, when used as the starting configuration of guards, is winning for the defender.
Much previous research has focused on determining the minimum size of such a set, denoted by . It has been explored in several recent papers, see for instance [henning2017bounds, eternaldomsets, eternalsecurityingraphs, properintervalgraphs, blavzej2019m, Messinger2017]. Some recent works have focused on trees in particular, such as [klostermeyer2021eternal, henning2016trees].
It is unknown if it is possible to decide in PSPACE whether a set of guards induces an meternal dominating set. Klostermeyer et al. [surveyarticle] pose the following open problem: is there a function , where is the number of vertices of the graph , such that if one can defend against attacks with a given configuration of guards, it is possible to defend against any sequence of attacks? No such is currently known in the general case. A polynomial upper bound on would imply that the problem of deciding whether a set of vertices induces an meternal dominating set is in PSPACE, as it would suffice to try every possible response to every possible sequence of attacks.
In this paper, we provide a linear bound on when the input graph is a tree. The result follows from the following theorem.
theoremattackstrategy Let be a configuration of guards on tree of at most guards. Then the attacker can win against in at most steps, where is the diameter of .
All graphs considered are undirected and simple. Let be a tree rooted in . Let , then by we denote the children of and by the parent of . By we denote the subtree of rooted in . We say that a tree with no vertices of degree is a shrubbery. Let be a graph and , then by we denote the subgraph of induced by . By we denote the complete graph on vertices. We say that a leaf of a rooted tree is any vertex of degree 1, including the root. We say that is an inner vertex if v has degree at least 2.
2 Efficient attack sequences on trees
In this section, we present an explicit defending strategy on trees, whose definition will help us identify parts of tree which are vulnerable to attacks. This is followed by a description of the attacking process, which guarantees the attacker a win as long as the number of guards is less than .
2.1 Defending strategy based on neocolonization
Let be the tree on which the game is played. To describe the attacking strategy, we make use of the neocolonization of . Let be the size of the minimum connected dominating set of a graph . [Goddard et al. [eternalsecurityingraphs]] A neocolonization of a graph is a partition of the vertex set of such that each is connected. Each part is assigned a weight as follows.
By we denote the total weight of the neocolonization. By we denote the minimum total weight of any neocolonization of , and it is called the cliqueconnected cover number of . Goddard et al. [eternalsecurityingraphs] proved that .
We define a special case of neocolonization which will be useful in describing defending strategies on trees.
We say that a neocolonization of a tree rooted at a leaf is nice if for every

is a shrubbery,

the vertex with the minimum distance to in is a leaf in .
By we denote the part such that .
Klostermeyer et al. [eternaldomsets] proved that on trees. We will show that this equality holds even when we consider the minimum total weight among only nice neocolonizations. To that end, we first recall the linear algorithm that computes in trees by Klostermeyer et al. [eternaldomsets]. The algorithm is based on two reductions.
Reduction 1.
Let be a vertex of incident to leaves and to exactly one vertex of degree at least two. Delete all leaves incident to .
Reduction 2.
Let be a vertex of degree two in such that is adjacent to exactly one leaf, say . Delete both and .
[Klostermeyer et al. [eternaldomsets, Lemma 20 and Lemma 21]] If is the result of applying Reduction 1 or Reduction 2 to the tree , then is a tree and . We derive the following reduction from Reduction 1 so the subsequent analysis is made simpler.
Reduction 3.
Let be a vertex of such that all of its children are leaves and it has a parent. Delete all children of .
Note that the proof of Lemma 20 [eternaldomsets] is applicable to Reduction 3 as well, if we consider , as denoted in the proof of Lemma 20 in [eternaldomsets], to be the parent of . The argument only uses the fact that a vertex neighboring remains after the reduction, with no argument made based on its degree. This implies the following lemma. If is the result of applying Reduction 3 to the tree , then is a tree and .
Let be a tree rooted in a leaf . After an exhaustive application of Reduction 2 or Reduction 3, we are left with a or .
Proof.
Suppose that and is a leaf of . If has no other children than , then Reduction 2 is applicable. Otherwise, has more than children. Note that as was chosen to be a leaf of , therefore has a parent as well and Reduction 3 is applicable. Thus, if neither reduction is applicable, then . ∎
The following lemma shows how those reductions can be used to construct a nice neocolonization of any tree.
For every tree there exists a nice neocolonization with .
Proof.
First, we root the tree in an arbitrary leaf . In each step, we consider a leaf of maximum depth and apply either Reduction 2 or Reduction 3, depending on which one is applicable.
We construct an auxiliary graph on the vertices of . Its connected components will induce the parts of the resulting nice neocolonization of . If we apply Reduction 3 with leaves and their parent , then for each we add to . If we apply Reduction 2 with leaf and its parent , then we add to .
By Section 2.1 we eventually reduce to or . If is reduced to , we connect the two remaining vertices by an edge in . Let be the connected components of . Then is a nice neocolonization of .
Proof.
We show that satisfies the conditions of Section 2.1. Note that all such that are vertex disjoint. Also note that in each except , there is exactly one edge, say , constructed by the application of Reduction 2 and it is the last edge added to . Suppose that when applying Reduction 2, was the vertex of degree two and was the leaf. While applying the reduction, is deleted, and therefore no other vertex than will be adjacent to in . Thus is the vertex closest to in and its only neighbor in is .
We also show that contains no vertex of degree for every . Let be the vertex of minimum depth in . Either consists of vertices and both have degree in , or every vertex except was part of some application of Reduction 3. This follows from the fact that for every at most one edge was constructed after an application of Reduction 2. Each thus appeared only as one of the leaves when applying Reduction 3 and has degree in , or at some point appeared as when applying Reduction 3. In that case, also contains at least two children of . Furthermore, also appeared as a leaf in a subsequent Reduction 3 or as in a subsequent Reduction 2. In both cases also contains the parent of , thus has degree at least in . ∎
We show that . Let be the total number of applications of Reductions 2 and 3. Let be the resulting tree after exhaustively applying Reductions 2 and 3. From Reduction 2, Section 2.1, and Section 2.1, it follows that
(1) 
Now, let us consider the weight of the individual colonies. If consists of a single edge, then . We show that otherwise .
For any tree on vertices, the minimum connected dominating set of consists of the complement of the set of leaves [connecteddominationtrees]. Suppose that is not a clique, then where is the number of vertices of degree at least in . Note that every inner vertex of was part of exactly one Reduction 3 as the parent vertex and also exactly one edge of was added by an application of Reduction 2. Let be the number of reductions which added an edge to . Let be the number of inner vertices of . It follows that
(2) 
for all which had all of its edges in added by the reductions.
It remains to check , which was created or modified when processing at the end of the process. Without loss of generality, let . If is isomorphic to , then is not adjacent to any other vertex in . In that case and .
Otherwise, is isomorphic to . Note that every inner vertex of is still a part of exactly one Reduction 3. Let be the child of and let be the number of inner vertices in . If was a part of some Reduction 3, then it is an inner vertex in and we have . Otherwise, is adjacent only to in and we have and . Thus, in any case, we have
(3) 
Therefore, the total weight of the neocolonization is
Thus the total weight is equal to the minimum required number of guards to defend indefinitely. ∎
A neocolonization implies the following defending strategy described by Goddart et al. [eternalsecurityingraphs]. We will only move guards in the part that was last attacked. If the attacked induces a clique, move the only guard assigned to it. Otherwise, there are guards on . Keep the vertices of the minimum connected dominating set of always occupied. We say that the guard which is not placed on the minimum connected dominating set of is the extra guard of .
In case of an attack, find a path from the extra guard to the attacked vertex and move the guards along this path. Note that all vertices of the path except the attacked one must be occupied.
We will define the canonical strategy, which is a slight modification of the strategy that follows from the nice neocolonization. By we denote the vertex closest to in .
Let the canonical strategy for tree rooted in a leaf be the strategy that follows from the nice neocolonization of with the following modifications.

When initially placing the guards on , for every which is not a clique, place the extra guard of on .

In every part which was not attacked this turn, we move the extra guard to .
Next, we partition the vertices of into three sets based on their neighborhood in their respective part: consists of leaf vertices, consists of joining vertices, and consists of inner vertices.
For , we use , , and to denote , , and respectively. Note that contains exactly one vertex from each which has the minimum depth. The following observation notes when the vertices of , , and are occupied in the canonical strategy.

A leaf vertex is occupied if and only if it was attacked,

a joining vertex is occupied if no leaves in its part were attacked,

an inner vertex is always occupied.
Note that if a part was not attacked, then it moves to a configuration where all its inner vertices and its joining vertex are occupied. Hence, a part moves its guards only if it is attacked in this or the previous turn.
2.2 Attacking strategy
To determine which vertex we want to attack, we will use the notion of a canonical number of guards on a vertex or a subtree, based on which vertices would be occupied in the canonical strategy. By we denote the number of guards on in the canonical strategy after an attack on . Similarly by we denote the total number of guards on in the canonical strategy after an attack on . By we denote . Note that .
The following equality holds.
Proof.
We consider the values of case by case. Any vertex which was attacked must be occupied. In the canonical strategy, all inner vertices are always occupied. Exactly one noninner vertex in each part is occupied – a leaf if the part was attacked, its joining vertex otherwise. ∎
Let be a configuration of guards on . By we denote the number of guards on in and by we denote the number of guards on in . Let and . We say that or is the deficit of vertex or subtree , respectively. We say that is deficient if .
The general idea of the attacking strategy is to find a subtree with less than the necessary number of guards to defend itself. We will show that the deepest root of such a subtree must be unoccupied, and therefore acts as a bottleneck for guards entering the subtree.
Proof.
First, we root the tree in an arbitrary leaf , partition the vertices of the tree into a nice neocolonization , and partition the vertices into leaves, joining, and inner, i.e into sets , and respectively.
Let be a deficient vertex of maximum depth. We will show that such vertex always exists by showing that is always deficient. Consider the canonical strategy on . Its number of guards is equal to the weight of neocolonization , on which the canonical strategy is based. Together with Section 2.1, this implies for any . Moreover, and thus for any , therefore is deficient.
With each attack, we will increase the depth of the deficient vertex of maximum depth. Eventually, when is a leaf of , the fact that is deficient implies that there was an attack on which was not defended.
We will show that there exists a vertex such that we either won by attacking it the previous turn or there is a vertex such that after attacking it, the depth of the lowest deficient vertex increases.
If this is the first turn of the game, let be any vertex occupied by a guard. Otherwise, let be the previously attacked vertex. Then the following equalities hold.
Note that for every by the choice of . Furthermore, as would imply and that in turn implies . Therefore, , from which follows , i.e., is not occupied and .
Now we show that we won the game by the attack on or contains a vertex such that when we attack it, the depth of the deepest vertex increases. If , then and therefore while is not occupied, thus we won the game by the attack on . Thus, let us assume that .
Let be the vertex of on which the canonical strategy would place the extra guard of , i.e., and . Such vertex always exists and is uniquely defined – either , in which case , or is the only vertex in . Also, note that after every attack, the value of for every remains unchanged and is equal to .
Now we show how to find the vertex which we want to attack. For illustration, see Figure 1. First, we will show that there exists such that . Suppose that . Then and as all subtrees of children of are vertex disjoint, for at most one . Therefore, such that is not in the subtree of exists. Otherwise, and therefore and which implies . Thus the only child of does not have in its subtree.
Now suppose we choose any for the attack. We show that . Let . Note that for every such that it holds . It also holds and for every such that it holds while and . Let , then
Also, the number of guards on remains unchanged after the attack, as the only vertex from which a guard may enter is and it is unoccupied. Let be the configuration of guards by which the defender responds to the attack on . It holds
thus is now a deficient vertex of greater depth than .
Therefore, after at most attacks, the lowest deficient vertex must be a leaf, at which point the game is won by the attacker. ∎
This implies the following result. Let be a tree, then .
3 Open problems
Does there exist a graph on vertices that can not be defeated in attacks when the defender has at most guards?