Graph Searching with Predictions
Abstract
Consider an agent exploring an unknown graph in search of some goal state. As it walks around the graph, it learns the nodes and their neighbors. The agent only knows where the goal state is when it reaches it. How do we reach this goal while moving only a small distance? This problem seems hopeless, even on trees of bounded degree, unless we give the agent some help. This setting with “help” often arises in exploring large search spaces (e.g., huge game trees) where we assume access to some score/quality function for each node, which we use to guide us towards the goal. In our case, we assume the help comes in the form of distance predictions: each node provides a prediction of its distance to the goal vertex. Naturally if these predictions are correct, we can reach the goal along a shortest path. What if the predictions are unreliable and some of them are erroneous? Can we get an algorithm whose performance relates to the error of the predictions?
In this work, we consider the problem on trees and give deterministic algorithms whose total movement cost is only , where is the distance from the start to the goal vertex, the maximum degree, and the is the total number of vertices whose predictions are erroneous. We show this guarantee is optimal. We then consider a “planning” version of the problem where the graph and predictions are known at the beginning, so the agent can use this global information to devise a search strategy of low cost. For this planning version, we go beyond trees and give an algorithms which gets good performance on (weighted) graphs with bounded doubling dimension.
1 Introduction
Consider an agent (say a robot) traversing an environment modeled as an undirected graph . It starts off at some root vertex , and commences looking for a goal vertex . However, the location of this goal is initially unknown to the agent, who gets to know it only when it visits vertex . So the agent starts exploring from , visits various vertices in one by one, until it reaches . The cost it incurs at timestep is the distance it travels to get from to . How can the agent minimize the total cost? This framework is very general, capturing not only problems in robotic exploration, but also general questions related to game tree search: how to reach a goal state with the least effort?
Since this is a question about optimization under uncertainty, we use the notion of competitive analysis: we relate the cost incurred by the algorithm on an instance to the optimal cost incurred in hindsight. The latter is just the distance between the start and goal vertices. Sadly, a little thought tells us that this problem has very pessimistic guarantees in the absence of any further constraints. For example, even if the graph is known to be a complete binary tree and the goal is known to be at some distance from the root, the adversary can force any algorithm to incur an expected cost of . Therefore the competitiveness is unbounded as gets large. This is why previous works in online algorithms enforced topological constraints on the graph, such as restricting the graph to be a path, or paths meeting at the root, or a grid [BYCR93].
But in many cases (such as in game-tree search) we want to solve this problem for broader classes of graphs—say for complete binary trees (which were the bad example above), or even more general settings. The redeeming feature in these settings is that we are not searching blindly: the nodes of the graph come with estimates of their quality, which we can use to search effectively. What are good algorithms in such settings? What can we prove about them?
In this paper we formalize these questions via the idea of distance predictions: each node gives a prediction of its distance to the goal state. If these predictions are all correct, we can just “walk downhill”—i.e., starting with being the start node, we can move at each timestep to a neighbor of with . This reaches the goal along a shortest path. However, getting perfect predictions seems unreasonable, so we ask:
What if a few of the predictions are incorrect? Can we achieve an “input-sensitive” or “smooth” or “robust” bound, where we incur a cost of some function of the prediction error?
We consider two versions of the problem:
-
The Exploration Problem. In this setting the graph is initially unknown to the agent: it only knows the vertex , its neighbors , and the predictions on all these nodes. In general, at the beginning of time , it knows the vertices visited in the past, all their neighboring vertices , and the predictions for all the vertices in . The agent must use this information to move to some unvisited neighbor (which is now called ), paying a cost of . It then observes the edges incident to , along with the predictions for nodes newly observed.
-
The Planning Problem. This is a simpler version of the problem where the agent starts off knowing the entire graph , as well as the predictions at all its nodes. It just does not know which node is the goal, and hence it must traverse the graph in some order.
The cost in both cases is the total distance traveled by the agent until it reaches the goal, and the competitive ratio is the ratio of this quantity to the shortest path distance from the root to the goal.
1.1 Our Results
Our first main result is for the (more challenging) exploration problem, for the case of trees.
Theorem 1.1 (Exploration).
The (deterministic) TreeX algorithm solves the graph exploration problem on trees in the presence of predictions: on any (unweighted) tree with maximum degree , for any constant , the algorithm incurs a cost of
where is the set of vertices that give erroneous predictions.
One application of the above theorem is for the layered graph traversal problem (see §1.3 for a complete definition).
Corollary 1.2 (Robustness and Consistency for the Layered Graph Traversal problem.).
There exists an algorithm that achieves the following guarantees for the layered graph traversal problem in the presence of predictions: given an instance with maximum degree and width , for any constant , the algorithm incurs an expected cost of at most .
The proof of the above corollary is immediate: Since the input is a tree (with some additional structure that we do not require) that is revealed online, we can use the algorithm from Theorem 1.1. Hence, given an instance of layered graph traversal (with predictions), we can use the algorithm from Theorem 1.1 in combination with the [BCR22], thereby being both consistent and robust: if the predictions are of high quality, then our algorithm ensures that the cost will be nearly optimal; otherwise if the predictions are useless, [BCR22]’s algorithm gives an upper bound in the worst case.
Moreover, we show that the guarantee obtained in Theorem 1.1 is the best possible, up to constants.
Theorem 1.3 (Exploration Lower Bound).
Any algorithm (even randomized) for the graph exploration problem with predictions must incur a cost of at least .
Proof.
The lower bound of is immediate. For the second term, consider the setting where the root has disjoint paths of length leaving it, and the goal is guaranteed to be at one of the leaves. Suppose we are given the “null” prediction, where each vertex predicts (where is the distance of the vertex from the root, which we henceforth refer to as the level of the vertex). The erroneous vertices are the vertices along the - path. Since the predictions do not give any signal at all (they can be generated by the algorithm itself), this is a problem of guessing which of the leaves is the goal, and any algorithm, even randomized, must travel before reaching the goal. ∎
Our next set of results are for the planning problem, where we know the graph and the predictions up-front, and must come up with a strategy with this global information.
Theorem 1.4 (Planning).
For the planning version of the graph exploration problem, there is an algorithm that incurs cost at most
-
(i)
if the graph is a tree, where is the maximal degree.
-
(ii)
where is the doubling dimension of .
Again, is the set of nodes with incorrect predictions.
Note that result (i) is very similar to that of Theorem 1.1 (for the harder exploration problem): the differences are that we do not lose any constant in the distance term, and also that the algorithm used here (for the planning problem) is simpler. Moreover, the lower bound from Theorem 1.3 continues to hold in the planning setting, since the knowledge of the graph and the predictions does not help the algorithm; hence result (i) is tight.
We do not yet know an analog of result (ii) for the exploration problem: extending Theorem 1.1 to general graphs, even those with bounded doubling metrics remains a tantalizing open problem. Moreover, we currently do not have a lower bound matching result (ii); indeed, we conjecture that a cost of should be achievable. We leave these as questions for future investigation.
1.2 Our Techniques
To get some intuition for the problem, consider the case where given a tree and a guarantee that the goal is at distance from the start node . Suppose each node gives the “null” prediction of . In case the tree is a complete binary tree, then these predictions carry no information and we would have to essentially explore all nodes within distance . But note that the predictions for about half of these nodes are incorrect, so these erroneous nodes can pay for this exploration. But now consider a “lopsided” example, with a binary tree on one side of the root, and a path on the other (Figure 1). Suppose the goal is at distance along the path. In this case, only the path nodes are incorrect, and we only have budget for the exploration. In particular, we must explore more aggressively along the path, and balance the exploration on both sides of the root. But such gadgets can be anywhere in the tree, and the predictions can be far more devious than the null-prediction, so we need to generalize this idea.
We start off with a special case which we call the known-distance case. This is almost the same as the general problem, but with the additional guarantee that the prediction of the root is correct. Equivalently, we are given the distance of the goal vertex from the root/starting node . For this setting, we can get the following very sharp result:
Theorem 1.5 (Known-Distance Case).
The TreeX-KnownDist algorithm solves the graph exploration problem in the known-distance case, incurring a cost of at most .
Hence in the zero-error case, or in low-error cases where , the algorithm loses very little compared to the optimal-in-hindsight strategy, which just walks from the root to the goal vertex, and incurs a cost of . This algorithm is inspired by the “lopsided” example above: it not only balances the exploration on different subtrees, but also at multiple levels. To generalize this idea from predictions, we introduce the concepts of anchor and loads (see §2). At a high level, for each node we consider the subtrees rooted at its children, and identify subset of nodes in each of these subtrees which are erroneous depending on which subtree contains the goal . We ensure that these sets have near-equal sizes, so that no matter which of these subtrees contains the goal, one of them can pay for the others. This requires some delicacy, since we need to ensure this property throughout the tree. The details appear in §3.
Having proved Theorem 1.5, we use the algorithm to then solve the problem where the prediction for the root vertex may itself be erroneous. Given Theorem 1.5 and Algorithm 1, we can reduced the problem to finding some node such that is known; moreover this must not be very far from the start node . The idea is conceptually simple: as we explore the graph, if most predictions are correct we can use these predictions to find such a , otherwise these incorrect predictions give us more budget to continue exploring. Implementing this idea (and particularly, doing this deterministically) requires us to figure out how to “triangulate” with errors, which we do in §4.
Finally, we give the ideas behind the algorithms for the planning version of the problem. The main idea is to define the implied-error function , which measures the error if the goal is sitting at node . Since we know all the predictions and the tree structure in this version of the problem, and moreover , it is natural to search the graph greedily in increasing order of the implied-error. However, naively doing this may induce a large movement cost, so we bucket nodes with similar implied-error together, and then show that the total cost incurred in exploring all nodes with is itself close to (times a factor that depends on the degree or the doubling dimension). It remains an interesting open problem to extend this algorithm to broader classes of graphs. The details here appear in §5.
1.3 Related Work
Graph Searching. Graph searching is a fundamental problem, and there are too many variants to comprehensively discuss: we point to the works closest to ours. Baeza-Yates, Culberson, and Rawlins [BYCR93] considered the exploration problem without predictions on the line (where it is also called the “cow-path” problem), on -spiders (i.e., where semi-infinite lines meet at the root) and in the plane: they showed tight bounds of on the deterministic competitive ratio of the line, for -spiders, among other results. Their lower bounds (given for “monotone-increasing strategies”) were generalized by Jaillet and Stafford [JS01]; [JSG02] point out that the results for -spiders were obtained by Gal [Gal80] before [BYCR93] (see also [AG03]). Kao et al. [KRT96, KMSY98] give tight bounds for both deterministic and randomized algorithms, even with multiple agents.
The layered graph traversal problem [PY91] is very closely related to our model. A tree is revealed over time. At each timestep, some of the leaves of the current tree die, and others have some number of children. The agent is required to sit at one of the current (living) leaves, so if the node the agent previously sat is no longer a leaf or is dead, the agent is forced to move. The game ends when the goal state is revealed and objective is to minimize the total movement cost. The width of the problem is the largest number of leaves alive at any time (observe that we do not parameterize our algorithm with this parameter). This problem is essentially the cow-path problem for the case of , but is substantially more difficult for larger widths. Indeed, the deterministic bounds lie between [FFK+98] and [Bur96]. Ramesh [Ram95] showed that the randomized version of this problem has a competitive ratio at least for any ; moreover, his -competitive algorithm was improved to a nearly-tight bound of in recent exciting result by Bubeck, Coester, and Rabani [BCR22].
Kalyanasundaram and Pruhs [KP93] study the exploration problem (which they call the searching problem) in the geometric setting of polygonal obstacles with bounded aspect ratio in the plane. Some of their results extend to the mapping problem, where they must determine the locations of all obstacles. Deng and Papadimitriou [DP99] study the mapping problem, where the goal is to traverse all edges of an unknown directed graph: they give an algorithm with cost for Eulerian graphs (whereas ), and cost for graphs with imbalance at most . Deng, Kameda, and Papadimitriou [DKP98] give an algorithm to map two-dimensional rectilinear, polygonal environments with a bounded number of obstacles.
Kalyanasundaram and Pruhs [KP94] consider a different version of the mapping problem, where the goal is to visit all vertices of an unknown graph using a tour of least cost. They give an algorithm that is -competitive on planar graphs. Megow et al. [MMS12] extend their algorithm to graphs with bounded genus, and also show limitations of the algorithm from [KP94].
Blum, Raghavan and Schieber [BRS97] study the point-to-point navigation problem of finding a minimum-length path between two known locations and in a rectilinear environment; the obstacles are unknown axis-parallel rectangles. Their -competitiveness is best possible given the lower bound in [PY91]. [KRR94] give lower bounds for randomized algorithms in this setting.
Our work is related in spirit to graph search algorithms like -search which use score functions to choose the next leaf to explore. One line of work giving provably good algorithms is that of Goldberg and Harrelson [GH05] on computing shortest paths without exploring the entire graph. Another line of work related in spirit to ours is that of Karp, Saks, and Wigderson [KSW86] on branch-and-bound (see also [KZ93]).
Noisy Binary Search. A very closely related line of work is that of computing under noisy queries [FRPU94]. In this widely-used model, the agent can query nodes: each node “points” to a neighbor that is closer to the goal, though some of these answers may be incorrect. Some of these works include [OP06, MOW08, EKS16, DMS19, DTUW19, BFKR21]. Apart from the difference in the information model (these works imagine knowing the entire graph) and the nature of hints (“gradient” information pointing to a better node, instead of information about the quality/score of the node), these works often assume the errors are independent, or adversarial with bounded noise rate. Most of these works allow random-access to nodes and seek to minimize the number of queries instead of the distance traveled, though an exception is the work of [BFKR21]. As far as we can see, the connections between our models is only in spirit. Moreover, we show in §7.3 that results of the kind we prove are impossible if the predictions don’t give us distance information but instead just edge “gradients”.
Algorithms with Predictions. Our work is related to the exciting line of research on algorithms with predictions, such as in ad-allocation [MNS07], auction pricing [MV17], page migration [IMTMR20], flow allocation [LMRX20], scheduling [PSK18, LLMV20, Mit20], frequency estimation [HIKV19], speed scaling [BMRS20], Bloom filters [Mit18], bipartite matching and secretary problems [AGKK20, DLLV21], and online linear optimization [BCKP20].
2 Problem Setup and Definitions
We consider an underlying graph with a known root node and an unknown goal node . (For most of this paper, we consider the unweighted setting where all edge have unit length; §5.3 and §7.2 discuss cases where edge lengths are positive integers.) Each node has degree at most . Let denote the distance between nodes for any , and let be the optimal distance from to the goal node .
Let us formally define the problem setup. An agent initially starts at root , and wants to visit goal while traversing the minimum number of edges. In each timestep , the agent moves from some node to node . We denote the visited vertices at the start of round by (with ), and use to denote the neighboring vertices—those not in but having at least one neighbor in . Their union is the set of observed vertices at the end of time . Each time the agent visits a new node such that , and it pays the movement cost , where . Finally, when and the agent has reached the goal, the algorithm stops. The identity of the goal vertex is known when—and only when—the agent visits it, and we let denote this timestep. Our aim is to design an algorithm that reaches the goal state with minimum total movement cost:
Within the above setting, we consider two problems:
-
•
In the planning problem, the agent knows the graph (though not the goal ), and in addition, is given a prediction for each of its distance to the goal ; it can then use this information to plan its search trajectory.
-
•
In the exploration problem, the graph and the predictions are initially unknown to the agent, and these are revealed only via exploration; in particular, upon visiting a node for the first time, the agent becomes aware of previously unobserved nodes in ’s neighborhood. Thus, at the end of timestep , the agent knows the set of visited vertices , neighboring vertices , and the predictions for each observed vertex .
In both cases, we define to be the set of erroneous nodes. Extending this notation, for the exploration problem, we define as the erroneous nodes visited by time .
3 Exploring with a Known Target Distance
Recall that our algorithm for the exploration problem on trees proceeds via the known-distance version of the problem: in addition to seeing the predictions at the various nodes as we explore the tree, we are promised that the distance from the starting node/root to the goal state is is exactly some value , i.e., . The main result of this section is Theorem 1.5, and we restate a rigorous version here.
Theorem 3.1.
If , the algorithm finds the goal node incurring a cost of at most .
Algorithm TreeX-KnownDist is stated in Algorithm 1. For better understanding of it, we first give some key definitions.
3.1 Definitions: Anchors, Degeneracy, and Criticality
For an unweighted tree , we define the level of node with respect to the root to be , and so level denotes the set of nodes such that . Since the tree is rooted, there are clearly defined notions of parent and child, ancestor and descendent. Each node is both an ancestor and a descendant of itself. For any node , let denote the subtree rooted at . Extending this notation, we define the visited subtree , and the extended subtree , and let and be the subtrees of and rooted at .
Definition 3.2 (Active and Degenerate nodes).
In the exploration setting, at the end of timestep , a node is
active if , i.e., there are observed descendants of (including itself) that have not been visited.
An active node is degenerate at the end of timestep if
it has a unique child node in that is active.
In other words, all nodes which have un-visited descendants (including those in the frontier ) are active. Active nodes are further partitioned into degenerate nodes that have exactly one child subtree that has not been fully visited, and active nodes that have at least two active children. See Fig. 3 for an illustration.
A crucial definition for our algorithms is that of anchor nodes:
Definition 3.3 (Anchor).
For node , define its anchor to be its ancestor in level . If the value is negative, or is not an integer, or node itself belongs at level smaller than , we say that has no anchor and that .
Fig. 3 demonstrates the location of an anchor node for given node ; it also illustrates the following claim, which forms the main rationale behind the definition:
Claim 3.4.
If the prediction for some node is correct, then its anchor is the least common ancestor (in terms of level ) of and the goal . Consequently, if a node has no anchor, or if its anchor does not lie on the path from to , then .
The second and third figures give an example of anchor node (in yellow) at level for given node (in red) at level . The rightmost figure (with root and goal also indicated) illustrates Claim 3.4, showing that when ’s prediction is correct, then its anchor is the least common ancestor of and goal (since is equal to twice the distance of from ).
For any node , define its children be for , where is the number of children for . Note that the order is arbitrary but prescribed and fixed throughout the algorithm. For any time , node , and , define the visited portion of the subtree rooted at the child as .
Definition 3.5 (Loads and ).
For any time , node , and index , define
In other words, is the number of nodes in that have as their anchor. Define to be the total number of nodes in which have as their anchor.
Definition 3.6 (Critical Node).
For any time , active and non-degenerate node , and index , let . Call a critical node with respect to at time if it satisfies
-
(i)
, namely, the number of nodes of that have as their anchor is at least twice larger than the number of nodes of that have as their anchor; and
-
(ii)
, namely, at least half of the nodes of have as their anchor.
3.2 The TreeX-KnownDist Algorithm
Equipped with the definitions in §3.1, at a high level, the main idea of the algorithm is to balance the loads (as defined in Definition 3.5) of all the nodes . Note that if the goal , then the nodes that have as their anchor (i.e., ) have erroneous predictions; hence balancing the loads automatically balances the cost and the budget. To balance the loads, we use the definition of a critical node (see Definition 3.6): whenever a node becomes critical, the algorithm goes back and explores another subtree of , thereby maintaining the balance.
More precisely, our algorithm TreeX-KnownDist does the following: at each time step , it checks whether there is a node that is critical. If there is no such node, the algorithm performs one more step of the current DFS, giving priority to the unexplored child of with smallest prediction. On the other hand, if there is a critical node , then this must be the anchor . In this case the algorithm pauses the current DFS, returns to the anchor and resumes the DFS in ’s child subtree having the smallest load (say ). This DFS may have been paused at some time , and hence is continued starting at node . The variable saves the vertex that the algorithm left the subtree rooted on last time. For example, in this case . If no such time exists, the algorithm starts a new DFS from some child of whose subtree has the smallest load (in this case, ). The pseudocode appears as Algorithm 1.
A few observations: (a) While does not appear explicitly in the algorithm, it is used in the definition of anchors (recall Definition 3.3). Even when , the predicted distance at the root, is not the true distance to the goal (as may happen in Section 4), given any input in Algorithm 1, we will still define to be ’s ancestor at level . (b) The new node is always on the frontier: i.e., the nodes which are either leaves of or have unvisited children. Moreover, (c) the memory value if and only if , else is on the frontier in the subtree below .
3.3 Analysis for the TreeX-KnownDist Algorithm
The proof of Theorem 3.1 proceeds in two steps. The first step is to show that the total amount of “extra” exploration, i.e., the number of nodes that do not lie on the - path, is . Formally, let denote the - path; for the rest of this section, suppose for all . Define the extra exploration to be the number of nodes visited in the subtrees hanging off this path:
Lemma 3.7 (Bounded Extra Exploration).
For all times , .
Next, we need to control the total distance traveled, which is the second step of our analysis:
Lemma 3.8 (Bounded Cost).
For all times ,
Using the lemmas above (setting to be the time when we reach the goal) proves Theorem 1.5. In the following sections, we now prove Lemmas 3.7 and 3.8.
3.4 Bounding the Extra Exploration
Lemma 3.9.
For any node , define as follows:
-
1.
if , then .
-
2.
if , let . Define , and .
Then .
Proof.
Let be the - path in . If (i.e., ), then by Claim 3.4 all the nodes with as anchor belong to . Else suppose (i.e., ), and suppose . Now all nodes in having anchor belong to , since the least common ancestor of and can be no higher than . This means
Finally, suppose (i.e., ) and . Now for any node for , the least common ancestor of and is . Hence nodes in for whose anchor is not must be wrongly predicted. Denote the set of such nodes by . Note that , and for each are disjoint. Hence we have
Summing the two inequalities we get the proof. ∎
Lemma 3.10.
For any node and any index such that . If for some then .
Proof.
The proof is by contradiction. Assume there is such a time , and let . Since , the subtree under node was not fully visited at time and hence was active. By the definition of and the condition on in the lemma statement, we have . Now Algorithm 1 will ensure that either remains in or moves into . ∎
Lemma 3.11.
For any node on the - path , recall the assumption that . For any time and any , at least one of the following statements must hold:
-
(I)
.
-
(II)
.
-
(III)
.
Proof.
For sake of a contradiction, assume there exists such that at time none of the three statements are true, and this is the first such time. If , then the falsity of second statement gives , and so . Then the first statement being false implies , which means the third statement must hold.
Henceforth let us assume . Let be the latest time such and . Because the second statement is false, , and so such a time exists.
Since is the latest time satisfying the condition, we have . Moreover, the number of nodes in whose anchor is not does not decrease, hence . Also, the number of nodes in whose anchor is does not decrease, hence .
Thus we can get
(1) | ||||
Now if is completely visited, then obviously . Otherwise, is active. Also because , hence cannot be completely visited unless the algorithm ends, which means is not degenerate and is still active. Furthermore, we have inequalities (1), hence must be critical w.r.t. the subtree containing (because taking we get the two inequalities for critical hold, although may not be the smallest one). Hence at time the algorithm will go to a node which is not in .
If : Note that one of the three statements holds for . If one of the first two statements is true to , then the same statement is also true to because , and . Otherwise we have . Then if , then the third statement is true to ; if , then the first statement is true to .
Otherwise : By Lemma 3.10, there must exist a time such that (otherwise the algorithm will never enter since is always active). Hence by the analysis before, we have . Because is defined as the latest time before when , we have . Hence , which is the first statement in this lemma. ∎
Lemma 3.12.
For any node on the - path , and any time ,
-
(i)
if for all then ,
-
(ii)
else .
Proof.
For the first case: if for all , then is the smallest label among all since the predictions are all correct. Hence by the algorithm, the first node reached among must be , which means the third statement in Lemma 3.11 cannot hold. By Lemma 3.11, for any , or .
If : ; If : . Either of them can lead to a conclusion that
Denote . Then by and the inequality above, we have .
Hence . Here the last equality is because of Lemma 3.9.
Second, consider other cases. By Lemma 3.11, or .
If : ; If : . Either of them can lead to a conclusion that
Denote , then .
Consequently , where the last equality is because of Lemma 3.9. ∎
We can finally bound the extra exploration.
3.5 Bounding the Movement Cost
In this subsection, we bound the total movement cost (and not just the number of visited nodes), thereby proving Lemma 3.8.
First, we partition the edge traversals made by the algorithm into downwards (from a parent to a child) and upwards (from a child to its parent) traversals, and denote the cost incurred by the downwards and upwards traversals until time by and respectively. We start at the root and hence get ; since we care about the time when we reach the goal state , we have
(5) |
It now suffices to bound the upwards movement . For any edge with being the parent and the child, we further partition the upwards traversals along this edge into two types:
-
(i)
upward traversals when the if statement is true at time for a node (which lies at or below ) and we move the traversal to another subtree of (which lies at or above ), and
-
(ii)
the unique upward traversal when we have completely visited the subtree under the edge.
The second type of traversal happens only once, and it never happens for the edges on the - path (since those edges contain the goal state under it, which is not visited until the very end). Hence the second type of traversals can be charged to the extra exploration . It remains to now bound the first type of upwards traversals, which we refer to as callback traversals.
We further partition the callback traversals based on the identity of the anchor which was critical at that timestep: let denote the callback traversal cost at those times when . Hence the total cost of callback traversals is , and
(6) |
We now control each term of the latter sum.
Lemma 3.13.
For any time and any node , .
Proof.
For node and index , let be the set of times for which and the if condition is satisfied with (i.e, , is active and not degenerate and is critical w.r.t. the subtree containing at time ). The cost of the upwards movement at this time is ; the latter inequality is true by criticality.
Lemma 3.10 ensures that we only enter from a node outside it at some time when . Hence, if then for each there must exist a time satisfying such that . Consequently,
Hence, for each ,
(7) |
This is the contribution due to a single subtree ; summing over all subtrees gives a bound of , as claimed. ∎
Proof of Lemma 3.8.
The equation (6) bounds the total movement cost until time in terms of , the extra exploration, and the “callback” (upwards) traversals . LABEL:lemma:_alg2_bounded_callback_cost_foreach_node above bounds each term by . To bound this last summation,
-
•
For each , by Lemma 3.9.
- •
Summing over all (using Lemma 3.9), and substituting into (6) gives the claim. ∎
4 The General Tree Exploration Algorithm
We now build on the ideas from known-distance case to give our algorithm for the case where the true target distance is not known in advance, and we have to work merely with the predictions. Recall the guarantee we want to prove: See 1.1
Note that Algorithm TreeX-KnownDist requires knowing exactly in computing anchors; an approximation to does not suffice. Because of this, a simple black-box use of Algorithm TreeX-KnownDist using a “guess-and-double” strategy does not seem to work. The main idea behind our algorithm is clean: we explore increasing portions of the tree. If most of the predictions we see have been correct, we show how to find a node whose prediction must be correct. Now running Algorithm 1 rooted at this node can solve the problem. On the other hand, if most of predictions that we have seen are incorrect, this gives us enough budget to explore further.
4.1 Definitions
Definition 4.1 (Subtree ).
Given a tree , node and its neighbor , let denote the set of nodes such that the path from to contains .
Lemma 4.2 (Tree Separator).
Given a tree with maximum degree and nodes, there exists a node and two neighbors such that and . Moreover, such can be found in linear time.
Proof.
Let be a centroid of tree , i.e., a vertex such that deleting from breaks it into a forest containing subtrees of size at most [Jor69]. Each such subtree corresponds to some neighbor of . Let be the neighbors corresponding to the two largest subtrees. Then . Moreover the second largest subtree may contain when . ∎
Definition 4.3 (Vote and Dominating vote ).
Given a center , let the vote of any node be . For any set of nodes , define the dominating vote to be if for at least half of the nodes . If such majority value does not exist, define .
4.2 The TreeX Algorithm
Given these definitions, we can now give the algorithm. Recall that Theorem 3.1 says that Algorithm 1 finds in steps, for some constant . We proceed in rounds: in round we run Algorithm 1 and visit approximately vertices, where is a parameter to be chosen later. Now we focus on two disjoint and “centrally located” subtrees of size within the visited nodes. Either the majority of these nodes have correct predictions, in which case we use their information to identify one correct node. Else a majority of them are incorrect, in which case we have enough budget to go on to the next round. A formal description appears in Algorithm 2.
4.3 Analysis of the TreeX Algorithm
Lemma 4.4.
If the goal is not visited before round when , we have .
Proof.
First, if , then the conclusion holds obviously. So next we assume . The execution of Algorithm 1 in round visits at least distinct nodes. Using the assumption on , we have
Lemma 4.2 now implies that both the subtrees and contain more than nodes. Since at most nodes are erroneous, more than half of the nodes in each of and have correct predictions.
Finally, observe that if , then for any correct node in we have , and hence its vote . Since a majority of nodes in are correct, we get
(8) |
On the other hand, if , then for any correct node in we have . Thus its vote, and hence the vote of a strict majority of nodes in the subtree have
(9) |
If no value is in a strict majority, recall that we define , which also satisfies (9). The same arguments hold for the subtree as well. Since the goal belongs to at most one of these subtrees, we have that , as claimed. ∎
Lemma 4.5.
For any round , . Moreover, for any round such that , .
Proof.
Since is at distance at most from , an inductive argument shows that its distance from is at most .
Moreover, when , we have by Lemma 4.4. Hence if , the algorithm finds the goal in this round by Theorem 3.1. Therefore, for any rounds when except the last round, the number of nodes visited by Algorithm 1 is at most , hence we have . We denote to be the first round such that . Thus by induction we have
Proof of Theorem 1.1.
Firstly, for the rounds when : in each round, Algorithm 1 at most visits nodes, the cost incurred is at most , by Lemma 3.8. Moreover, the distance from the ending node to is a further by Lemma 4.5. Therefore, since the bounds increase geometrically, the cost summed over all rounds until round is .
Secondly, for any rounds when except the last round, by Lemma 4.4 and Theorem 3.1, the number of nodes visited by Algorithm 1 is at most (the reasoning is the same as that in Lemma 4.5). Hence the cost incurred is at most . Moreover, by LABEL:lemma:_D_notknown_vt_distance_new the distance from the ending node to is at most , which means the total cost in round is at most .
Moreover, if we denote round to be the first round such that , then we have, for any round , . Hence the cost in round is .
Finally, consider the last round . We only need to consider the case when , otherwise the cost has been included in the first case. By Theorem 3.1, the cost incurred in this round is at most . So summing the bounds above, the total cost is at most
Here the final inequality uses that
Setting gives the proof. ∎
5 The Planning Problem
In this section we consider the planning version of the problem when the entire graph (with unit edge lengths, except for §5.3), the starting node , and the entire prediction function are given up-front. The agent can use this information to plan its exploration of the graph. We propose an algorithm for this version and then prove the cost bound for trees, and then for a graph with bounded doubling dimension. We begin by defining the implied-error function , which gives the total error if the goal is at node .
Definition 5.1 (Implied-error).
The implied-error function maps each node to , which is the error if the goal were at .
The search algorithm for this planning version is particularly simple: we visit the nodes in rounds, where round visits nodes with implied-error value at most in the cheapest possible way. The challenge is to show that the total cost incurred until reaching the goal is small. Observe that , so if this value is at most , we terminate in round .
5.1 Analysis
Recall our main claim for the planning algorithm: See 1.4
The proof relies on the fact that Algorithm 3 visits a node in only after visiting all nodes in and not finding the goal ; this serves a proof that . The proof below shows that (a) the cost of the tour of is bounded and (b) the total cost of each transition is small. Putting these claims together then proves Theorem 1.4. We start with a definition.
Definition 5.2 (Midpoint Set).
Given a set of nodes , define its midpoint set to be the set of points such that the distance from to all points in is equal.
Lemma 5.3 (-Bound Lemma).
For any two sets of nodes , we have
Proof.
If node does not lie in , then there are two nodes for which . This means cannot equal both of them, and hence contributes to at least one of or . ∎
Corollary 5.4.
For any two nodes , we have .
Proof.
Apply Lemma 5.3 for set and being a (shortest) path between them (which includes both ). All edges have unit lengths so ; moreover, . ∎
5.1.1 Analysis for Trees (Theorem 1.4(i))
Lemma 5.5 (Small Steiner Tree).
If then else .
Proof.
If , then contains all nodes with ; there can be only one such node. Else if then , so assume that and let be a farthest pair of nodes in . Consider path from to : if all nodes have , then the midpoint set , so Lemma 5.3 says , giving the proof. Hence, let’s consider the case where there exists with .
Let ’s neighbors in be for some . If we delete and its incident edges, let be the subtree of containing ; suppose that and . Choose any arbitrary vertex ; such a vertex exists because is a min-length Steiner tree connecting . Let .
Consider any node in : this means for some . Choose such that . By the tree properties, . Moreover, we have by our choice of , so . This means
which means . In summary, or , so applying Lemma 5.3 in either case gives
Lemma 5.6 (Small Cost for Transitions).
Consider the first round such that , then . For each subsequent round , .
Proof.
If the first transition happens in round , its cost is
where we used Corollary 5.4 for the second inequality. For all other transitions, Corollary 5.4 again gives . ∎
Proof of Theorem 1.4(i).
5.2 Analysis for Bounded Doubling Dimension (Theorem 1.4(ii))
For a graph with doubling dimension , and unit-length edges, we consider running LABEL:alg:_search_according_tophi, as for the tree case. We merely replace Lemma 5.5 by the following lemma, and the rest of the proof is the same as the proof of the tree case:
Lemma 5.7.
The total length of the tree is at most .
Proof.
If , then . Hence next we assume that . Define , and let be some points at mutual distance . Let be an -net of . (An -net for a set satisfies the properties (a) for all , and (b) for all there exists such that .) Since the metric has doubling dimension , it follows that [GKL03]. Let each point in choose a closest net point (breaking ties arbitrarily), and let be the points that chose as their closest net point (see Figure 4 for a sketch).
Claim 5.8.
For each net point , we have .
Proof.
Because , hence without loss of generality we assume . For any point , . Hence is not in . Hence by Lemma 5.3,
There are net points, so . Finally, LABEL:cor:distance_less_than_phi holds for general unit-edge-length graphs, so the cost of connecting any two nodes in is at most , and therefore . ∎
Using Lemma 5.7 instead of LABEL:lemma:full-info_C_bound in the proof of Theorem 1.4(i) gives the claimed bound of , and completes the proof of Theorem 1.4(ii).
5.3 Analysis for Bounded Doubling Dimension: Integer Lengths
In this part, we further generalize the proof above to the case when the edges can have positive integer lengths. Consider an graph with doubling dimension and general (positive integer) edge lengths. Define the analog of the implied-error function to be:
Since we are in the full-information case, we can compute the value for each node. Observe that is the -error; we prove the following guarantee.
Theorem 5.9.
For graph exploration on arbitrary graphs with positive integer edge lengths, the analog of Algorithm 3 that uses instead of , incurs a cost .
The proof is almost the same as that for the unit length case. We merely replace Corollary 5.4 and Claim 5.8 by the following two lemmas.
Lemma 5.10.
For any two vertices , their distance .
Proof.
By definition of we have . ∎
Claim 5.11.
For each net point , we have .
Proof.
Let be the node among that is further from ; by the triangle inequality, . By the properties of the net, . Again using the triangle inequality, . Hence
Since both , this implies that
Finally, we use that by our choice of to complete the proof. ∎
Now to prove Theorem 5.9, we mimic the proof of Theorem 1.4(ii), just substituting Lemma 5.10 and Claim 5.11 instead of LABEL:cor:distance_less_than_phi and Claim 5.8.
6 Closing Remarks
In this paper we study a framework for graph exploration problems with predictions: as the graph is explored, each newly observed node gives a prediction of its distance to the goal. While graph searching is a well-explored area, and previous works have also studied models where nodes give directional/gradient information (“which neighbors are better”), such distance-based predictions have not been previously studied, to the best of our knowledge. We give algorithms for exploration on trees, where the total distance traveled by the agent has a relatively benign dependence on the number of erroneous nodes. We then show results for the planning version of the problem, which gives us hope that our exploration results may be extendible to broader families of graphs. This is the first, and most natural open direction.
Another intriguing direction is to reduce the space complexity of our algorithms, which would allow us to use them on very large implicitly defined graphs (say computation graphs for large dynamic programming problems, say those arising from reinforcement learning problems, or from branch-and-bound computation trees). Can we give time-space tradeoffs? Can we extend our results to multiple agents? A more open-ended direction is to consider other forms of quantitative hints for graph searching, beyond distance estimates (studied in this paper) and gradient information (studied in previous works).
References
- [AG03] Steve Alpern and Shmuel Gal. The theory of search games and rendezvous, volume 55 of International series in operations research and management science. Kluwer, 2003.
- [AGKK20] Antonios Antoniadis, Themis Gouleakis, Pieter Kleer, and Pavel Kolev. Secretary and online matching problems with machine learned advice. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, NeurIPS 2020, 2020.
- [BCKP20] Aditya Bhaskara, Ashok Cutkosky, Ravi Kumar, and Manish Purohit. Online learning with imperfect hints. In International Conference on Machine Learning, pages 822–831. PMLR, 2020.
- [BCR22] Sébastien Bubeck, Christian Coester, and Yuval Rabani. Shortest paths without a map, but with an entropic regularizer, 2022.
- [BFKR21] Lucas Boczkowski, Uriel Feige, Amos Korman, and Yoav Rodeh. Navigating in trees with permanently noisy advice. ACM Trans. Algorithms, 17(2):15:1–15:27, 2021.
- [BMRS20] Étienne Bamas, Andreas Maggiori, Lars Rohwedder, and Ola Svensson. Learning augmented energy minimization via speed scaling. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, NeurIPS 2020, 2020.
- [BRS97] Avrim Blum, Prabhakar Raghavan, and Baruch Schieber. Navigating in unfamiliar geometric terrain. SIAM J. Comput., 26(1):110–137, 1997.
- [Bur96] William R. Burley. Traversing layered graphs using the work function algorithm. J. Algorithms, 20(3):479–511, 1996.
- [BYCR93] R.A. Baeza-Yates, J.C. Culberson, and G.J.E. Rawlins. Searching in the plane. Information and Computation, 106(2):234–252, 1993.
- [DKP98] Xiaotie Deng, Tiko Kameda, and Christos H. Papadimitriou. How to learn an unknown environment I: the rectilinear case. J. ACM, 45(2):215–245, 1998.
- [DLLV21] Paul Dütting, Silvio Lattanzi, Renato Paes Leme, and Sergei Vassilvitskii. Secretaries with advice. In Péter Biró, Shuchi Chawla, and Federico Echenique, editors, EC ’21: The 22nd ACM Conference on Economics and Computation, Budapest, Hungary, July 18-23, 2021, pages 409–429. ACM, 2021.
- [DMS19] Argyrios Deligkas, George B. Mertzios, and Paul G. Spirakis. Binary search in graphs revisited. Algorithmica, 81(5):1757–1780, 2019.
- [DP99] Xiaotie Deng and Christos H Papadimitriou. Exploring an unknown graph. Journal of Graph Theory, 32(3):265–297, 1999.
- [DTUW19] Dariusz Dereniowski, Stefan Tiegel, Przemyslaw Uznanski, and Daniel Wolleb-Graf. A framework for searching in graphs in the presence of errors. In Jeremy T. Fineman and Michael Mitzenmacher, editors, 2nd Symposium on Simplicity in Algorithms, SOSA 2019, January 8-9, 2019, San Diego, CA, USA, volume 69 of OASIcs, pages 4:1–4:17. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019.
- [EKS16] Ehsan Emamjomeh-Zadeh, David Kempe, and Vikrant Singhal. Deterministic and probabilistic binary search in graphs. In Daniel Wichs and Yishay Mansour, editors, Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 519–532. ACM, 2016.
- [FFK+98] Amos Fiat, Dean P. Foster, Howard J. Karloff, Yuval Rabani, Yiftach Ravid, and Sundar Vishwanathan. Competitive algorithms for layered graph traversal. SIAM J. Comput., 28(2):447–462, 1998.
- [FRPU94] Uriel Feige, Prabhakar Raghavan, David Peleg, and Eli Upfal. Computing with noisy information. SIAM J. Comput., 23(5):1001–1018, 1994.
- [Gal80] Shmuel Gal. Search games, volume 149 of Mathematics in Science and Engineering. Academic Press, Inc. [Harcourt Brace Jovanovich, Publishers], New York-London, 1980.
- [GH05] Andrew V. Goldberg and Chris Harrelson. Computing the shortest path: A search meets graph theory. In Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2005, Vancouver, British Columbia, Canada, January 23-25, 2005, pages 156–165. SIAM, 2005.
- [GKL03] Anupam Gupta, Robert Krauthgamer, and James R. Lee. Bounded geometries, fractals, and low-distortion embeddings. In 44th Symposium on Foundations of Computer Science (FOCS 2003), 11-14 October 2003, Cambridge, MA, USA, Proceedings, pages 534–543. IEEE Computer Society, 2003.
- [HIKV19] Chen-Yu Hsu, Piotr Indyk, Dina Katabi, and Ali Vakilian. Learning-based frequency estimation algorithms. In International Conference on Learning Representations, 2019.
- [IMTMR20] Piotr Indyk, Frederik Mallmann-Trenn, Slobodan Mitrović, and Ronitt Rubinfeld. Online page migration with ml advice. arXiv preprint arXiv:2006.05028, 2020.
- [Jor69] Camille Jordan. Sur les assemblages de lignes. J. Reine Angew. Math., 70:185–190, 1869.
- [JS01] Patrick Jaillet and Matthew Stafford. Online searching. Oper. Res., 49(4):501–515, 2001.
- [JSG02] Patrick Jaillet, Matthew Stafford, and Shmuel Gal. Note: Online searching / on the optimality of the geometric sequences for the m ray search online searching. Oper. Res., 50(4):744–745, 2002.
- [KMSY98] Ming-Yang Kao, Yuan Ma, Michael Sipser, and Yiqun Lisa Yin. Optimal constructions of hybrid algorithms. J. Algorithms, 29(1):142–164, 1998.
- [KP93] Bala Kalyanasundaram and Kirk Pruhs. A competitive analysis of algorithms for searching unknown scenes. Computational Geometry, 3(3):139–155, 1993.
- [KP94] Bala Kalyanasundaram and Kirk R Pruhs. Constructing competitive tours from local information. Theoretical Computer Science, 130(1):125–138, 1994.
- [KRR94] Howard J. Karloff, Yuval Rabani, and Yiftach Ravid. Lower bounds for randomized k-server and motion-planning algorithms. SIAM J. Comput., 23(2):293–312, 1994.
- [KRT96] Ming-Yang Kao, John H. Reif, and Stephen R. Tate. Searching in an unknown environment: An optimal randomized algorithm for the cow-path problem. Inf. Comput., 131(1):63–79, 1996.
- [KSW86] Richard M. Karp, Michael E. Saks, and Avi Wigderson. On a search problem related to branch-and-bound procedures. In 27th Annual Symposium on Foundations of Computer Science, Toronto, Canada, 27-29 October 1986, pages 19–28. IEEE Computer Society, 1986.
- [KZ93] Richard M. Karp and Yanjun Zhang. Randomized parallel algorithms for backtrack search and branch-and-bound computation. J. ACM, 40(3):765–789, 1993.
- [LLMV20] Silvio Lattanzi, Thomas Lavastida, Benjamin Moseley, and Sergei Vassilvitskii. Online scheduling via learned weights. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1859–1877. SIAM, 2020.
- [LMRX20] Thomas Lavastida, Benjamin Moseley, R. Ravi, and Chenyang Xu. Learnable and instance-robust predictions for online matching, flows and load balancing, 2020.
- [Mit18] Michael Mitzenmacher. A model for learned bloom filters, and optimizing by sandwiching. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pages 462–471, 2018.
- [Mit20] Michael Mitzenmacher. Scheduling with predictions and the price of misprediction. In 11th Innovations in Theoretical Computer Science Conference (ITCS 2020). Schloss Dagstuhl-Leibniz-Zentrum für Informatik, 2020.
- [MMS12] Nicole Megow, Kurt Mehlhorn, and Pascal Schweitzer. Online graph exploration: New results on old and new algorithms. Theoretical Computer Science, 463:62–72, 2012.
- [MNS07] Mohammad Mahdian, Hamid Nazerzadeh, and Amin Saberi. Allocating online advertisement space with unreliable estimates. In Jeffrey K. MacKie-Mason, David C. Parkes, and Paul Resnick, editors, Proceedings 8th ACM Conference on Electronic Commerce (EC-2007), San Diego, California, USA, June 11-15, 2007, pages 288–294. ACM, 2007.
- [MOW08] Shay Mozes, Krzysztof Onak, and Oren Weimann. Finding an optimal tree searching strategy in linear time. In Shang-Hua Teng, editor, Proceedings of the Nineteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2008, San Francisco, California, USA, January 20-22, 2008, pages 1096–1105. SIAM, 2008.
- [MV17] Andrés Muñoz Medina and Sergei Vassilvitskii. Revenue optimization with approximate bid predictions. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 1856–1864, 2017.
- [OP06] Krzysztof Onak and Pawel Parys. Generalization of binary search: Searching in trees and forest-like partial orders. In 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2006), 21-24 October 2006, Berkeley, California, USA, Proceedings, pages 379–388. IEEE Computer Society, 2006.
- [PSK18] Manish Purohit, Zoya Svitkina, and Ravi Kumar. Improving online algorithms via ML predictions. In Advances in Neural Information Processing Systems, pages 9661–9670, 2018.
- [PY91] Christos H. Papadimitriou and Mihalis Yannakakis. Shortest paths without a map. Theoretical Computer Science, 84(1):127–150, 1991.
- [Ram95] Hariharan Ramesh. On traversing layered graphs on-line. J. Algorithms, 18(3):480–512, 1995.
7 Further Discussion
7.1 -versus- Error in Suggestions
Most of the paper deals with error: namely, we relate our costs to , the number of vertices that give incorrect predictions of their distance to the goal. Another reasonable notion of error is the error: .
For the case of integer edge-lengths and integer predictions, both of which we assume in this paper, it is immediate that the -error is at most the -error: if is erroneous then the former counts and the latter at least . If we are given integer edge-lengths but fractional predictions, we can round the predictions to the closest integer to get integer-valued predictions , and then run our algorithms on . Any prediction that is incorrect in must have incurred an -error of at least in . Hence all our results parameterized by the error imply results parameterized with the error as well.
7.2 Extending to General Edge-Lengths
A natural question is whether a guarantee like the one proved in Theorem 1.1 can be shown for trees with general integer weights: let us see why such a result is not possible.
-
1.
The first observation is that the notion of error needs to be changed from error something that is homogeneous in the distances, so that scaling distances by would change the error term by as well. One such goal is to guarantee the total movement to be
where -error is .
-
2.
Consider a complete binary tree of height , having leaves. Let all edges between internal nodes have length , and edges incident to leaves have length . The goal is at one of the leaves. Let all internal nodes have , and let all leaves have prediction . Hence the total error is , whereas any algorithm would have to explore half the leaves in expectation to find the goal; this would cost , which is unbounded as gets large.
-
3.
The problem is that zero-length edges allow us to simulate arbitrarily large degrees. Moreover, the same argument can be simulated by changing zero-length edges to unit-length edges; the essential idea remains the same. and setting for each node to be plus its distance to the root. Setting gives the total error to be , whereas any algorithm would incur cost at least .
This suggests that the right extension to general edge-lengths requires us to go beyond just parameterizing our results with the maximum degree ; this motivates our study of graphs with bounded doubling dimension in §5.
7.3 Gradient Information
Consider the information model where the agent gets to see gradient information: each edge is imagined to be oriented towards the endpoint with lower distance to the goal. The agent can see some noisy version of these directions, and the error is the number of edges with incorrect directions. We now show an example where both the optimal distance and the error are , but any algorithm must incur cost . Indeed, take a complete binary tree of depth , with the goal at one of the leaves. Suppose the agent sees all edges being directed towards the root. The only erroneous edges are the edges on the root-goal path. But any algorithm must suffer cost .