Energy Constrained Depth First Search: Shantanu Das Dariusz Dereniowski Przemysław Uzna Nski
Energy Constrained Depth First Search: Shantanu Das Dariusz Dereniowski Przemysław Uzna Nski
https://doi.org/10.1007/s00453-024-01275-8
Received: 4 June 2019 / Accepted: 20 September 2024 / Published online: 12 October 2024
© The Author(s) 2024
Abstract
Depth first search is a natural algorithmic technique for constructing a closed route that
visits all vertices of a graph. The length of such a route equals, in an edge-weighted
tree, twice the total weight of all edges of the tree and this is asymptotically optimal
over all exploration strategies. This paper considers a variant of such search strategies
where the length of each route is bounded by a positive integer B (e.g. due to limited
energy resources of the searcher). The objective is to cover all the edges of a tree T
using the minimum number of routes, each starting and ending at the root and each
being of length at most B. To this end, we analyze the following natural greedy tree
traversal process that is based on decomposing a depth first search traversal into a
sequence of limited length routes. Given any arbitrary depth first search traversal R
of the tree T , we cover R with routes R1 , . . . , Rl , each of length at most B such that:
Ri starts at the root, reaches directly the farthest point of R visited by Ri−1 , then Ri
continues along the path R as far as possible, and finally Ri returns to the root. We call
the above algorithm piecemeal-DFS and we prove that it achieves the asymptotically
minimal number of routes l, regardless of the choice of R. Our analysis also shows
that the total length of the traversal (and thus the traversal time) of piecemeal-DFS is
asymptotically minimum over all energy-constrained exploration strategies. The fact
that R can be chosen arbitrarily means that the exploration strategy can be constructed
in an online fashion when the input tree T is not known in advance. Each route Ri
The work has been announced at the 45th International Colloquium on Automata, Languages, and
Programming (ICALP 2018) [13]
S. Das: Author partially supported by ANR project ANCOR (anr-14-CE36-0002-01)
D. Dereniowski: Partially supported by National Science Centre (Poland) grant number
2015/17/B/ST6/01887.
B Dariusz Dereniowski
deren@eti.pg.edu.pl
Shantanu Das
shantanu.das@lis-lab.fr
Przemysław Uznański
puznanski@cs.uni.wroc.pl
123
3760 Algorithmica (2024) 86:3759–3782
can be constructed without any knowledge of the yet unvisited part of T . Surprisingly,
our results show that depth first search is efficient for energy constrained exploration
of trees, even though it is known that the same does not hold for energy constrained
exploration of arbitrary graphs.
1 Introduction
Graph-theoretic problems in which one wants to cover the entire graph with one or more
routes satisfying certain objective is a well established and long studied topic in many
areas of computer science. Particular problems vary depending on the research area or
potential applications, including the study of simple graph traversals like DFS or BFS,
for algorithmic purposes, to complex transportation problems with many variations
of traveling salesman problem (TSP), or pursuit-evasion games like the watchman
problem, and finally distributed monitoring of networks using mobile agents.
For one possible application of our results, consider a mobile robot that needs to
explore an initially unknown tree. We assume that the tree is edge-weighted and the
weight of each edge denotes the length of that edge. Starting from a single vertex (the
root) of the tree, the robot must traverse all edges and return to its initial location.
Upon visiting a vertex v for the first time, the robot discovers the edges incident to
v and can choose one of them to continue the exploration. Provided that the robot
can remember the visited vertices and edges, a simple depth first search (DFS) is an
efficient algorithm for exploring the tree, achieving the optimal cost of twice the sum
of the lengths of edges in the tree.
Consider a more interesting scenario, when the robot has a limited source of energy
(e.g. a battery) which allows it to traverse a path of length at most B (we say such
a robot is energy constrained). Naturally, we assume that each vertex of the tree is
at distance at most B/2 from the root, otherwise the tree cannot be fully explored.
In this case, exploration is possible if the robot can recharge its battery whenever it
returns back to the starting location. Thus, the exploration is a collection of routes of
the robot, each of which starts and ends at the root, and has length at most B. We are
interested in the minimum number of such routes needed (i.e. the number of times the
robot has to recharge) to completely explore the tree.
This model of exploration may be of interest for several reasons. One obvious reason
is related to the capabilities of the robot; it may have a restricted fuel tank capacity
or perhaps a harsh or risky environment enforces a return to its home-base every so
often. A robot that returns periodically to the root can inform about new discoveries—
in this way the knowledge is accumulated gradually at the base-station while the
algorithm progresses. This may, for example, reduce the risk of having no data in case
of robot failure prior to the end of exploration. From a different point of view, this
process may be seen as a piecemeal learning, that is, one in which it is possible to
have a trade off between exploration and utilization; the two phases representing parts
in which learning occurs (exploration) and parts in which accumulated knowledge is
123
Algorithmica (2024) 86:3759–3782 3761
used (utilization). Finally, having many restricted-length routes covering a tree instead
of a single long route may be potentially applied in scenarios in which one wants to
minimize exploration time by strategies using multiple robots. In fact, when the robots
are incapable of refueling, we can use several robots to explore the tree, each robot
traversing a path of length B. In that case, it is important to minimize the number of
robots used as well as the total energy cost for exploration.
Note that the piecemeal exploration problem has been studied before not just for
trees but also for arbitrary connected graphs. However those results were restricted to
visiting vertices at depth of at most B/(2(1 + β)), for some β > 0, with the cost of
exploration deteriorating sharply as β approached zero, see e.g. [8]. In this paper we
would like to consider exploration strategies that completely visit all trees up to the
maximum possible depth of B/2. No such exploration algorithms have been studied for
either general graphs or special graphs such as trees. Simple strategies based on depth-
first search (breadth first search) perform badly in the case of piecemeal exploration of
arbitrary graphs. However as we show in this paper, the piecemeal version of depth-
first search performs optimally in trees. This fact is surprising given the fact that for
exploration by multiple open routes (routes that do not end at the root) depth-first
strategies in trees can have an overhead of (log n) [12].
Related work: There exists extensive literature on graph traversal and exploration, we
survey here only the most relevant results on graph exploration by mobile agents (for
a more extensive survey please see [11] and the references therein). Exploration of
general graphs having n nodes and m edges, by a single agent, has been studied in [27]
who gave an algorithm of m + O(n) steps. For exploration by k agents, [22] provides
an exploration algorithm taking O(D + n/ log k) steps in trees of n nodes and height
D. This algorithm turns out to be O(k/ log k) competitive [24] (where competitiveness
is the ratio of the number of steps of an algorithm over the optimal number of steps).
Authors in [9] give a O(n/k + D k−1 ) time algorithm for tree exploration while [20]
gives an algorithm for sparse trees with competitive ratio O(D 1−1/ p ), where p is
defined as the tree density. For some lower bounds on exploration time see [21, 22,
24]. For other recent results on exploration time see e.g. [9, 14, 16, 17, 25, 26]. Other
than optimizing time, exploration using little memory for the agents has also been
studied, see e.g. [1, 15].
None of the results mentioned above consider any energy limitation for the agents.
The energy constrained exploration problem was first studied under the name of Piece-
meal Graph Exploration [8], with the assumption that the route length B ≥ 2(1+β)r ,
where r is the furthest distance from the starting node to other nodes, and 0 < β < 1.
That paper provided exploration algorithms for a special class of grid graphs with ‘rect-
angular obstacles’. Awerbuch et al. [4] showed that, for general graphs, there exists
an energy constrained exploration algorithm with a total cost of O(m + n 1+o(1) ). This
has been further improved (by an algorithm that is a combination of DFS and BFS)
to O(m + n log2 n) in [5]. Finally [18] provided an exploration algorithm for general
unknown weighted graphs with total cost asymptotic to the sum of edge weights of the
graph. Note that, as mentioned, all the above strategies require the length of each route
to be strictly larger than the shortest return path from the starting vertex to the farthest
vertex. In other words, these algorithms fail in the extreme cases when the height of the
123
3762 Algorithmica (2024) 86:3759–3782
explored tree (or the diameter of the graph) is equal to half of the energy budget, which
seem to be the most challenging cases. When the tree is known in advance, finding
the offline optimal strategy for piecemeal exploration is known to be NP-complete for
weighted trees [22].
The same tree exploration model as we study in this work has been considered in
[6, 12, 19] for unweighted trees and multiple agents, with one difference: each agent
traverses a path of length at most B such that the path starts at the root but may end at
any node of the tree (in other words, agents do not have to return to the homebase). It
has been shown in [12] that if the tree is not known in advance, then there exists an
exploration algorithm (that minimizes the number of agents used) with competitive
ratio of O(log B) and this is the best possible. On the other hand, it was shown that by
allowing the route lengths to be a constant factor more than B, it is possible to explore
the tree using the minimum number of agents [19]. Distributed algorithms for energy
constrained agents have been a subject of recent investigation, see e.g. [2, 7]. Authors
in [10] also consider a model in which agents are allowed to transfer part of their
energy to another agent. There are many studies on variants of the traveling salesman
problem, including the k-TSP [3, 23] related to the task of finding a bounded length
route in a graph. Such results are out of scope for this paper.
Our Results and Outline: In this work we analyze a very natural process of parti-
tioning a depth first search traversal RDFS of a tree into a sequence S = (R1 , . . . , Rk )
of routes where each route Ri has length at most B, starts and ends at the root of
the tree (see Sect. 3 for a formal definition). We prove that the number of routes k
is asymptotically optimal (Theorem 1), that is, it is within a constant factor of the
number of routes in any exploration strategy composed of routes of length at most B
that cover the entire tree. This fact, being intuitively expected for trees (although it
does not hold in general graphs [18]) turns out to be nontrivial. Our approach is to
consider another parameter of an exploration strategy: the cost (see Sect. 4) defined as
the sum of the lengths of all routes in an exploration strategy. In particular, we show
in Sect. 4 that the fact that S has small cost implies that the number of routes in S is
expectedly small. In order to prove our main result, we argue, in Sect. 5, that the cost
of S is asymptotically optimal (see Theorem 2).
We emphasize that the above claim holds independently of the choice of the initial
depth first search traversal RDFS . The implications of this fact are twofold. First, it
provides a theoretical insight into such a partitioning of a depth first search traversal
into bounded-length segments. Second, for an exploration algorithm design it means
that the routes Ri may be constructed without knowing RDFS in advance, or more
precisely, the routes may be built in an online fashion based only on the knowledge
of the subtree explored to date. This property makes our algorithm suitable for online
exploration of unknown trees by energy constrained mobile agents.
This result also makes it straightforward to make an easy linear-time implementation
of an algorithm for finding such bounded-length tree covering routes Ri : it is enough
to find any DFS traversal of the input tree and then obtain the Ri ’s by following the
formal definition in Sect. 3.
123
Algorithmica (2024) 86:3759–3782 3763
2 Exploration Strategies
l
(R) = ω({vi−1 , vi }).
i=1
We say that a vertex v is visited (and an edge {vi−1 , vi } is traversed) by the route if
v = vi for some i ∈ {1, . . . , l}. We also say that the subtree of T composed with all
vertices visited by R is covered by the route.
Given a tree T and a real number B, we say that S = (R1 , . . . , Rk ) is a B-
exploration strategy for T (or simply exploration strategy if B is clear from the context)
if for each i ∈ {1, . . . , k}, Ri is a route in T of length at most B, and each vertex of
T is visited by some route in S. We write |S| to refer to the number of routes in S,
k = |S|.
The height of a tree is the maximum weighted length of all paths between the root
and the leaves.
123
3764 Algorithmica (2024) 86:3759–3782
Fig. 1 A route RDFS and the corresponding PDFS(T ) = (R1 , R2 , R3 ) with B = 20: a a depth first search
traversal RDFS = (a, b, c, b, d, e, d, f , d, b, a, g, a); b–d routes R1 , R2 , R3 with lengths 18, 16 and 20,
respectively
(iii) the farthest v p (for p ≤ l) that satisfies the condition in (ii) is denoted as v ji , the
vertex where Ri stopped making progress,
(iv) let Ri = Pi−1 ◦ (v ji−1 , v ji−1 +1 , . . . , v ji −1 , v ji ) ◦ PiR , where Pi−1 is the path from
r to v ji−1 , and PiR is the path from v ji to r .
Such a strategy PDFS(T ) is called a DFS B-exploration. We will say that the part of
Ri containing the subsequence (v ji−1 , . . . , v ji ) makes progress on the route RDFS .
We remark that different depth first search traversals RDFS may result in different
values of k (different number of routes) in the resulting DFS B-exploration, although
for a particular choice of RDFS the corresponding PDFS(T ) is unique. In the rest of
the work we fix the route RDFS arbitrarily and thus PDFS(T ) refers to the unique DFS
B-exploration strategy obtained from this RDFS .
We also remark that, although DFS-piecemeal exploration strategies we consider
are asymptotically optimal for weighted trees, they are not necessarily optimal as
shown in an example in Fig. 2.
4 Our Results
The following theorem provides the first main result of this work.
Theorem 1 Let T be a tree and let the longest path from the root to a leaf in T be
at most B/2. It holds |PDFS(T )| ≤ 12 |R|, where R is a B-exploration strategy that
consists of the minimum number of routes.
123
Algorithmica (2024) 86:3759–3782 3765
Fig. 2 DFS-piecemeal exploration needs not be optimal: a a weighted tree with B > 10; b two routes that
provide an optimal B-exploration strategy and do not form a piecemeal DFS (each PDFS(T ) contains more
than two routes)
Proof of Theorem 1 We start with the following observation which relates the smallest
possible number of routes in a B-exploration strategy and the minimum possible cost.
observation 3 Given T and B, |R| ≥ ξ(COPT(T ))/B , where R is a B-exploration
strategy with minimum number of routes.
123
3766 Algorithmica (2024) 86:3759–3782
i ∈ {1, . . . , k − 1}. (Hence the sum of the two weights of the new edges {v ji , xi }
and {xi , v ji +1 } equals ω({v ji , v ji +1 }), the weight of the subdivided edge.) Note that
the common nodes of T and T (that is, the nodes of T ) are visited by PDFS(T )
and PDFS(T ) in the same order, both PDFS(T ) and PDFS(T ) are B-exploration
strategies and the length of each route in PDFS(T ), except for the last one, is of
length exactly B. The latter in particular implies
ξ(PDFS(T ))
PDFS(T ) = . (2)
B
Note that
ξ(COPT(T )) = ξ(COPT(T )) (3)
because, informally speaking, a strategy that minimizes the cost never reaches a node
of degree two in order to return to previously visited node — thus, in particular, a
traversal of {v ji , xi } is immediately followed by a traversal of {xi , v ji +1 } and vice
versa.
From Eq. (2), Theorem 2 applied to T , Eq. (3) and Observation 3 (used in this
order) we conclude that
ξ(PDFS(T )) ξ(COPT(T )) ξ(COPT(T ))
PDFS(T ) = ≤ 12 · = 12 ·
B B B
≤ 12 · |R| ,
and hence |PDFS(T )| = PDFS(T ) completes the proof of Theorem 1.
When referring to subtrees, we consider them always in the context of their distance
from the root. More specifically, we consider the potential of a node v, denoted by
ϕ(v), to be defined as ϕ(v) = B/2 − d(r , v). If u is the parent of v in T , then we say
that u is the higher endpoint of {u, v} and v is the lower endpoint of the edge {u, v};
we also say that {u, v} is a downward edge of u. For any subtree T of T , we define
the potential of T , denoted ϕ(T ), to be the potential of its root. Then, 2ϕ(T ) is an
upper bound on the total length of any route inside T . We say that a route reaches a
potential x in some subtree if it reaches a vertex having
potential x. Additionally, for
any subtree T of T , we denote its weight to be ω(T ) = e∈E(T ) ω(e), where E(T )
is the edge set of T . In other words, the weight of T is the total weight of its edges.
We denote by T [v] the subtree of T rooted at v that contains v and all its descendants,
and by T [e] the tree composed of the edge e and T [v] where v is the lower endpoint
of e.
We say that a subtree T of T is heavy if ω(T ) > ϕ(T ), and otherwise we say
that T is light. We extend this terminology to vertices and edges: a vertex v or an
123
Algorithmica (2024) 86:3759–3782 3767
Fig. 3 a a tree with a depth first search traversal (a, b, c, b, d, b, a, e, f , e, g, e, a); b a B -adversarial
DFS B-exploration S with B = 16 and B = 20 has three routes: (a, b, c, b, a) (with length 14 ≤ B ),
(a, b, d, b, a, e, a) (with length 18 ≤ B) and (a, e, f , e, g, e, a) (with length 16 ≤ B); ξ(S) = 14 + 18 +
16 = 48. Note that two routes (a, b, c, b, d, b, a) and (a, e, f , e, g, e, a) constitute a DFS B-exploration
strategy with the cost 34
When analyzing the cost of PDFS(T ) we will use a recursive approach where the
B-exploration of any subtree T would be defined by taking 2ϕ(T ) as the maximum
route length starting and ending at the root of T . However the first route that reaches
the subtree T may have performed other explorations before entering T . Therefore
we need to use a slightly generalized DFS B-exploration, called a B -adversarial DFS
B-exploration, denoted by ADFS B (T ), where the length of the first route is bounded
by B ≤ B. Moreover, for the simplicity of our arguments we will measure the cost of
ADFS B (T ) by taking the length of the first route to be exactly B and the length of each
subsequent route to be exactly B. Thus, we artificially increase the cost of ADFS B (T )
while keeping the number of its routes in this way. Informally speaking, we achieve
the following in this way. The fact that some routes may have length strictly smaller
than just assumed does not allow us to have any advantage in our arguments. On the
other hand, such a ‘rounding’ of the routes’ lengths will simplify some statements,
and we will make an appropriate reference to indicate where we explicitely use it.
We finally note that bounding the cost of ADFS B (T ) with such increased cost does
trivially give the required bound on the cost of PDFS(T ).
This is formally defined by replacing Eq. (1) for i = 1 in condition (ii) in the
definition of PDFS(T ) by the following equation (see also Fig. 3):
In other words, the length of the first route is bounded by B (Eq. (4)) and the
lengths of the remaining routes are bounded by B (Eq. (1) for i > 1).
123
3768 Algorithmica (2024) 86:3759–3782
In the following analysis, it will be convenient for us to use arguments that rely on
the fact that B , for our purposes, takes only one of the finite values from [0, 2ϕ(T )].
This is due to the above comment, namely, for T [r ], where r is the root of T , we have
that B = B and for any other subtree T [v], the values of B interesting for us depend
on the prefix of the route that starts at the root of T and reaches v. Thus, a simple
inductive argument allows us to conclude that the value of B depends on all possible
DFS B-exploration strategies of T (the number of those is finite). Hence, we denote
by B the finite set that consists all values B = B − x − d(r , v) such that there exists a
route in T of length x that starts at the root of T and ends at v. Thus, we can restate (5):
Intuitively, if v is any node of the tree T , then ADFS(T [v]) is the worst case scenario
of how a DFS B-exploration may perform in T [v] in terms of the cost; this worst case
is understood as considering the worst possible ending point of the route that (in the
entire tree T ) precedes the considered strategy ADFS(T [v]).
Proof Informally, equality in (6) for an optimal solution follows from the fact that
COPT(T [v]) has the freedom to pick the length of each route to be an arbitrary
number in B. Any strategies for T [e1 ], T [e2 ], . . . , T [ek ] can be translated into strategy
for T [v]: the latter one is constructed by simply concatenating the former exploration
strategies. Similarly, if one takes an exploration strategy COPT(T [v]), then one can
assume without affecting its cost that each of its routes has only two occurrences of the
root: it is the first and last vertex of the route. But then, such a strategy COPT(T [v]) can
be partitioned into the corresponding strategies for the trees T [e1 ], T [e2 ], . . . , T [ek ].
We now prove (7). Consider an exploration strategy ADFS(T [v]). Each route of this
strategy is of length at most 2ϕ(T ). Obtain an exploration strategy S by partitioning
each route in ADFS(T [v]) in such a way that the concatenation of all routes in S
123
Algorithmica (2024) 86:3759–3782 3769
equals the concatenation of all routes in ADFS(T [v]) and no route in S has v as
an internal vertex. (Thus, each route of S starts and ends at v.) Note that ξ(S) =
ξ(ADFS(T [v])). Now, S can be partitioned into S1 , . . . , Sk such that Si is a bi -
adversarial DFS exploration strategy of T [ei ] for some bi ≤ 2ϕ(T [v]), i.e., Si =
ADFSbi (T [ei ]), for each i ∈ {1, . . . , k} and the concatenation of S1 , . . . , Sk gives S.
Thus,
k
ξ(ADFS(T [v])) = ξ(S) = ξ(ADFSbi (T [ei ])).
i=1
The proof of Theorem 2 will follow from the following two results: Theorem 5
and Lemma 6, and the fact that ξ(PDFS(T )) ≤ ξ(ADFS(T )). In order to prove
Theorem 5 we will first define a special class of heavy trees called Skinny Tree which
has the following property.
(ST) Skinny Tree Property: If any vertex v of T has heavy degree equal to one, then
consider the longest path in T that connects v to such a descendant r that each
internal vertex of the u-r path has heavy degree equal to 1 (i.e., each edge of
the path is heavy). We then require that each vertex of this path, except for r ,
has at most one light edge incident to it.
For the statement of Theorem 5 we need a parameter that we denote by ϑ(T ), for
an arbitrary tree T . The reason for introducing it is technical and can be intuitively
explained as follows. In Theorem 5 we essentially need a strict inequality for trees
satisfying property (ST), e.g., in case of (i) we need ξ(ADFS(T )) < 12·ξ(COPT(T ))−
10 · ϕ(T ). This separation between the left and right hand sides of this inequality is
needed for skinny trees because of the transformation from an arbitrary tree to a tree
satisfying (ST) in Sect. 6. Thus, Theorem 5 is proved for skinny trees first (Sect. 5.3).
Then, in the end we need it to work for general trees, but here it is enough to have
a weak inequality. This distinction between weak and strict inequality for these two
types of trees dictates the definition of ϑ(T ): if T is skinny, then ϑ(T ) is the minimum
weight taken over all edges incident to the leaves of T , and if T is not skinny, then let
ϑ(T ) = 0. The exact motivation for such a definition for a skinny tree will become
clear in Sect. 6.
We will use the following technical lemma which states that it is possible to rear-
range any tree to have the above property:
123
3770 Algorithmica (2024) 86:3759–3782
Lemma 6 For any tree T, there exists ε > 0 and a corresponding tree Tε such that (i)
Tε satisfies Property (ST), and (ii) if Theorem 5 holds for Tε , then Theorem 5 holds
for T .
The proof of Lemma 6 is postponed to Sect. 6. Due to the above result, we can now
focus on proving Theorem 5 for any tree T with the above-mentioned property in the
rest of Sect. 5.
For the induction step, we assume that Theorem 5 holds for all heavy proper sub-
trees of T . In what follows we consider two cases: when heavydeg(r ) > 1 and
heavydeg(r ) = 1.
ξ(ADFS(T [ei ])) ≤ 12 · ξ(COPT(T [ei ])) − 10ϕ(T [ei ]) − ϑ(T [ei ])
123
Algorithmica (2024) 86:3759–3782 3771
for each i ∈ {1, . . . , h}. Then, by (7) of Lemma 4, by Lemma 7, and by ϕ(T ) =
ϕ(T [ei ])) (used in this order):
h
l
ξ(ADFS(T )) ≤ ξ(ADFS(T [ei ])) + ξ(ADFS(T [ei ]))
i=1 i=1
h
≤ 12ξ(COPT(T [ei ])) − 10ϕ(T [ei ]) − ϑ(T [ei ])
i=1
l
+ 2ξ(COPT(T [ei ]))
i=1
h
l
≤ 12 ξ(COPT(T [ei ])) + ξ(COPT(T [ei ]))
i=1 i=1
−10ϕ(T ) · h − ϑ(T )
≤ 12ξ(COPT(T )) − 20ϕ(T ) − ϑ(T ).
Case of heavydeg(r) = 1
See Fig. 4(a) that illustrates the path P and placements of the edges ei and the corre-
sponding potentials.
We take for brevity
1 1
wi = ω(T [ei ]) = ξ(COPT(T [ei ])) for i ∈ {1, . . . , l}, w0 = ξ(COPT(T [r ])).
2 2
Let c be the number of routes in COPT(T ), and we denote by xi the lowest potential
i-th route reached on the path P (we ignore potentials it reached in subtrees — see
Fig. 4(b)), where the routes are without loss of generality ordered so that x1 ≤ x2 ≤
· · · ≤ xc .
Consider j ∈ {1, . . . , c}. Informally speaking, the first j routes of COPT(T ) need
to cover all subtrees T [ei ] such that the potential of the higher endpoint of ei is strictly
123
3772 Algorithmica (2024) 86:3759–3782
Fig. 4 a the path P (although it may contain vertices of degree two, they are trivial from the point of view
of the analysis, thus omitted in the picture); b illustration of xi ’s. Note that the first route (and possibly
arbitrarily many more routes) always reaches r
d = min {i : y1 + · · · + yi ≥ w0 + w1 + . . . + wl } ,
in other words, assigning y j to be the first value where (8) is violated given
only y1 , . . . , y j−1 . (Notice that from the definition we have that always y j ∈
{ϕ0 , ϕ1 , . . . , ϕl }. Moreover, if y j > ϕ0 , then y j+1 > y j .) We obtain the following
lemma which says that, across all sequences satisfying (8), yi takes maximal values:
123
Algorithmica (2024) 86:3759–3782 3773
wi ≤ wi
i:ϕi ≤y j i:ϕi <x j
and by (8) and the inductive assumption applied for all indices smaller than j,
wi ≤ y1 + . . . + y j−1 .
i:ϕi <x j
Observe that ADFS(T ) first traverses (in that order) some subset of light sub-
trees T [ei ], whose indices we denote by H ⊆ {1, . . . , l}, in a decreasing order of
their indices. The above routes, none of which contains r , will form the first part
of ADFS(T ). Then, all vertices of T [r ] are visited (to those routes of ADFS(T ) we
refer as the second part of ADFS(T )) and following that, remaining light subtrees
T [ei ] for i ∈ H = {1, . . . , l} \ H , in an increasing order of their indices (third part of
ADFS(T )). Note that there may exist a route that has a non-empty intersection with a
tree T [ei ], i ∈ H ∪ H , and also contains r — this route belongs by definition to the
second part of ADFS(T ).
Denote by z 1 , . . . , z p the lowest potentials reached by subsequent routes in
ADFS(T ) on the path P (ignoring as before the potentials they reach in subtrees),
only in the first part of ADFS(T ) in the reversed order of entering T :
We note that each route in the first part of ADFS(T ) visits subtrees with a continuous
segment of indices from H , that is T [ei ]’s for i ∈ H ∩ {i 1 , . . . , i 2 } for some integers
i 1 , i 2 . Due to the weight of a light tree, its vertices belong to at most two different
routes.
Proof If y j+1 = y j then the claim follows immediately from the fact that, by (10),
z i+1 ≥ z i ≥ y j = y j+1 . Similarly, if z i ≥ y j+1 then by (10) we have z i+2 ≥ z i ≥
y j+1 . Thus, assume that y j+1 ≥ z i and y j+1 > y j .
Let a < b be indices such that y j = ϕa and y j+1 = ϕb . We have from the way y j
is selected in (9):
w0 + · · · + wb > y1 + · · · + y j ≥ w0 + · · · + wb−1 ,
123
3774 Algorithmica (2024) 86:3759–3782
We are now ready to bound the total cost of ADFS(T ) with relation to COPT(T ).
The cost of COPT(T ) can be decomposed:
where:
Olight — is the cost restricted to light subtrees T [ei ] with i ∈ {1, . . . , l},
Odeep — is the cost restricted to the subtree T [r ],
O path — is the cost restricted to the path P and the routes that do not contain r ,
and
O f lat — is the cost restricted to the path P and routes that do contain r .
where
By Lemma 7, ξ(ADFS(T [ei ])) ≤ 2ξ(COPT(T [ei ])) − ϑ(T [ei ]) for each i ∈
{1, . . . , l} and therefore
Dlight ≤ 2 · Olight − ϑ(T ). (13)
Denote by s the smallest index such that ys+1 > ϕ0 = ys and let j1 , . . . , jq ,
j1 < j2 < · · · < jq , be the potentials reached by subsequent routes in ADFS(T ).
Since z j1 ≥ ys , by iteratively applying Lemma 9 we obtain that
123
Algorithmica (2024) 86:3759–3782 3775
Therefore, by Lemma 8,
q
q
Ddesc =2 (ϕ(T ) − z ji ) = 2(ϕ(T ) − ϕ0 ) + 2 (ϕ(T ) − z ji )
i=1 i=2
q
≤ 2ω(P) + 2 (ϕ(T ) − ys+i/2−1 )
i=2
(14)
q
≤ 2ω(P) + 4 (ϕ(T ) − ys+i−1 )
i=2
q
≤ 2ω(P) + 4 (ϕ(T ) − xs+i−1 ) ≤ 2ω(P) + 2O path .
i=2
By an analogous analysis, the same bound holds for the third part of ADFS(T ):
We also get the following bounds by analyzing how much each particular route can
overlap with T [r ]. The first one follows from an observation that each route having a
non-empty intersection with T [r ] may have length restricted to T [r ] at most 2ϕ(r ).
Thus, there exist at least Odeep /(2ϕ(r )) such routes in COPT(T ) intersecting T [r ]
and each such route contributes at least 2ω(P) to O f lat . Hence,
ω(P)
O f lat ≥ · Odeep . (17)
ϕ(r )
As for an upper bound, there exist at most Ddeep /(2ϕ(r )) + 1 routes in ADFS(T )
that contain r (note that the first such route may include no other vertices except
for r from T [r ] and thus the additive factor of “+1”). Also note that we use here
the assumption that the length of each route in ADFS(T ), except for the first one, is
exactly ϕ(r ). This assumption comes from the definition of ADFS(T ). Thus,
123
3776 Algorithmica (2024) 86:3759–3782
ω(P)
Ddeep + D f lat ≤ 4ω(P) + + 1 Ddeep
ϕ(r )
ω(P)
≤ 4ω(P) + + 1 (12 · Odeep − 20ϕ(r ))
ϕ(r )
ω(P)
≤ 4ω(P) − 20 ω(P) + ϕ(r ) + 12 · Odeep +1
ϕ(r )
≤ 12Odeep + 12O f lat − 16ω(P) − 20ϕ(r ).
The last two inequalities, (11), (12) and ϕ(r ) = ω(P) + ϕ(r ) finally give
6 Tree Rearrangement
123
Algorithmica (2024) 86:3759–3782 3777
R translates to a route in Tε in the same way, except that we take x = v, i.e., v is not
replaced by the ancestor. Then, a potential strategy is a sequence consisting of at most
j potential routes, j ∈ {1, . . . , p}, where p is the number of leaves in T .
Note that a potential strategy may not translate to a valid B-exploration strategy
for T or Tε because some nodes may not be explored and some routes may be too
long. A potential strategy is feasible for T (respectively Tε ) if it translates to a valid
B-exploration strategy for T (respectively Tε ). We denote by C the collection of all
potential strategies. Clearly, the size of C is finite.
We conclude with the following:
observation 10 For any route R that may appear in ADFS(T ), COPT(T ), ADFS(Tε )
and COPT(Tε ) there exists a potential route that translates to R.
123
3778 Algorithmica (2024) 86:3759–3782
Fig. 5 a the node u of T with heavydeg(u) = 1 and light downward edges e1 , . . . , ed , d = 4; b the
corresponding edges in Tε (the “−ε” indicated that the weight of the edge is ε smaller than the weight of
the corresponding edge in T )
Since the vertex v is selected arbitrarily, we repeat the above modification for each
such vertex v obtaining the final tree Tε .
We will require the following conditions to be satisfied:
(P1) there are at most two downward edges at each vertex in Tε with heavydeg(v) =
1,
(P2) there exists a DFS traversal of Tε that visits the vertices in V (T ) in the same
order as the DFS traversal that we have fixed for T in this work,
(P3) S ∈ C is feasible for T if and only if S is feasible for Tε .
Property (P3) will be proved in Lemma 13 and we now note:
observation 11 For each ε > 0, the tree Tε satisfies Conditions (P1) and (P2).
In this section we argue that the construction of Tε ‘preserves’ the problem: the mini-
mum costs of adversarial DFS explorations of both T and Tε , as well as COPT(T ) and
COPT(Tε ) remain close to each other for ε small enough. Intuitively speaking, this
follows from a ‘continuity argument’ formalized in the remaining part of this section.
For the tree Tε we define an interval denoted by I = (0, y), y < min{ω(e) e ∈
E(T )}, such that for each ε ∈ (0, y), Condition (P3) holds for Tε . We now prove that
this interval is well defined, that is, y > 0. (Note that for ε = 0, Tε and T are the
same.)
Lemma 13 It holds I = ∅.
Proof First we argue that there exists y > 0 such that Ty fulfills Condition (P3). We
select y based on the tree T and the collection C. Consider any B ∈ B. The number
of potential strategies in C is finite, and hence the number of potential strategies in C
that do not translate to feasible ones for T (denote subset of those by C ) is also finite.
123
Algorithmica (2024) 86:3759–3782 3779
For each S ∈ C , define its deficiency x(S) as follows: the x(S) is the maximum value
such that either the length of the first route in S is B + x(S) or the length of some other
route in S in T is B + x(S). Intuitively, S does not translate to a feasible B -adversarial
B-exploration strategy for T because one of its routes exceeds the allowed length by
x(S) and no route exceeds it by more than x(S). Take
1
y := · min min{ω(e) e ∈ E(T )}, min{x(S ) S ∈ C } ,
2n(m + 1)
where m is the number edges in T . Since by definition, x(S) > 0 for each S ∈ C , we
obtain that y > 0. Also, no route in any S ∈ C traverses an edge more than 2n times
and hence the length of any route of S in Ty decreases by at most 2ynm with respect
to its length in T . This implies that some route R of S has length in Ty at least
Before we state the main lemma of this section, we prove these technical bounds:
Lemma 14 For each ε ∈ I it holds:
(i) ξ(ADFS(T )) ≤ ξ(ADFS(Tε )) + 4εn 2 ,
(ii) ϕ(T ) ≤ ϕ(Tε ) + 2nε, and
(iii) ξ(COPT(Tε )) ≤ ξ(COPT(T )).
Proof By Observation 12, both ADFS(T ) and ADFS(Tε ) visit the leaves of both trees
in the same order. Consider any edge {u, v} in T such that v is its lower endpoint.
We have that there exists a corresponding edge {u , v} in Tε . Moreover, ω({u, v}) ≤
ω ({u , v}) + ε. Due to Condition (P3), ADFS(T ) is valid because ADFS(Tε ) is valid.
This implies that for each edge traversal in ADFS(Tε ), a traversal of the corresponding
edge occurs in ADFS(T ). Thus, if t is the number of edge traversals in ADFS(T ),
then
ξ(ADFS(T )) ≤ ξ(ADFS(Tε )) + tε ≤ ξ(ADFS(Tε )) + 4n 2 ε.
The latter inequality follows from bounding each route in ADFS(Tε ) to have at most
2n edges, bounding the number of routes by n and observing that an edge is traversed
at most twice in each route.
Property (ii) is a direct consequence of the construction of Tε : any path in T that
connects a leaf to the root corresponds to a path in Tε that connects the same common
nodes and contains all common edges of the original path, and some edges that belong
only to Tε . There are at most n of the former edges, each of which differs in length
123
3780 Algorithmica (2024) 86:3759–3782
in T and Tε by at most ε, and there are at most n of the latter edges, each of which
has weight at most ε. This gives an upper bound of 2nε for the difference between
the length of an arbitrary leaf-root path of T and Tε , and this bounds the difference in
their potentials.
By construction of Tε , the distance between any common nodes u ∈ V (T ) and
v ∈ V (T ) is not greater in Tε than in T , which immediately gives (iii).
Proof of Lemma 6 Proof of Lemma 6 We will analyze condition (i) in Theorem 5 and
the proof for (ii) is analogous as we note at the end of the proof.
We may assume (by taking ε small enough, i.e., ε < ϑ(T )/2) that all trees Tε we
consider satisfy ϑ(Tε ) ≥ ϑ(T )/2. Thus, ϑ(Tε ) is in this sense independent of however
small is the chosen value of ε ∈ I. Then by Theorem 5(i):
ϑ(T )
ε< ,
12n 2
such that Tε satisfies Condition (P3). Then, by Lemma 14 (in particular, (i) of
Lemma 14 is used to obtain the first inequality below and (ii) and (iii) are used to
obtain the fourth inequality below) we get:
Since ϑ(T ) = 0 by definition, this completes the proof. We can conduct the same
argument for Theorem 5(ii) with the same value of ε. Hence we obtain that Theorem 5
holds for T .
123
Algorithmica (2024) 86:3759–3782 3781
may cover the tree with 3 routes, while the optimal is 2 routes). This leaves a gap
between the lower and upper bounds and the interesting open question is whether the
strategy PDFS(T ) is the best possible algorithm? Another open problem is to analyze
similar strategies in other, more general, classes of graphs instead of trees.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which
permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give
appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence,
and indicate if changes were made. The images or other third party material in this article are included
in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If
material is not included in the article’s Creative Commons licence and your intended use is not permitted
by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the
copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
References
1. Ambühl, C., Ga˛sieniec, L., Pelc, A., Radzik, T., Zhang, X.: Tree exploration with logarithmic memory.
ACM Trans. Algorithms 7(2), 17:1-17:21 (2011)
2. Anaya, J., Chalopin, J., Czyzowicz, J., Labourel, A., Pelc, A., Vaxès, Y.: Convergecast and broadcast
by power-aware mobile agents. Algorithmica 74(1), 117–155 (2016)
3. Arora, S.: Polynomial time approximation schemes for Euclidean traveling salesman and other geo-
metric problems. J. ACM 45(5), 753–782 (1998)
4. Awerbuch, B., Betke, M., Rivest, R.L., Singh, M.: Piecemeal graph exploration by a mobile robot. Inf.
Comput. 152(2), 155–172 (1999)
5. Awerbuch, B., Kobourov, S.G.: Polylogarithmic-overhead piecemeal graph exploration. In Proceedings
of the Eleventh Annual Conference on Computational Learning Theory, COLT 1998, 280–286 (1998)
6. Bampas, E., Chalopin, J., Das, S., Hackfeld, J., Karousatou, C.: Maximal exploration of trees with
energy-constrained agents. CoRR, arXiv:1802.06636 (2018)
7. Bärtschi, A., Chalopin, J., Das, S., Disser, Y., Geissmann, B., Graf, D., Labourel, A., Mihalák, M.:
Collaborative delivery with energy-constrained mobile robots. In Proceedings of Structural Informa-
tion and Communication Complexity—23rd International Colloquium, SIROCCO 2016, pp. 258–274
(2016)
8. Betke, M., Rivest, R.L., Singh, M.: Piecemeal learning of an unknown environment. Mach. Learn.
18(2–3), 231–254 (1995)
9. Brass, P., Cabrera-Mora, F., Gasparri, A., Xiao, J.: Multirobot tree and graph exploration. IEEE Trans.
Robot. 27(4), 707–717 (2011)
10. Czyzowicz, J., Diks, K., Moussi, J., Rytter, W.: Communication problems for mobile agents exchanging
energy. In Proceedings of Structural Information and Communication Complexity—23rd International
Colloquium, SIROCCO 2016, pp. 275–288, (2016)
11. Das, S.: Graph explorations with mobile agents. In Distributed Computing by Mobile Entities, Current
Research in Moving and Computing. vol. 11340 of Lecture Notes in Computer Science, pp. 403–422.
Springer (2019)
12. Das, S., Dereniowski, D., Karousatou, C.: Collaborative exploration of trees by energy-constrained
mobile robots. Theory Comput. Syst. 62(5), 1223–1240 (2018)
13. Das, S., Dereniowski, D., Uznański, P.: Brief announcement: energy constrained depth first search.
In 45th International Colloquium on Automata, Languages, and Programming, ICALP 2018, Prague,
Czech Republic, pp. 165:1–165:5 (2018)
14. Dereniowski, D., Disser, Y., Kosowski, A., Paja˛k, D., Uznański, P.: Fast collaborative graph exploration.
Inf. Comput. 243, 37–49 (2015)
15. Disser, Y., Hackfeld, J., Klimm, M.: Undirected graph exploration with (log log N ) pebbles. In
Proceedings of the twenty-seventh annual ACM-SIAM symposium on discrete algorithms, SODA
2016, 25–39 (2016)
123
3782 Algorithmica (2024) 86:3759–3782
16. Disser, Y., Mousset, F., Noever, A., Skoric, N., Steger, A.: A general lower bound for collaborative tree
exploration. In Structural information and communication complexity—24th international colloquium,
SIROCCO 2017, Porquerolles, France, 2017, Revised Selected Papers, pp. 125–139. (2017)
17. Dobrev, S., Královic, R., Markou, E.: Online graph exploration with advice. In Proceedings of structural
information and communication complexity—19th international colloquium, SIROCCO 2012, pp.
267–278 (2012)
18. Duncan, C.A., Kobourov, S.G., Anil Kumar, V.S.: Optimal constrained graph exploration. ACM Trans.
Algorithms 2(3), 380–402 (2006)
19. Dynia, M., Korzeniowski, M., Schindelhauer, C.: Power-aware collective tree exploration. In Proceed-
ings of Architecture of Computing Systems—ARCS 2006, 19th International Conference, pp. 341–351
(2006)
20. Dynia, M., Kutyłowski, J., Friedhelm, H., Meyer auf der, Schindelhauer, C.: Smart robot teams explor-
ing sparse trees. In Proceedings of Mathematical Foundations of Computer Science, 31st International
Symposium, MFCS 2006, pp. 327–338 (2006)
21. Dynia, M., Łopuszanski, J., Schindelhauer, C.: Why robots need maps. In Proceedings of Structural
Information and Communication Complexity, 14th International Colloquium, SIROCCO 2007, pp.
41–50, (2007)
22. Fraigniaud, P., Ga˛sieniec, L., Kowalski, D.R., Pelc, A.: Collective tree exploration. Networks 48(3),
166–177 (2006)
23. Frederickson, G.N., Hecht, M.S., Kim, C.E.: Approximation algorithms for some routing problems.
SIAM J. Comput. 7(2), 178–193 (1978)
24. Higashikawa, Y., Katoh, N., Langerman, S., Tanigawa, S.: Online graph exploration algorithms for
cycles and trees by multiple searchers. J. Comb. Optim. 28(2), 480–495 (2014)
25. Megow, N., Mehlhorn, K., Schweitzer, P.: Online graph exploration: New results on old and new
algorithms. Theor. Comput. Sci. 463, 62–72 (2012)
26. Ortolf, C., Schindelhauer, C.: A recursive approach to multi-robot exploration of trees. In Proceedings
of Structural Information and Communication Complexity—21st international colloquium, SIROCCO
2014, pp. 343–354 (2014)
27. Panaite, P., Pelc, A.: Exploring unknown undirected graphs. J. Algorithms 33(2), 281–295 (1999)
Publisher’s Note Springer Nature remains neutral with regard to jurisdictional claims in published maps
and institutional affiliations.
123