5

I am trying to solve this puzzle:

Problem: The Park is covered by a network of hiking paths.

Goal: Find an algrithm by which you'll find (in finite time) the crossing at which the restaurant is located.

Rules:

  1. The paths form a finite connected graph in which each crossing (that is, each crossing of paths) is of degree 3.
  2. The crossings are indistinguishable one from another: it is not possible to know which crossing one has arrived at, to identify the paths meeting there, or to recognize whether one has been there before.
  3. Strict rule against leaving markings in the park. It is not ok to mark crossings or path in any way.
  4. If you enter a crossing by one path you must leave it by a different path. You have initially arrived at some node by one of its incident paths.

My questions:

For rule 1: I cannot find any graph where every node has a degree of 3. At least one node has degree 2.

2nd question: If I cannot mark the paths where I have been, what can I do to find a sufficient solution? Just go right, right right and one time left?

jester
  • 324
  • What's the goal, to visit every junction? – aschepler Feb 07 '21 at 23:42
  • 3
    $K_4$ is the simplest graph where every node has degree 3. – aschepler Feb 07 '21 at 23:43
  • If the goal is to visit every edge and to end up where you started, then you are describing an Euler Circuit. A graph $G$ has an Euler Circuit if and only if every vertex has even degree. – ml0105 Feb 07 '21 at 23:44
  • You can see another $3$-regular graph here. – Brian M. Scott Feb 07 '21 at 23:44
  • @aschepler I added the goal. – jester Feb 07 '21 at 23:45
  • @ml0105 The graph obviously does not have an Euler circuit. – aschepler Feb 07 '21 at 23:52
  • 1
    I assume the park is planar (no trails crossing by bridges), which might be required to find an answer. (Both $K_4$ and the example from @BrianM.Scott are planar, although that picture is drawn with intersections.) – aschepler Feb 07 '21 at 23:54
  • @aschepler yes, it is planar... but does that have some advantages? – jester Feb 07 '21 at 23:55
  • @aschepler: I suspect that it doen’t matter: about the only thing that one can use is the fact that at each junction one has a choice between going left and going right, and that’s the case even if there are bridges. – Brian M. Scott Feb 07 '21 at 23:56
  • @ml0105: why must the solution be an Euler circuit? – Rob Arthan Feb 07 '21 at 23:56
  • 1
    @ml0105: There is no requirement that the path be an Euler circuit; it just has to be guaranteed to reach every vertex. – Brian M. Scott Feb 07 '21 at 23:57
  • I confess this remark is a little flippant: we can never find the restaurant if rule 2 holds, since if the restaurant isn't a distinguishing feature of the junction that is our goal, how can we know when we've found that junction? – Rob Arthan Feb 08 '21 at 00:01
  • Any repeating pattern of left/right choices is not a solution, since we can construct an antagonist graph which makes that period a cycle without visiting all vertices. I suspect a sequence which contains every finite substring infinitely many times would do the trick, but I haven't been able to prove it. – aschepler Feb 08 '21 at 00:41
  • My apologies for the confusion! I was having some trouble parsing out what the goal of the problem was. – ml0105 Feb 08 '21 at 00:42
  • What is the source of this problem? It reminds me of a talk I've given, and I'm curious if one of the people listening to it wrote the problem. – Misha Lavrov Feb 08 '21 at 00:54
  • 1
    Also, a practical question: is the solution allowed to be based on a map of the park, or should it be a single sequence that works for parks of any shape and size? – Misha Lavrov Feb 08 '21 at 01:03
  • 1
    @MishaLavrov yes, of any shape and size... – jester Feb 08 '21 at 15:11
  • https://math.stackexchange.com/questions/55221/need-an-efficient-algorithm-to-visit-all-nodes-of-a-graph-revisiting-edges-and – jester Feb 08 '21 at 15:14

1 Answers1

6

Define a hypothesis to consist of the following:

  • a $3$-regular graph representing a hypothetical map of the park;
  • a vertex $r$ in that graph representing a hypothetical location of the restaurant;
  • a vertex $s$ in that graph representing a hypothetical starting location;
  • an edge incident to $s$ representing the hypothetical path by which you arrived at $s$.

There are infinitely many hypotheses, but countably many: for each natural number $n$, there are only finitely many hypotheses in which the park has $n$ vertices. So we may number the hypotheses $H_1, H_2, H_3, \dots$.

One of the hypotheses represents the true map of the park, location of the restaurant, and your starting position: call that hypothesis $H_N$. You don't know which hypothesis this is, but $N$ is some finite number.


Now, here is the strategy that will get you to the restaurant. For each $i=1,2,3,\dots$, you:

  1. Assume hypothesis $H_i$ is true for the time being.
  2. Given the steps you've taken so far, determine the location in $H_i$'s graph where you would now be, if hypothesis $H_i$ were true.
  3. From that location, find directions in $H_i$'s graph that would take you to $H_i$'s restaurant location $r$.
  4. Follow those directions in the actual physical park.

For the first $N-1$ iterations of this procedure (for $i=1, 2, \dots, N-1$), you're going to be following directions based on a false premise, and they're unlikely to get you to the restaurant except by chance.

On the $N^{\text{th}}$ iteration of the restaurant, you'll assume a true hypothesis: the graph you take will be the correct graph, with the restaurant and your starting location and starting direction marked correctly. Then the location you work out in step 2 will happen to be your actual location in the park, and the directions you work out in step 3 will actually take you to the restaurant.

Misha Lavrov
  • 159,700
  • the breaking point would be to left or right... but why do take the left or right? – jester Feb 08 '21 at 20:08
  • 1
    I'm not sure I understand. If each vertex has degree $3$, and you can't go back the way you came, there are only two options. We can call them "left" and "right". – Misha Lavrov Feb 08 '21 at 20:10
  • exactly, but do choose left or right randomly? – jester Feb 08 '21 at 20:11
  • sorry, I dont understand with the tokens? we are not allowed to mark trails. You violate rule 3. – jester Feb 08 '21 at 20:13
  • We are not marking the trails. The algorithm I am giving is used beforehand to generate a sequence of directions to follow; then, you just follow that sequence of directions. We don't choose left or right randomly; on each map, we can look at that map to see how to get to the restaurant on that map, and give those directions. – Misha Lavrov Feb 08 '21 at 20:15
  • how would you define a token? – jester Feb 08 '21 at 20:21
  • The token is just a marker to represent a position and direction on a map. You can imagine drawing the map on paper and putting some coins on the paper and moving them around. If implementing this algorithm in a computer, they'd be a bunch of variables. – Misha Lavrov Feb 08 '21 at 20:34
  • "Repeat until you've guided every token to the restaurant." Does not make sense to me, because I stop, when I find the restaurant, right? – jester Feb 08 '21 at 21:52
  • To know the position of the restaurant I need to find all junctions, right? – jester Feb 08 '21 at 22:02
  • @jester I have tried to rephrase my answer avoiding the terminology that confused you. – Misha Lavrov Feb 08 '21 at 22:12
  • @MishaLavrov It might be easier to illustrate by backtracking to the starting position after each hypothesis is tested; this doesn't require any more ability than the procedure outlined here and has the possible visualization advantage that one tests each hypothesis from a 'clean slate'. – Steven Stadnicki Feb 08 '21 at 22:24
  • 1
    This could be a bit more "efficient" by checking at each new hypothesis $H_i$ if it predicts I would have already seen the restaurant. If so, toss out that hypothesis, skipping the walking around, and consider the next untested hypothesis. – aschepler Feb 08 '21 at 23:23
  • 2
    @StevenStadnicki Unfortunately, the rules don't let us turn around, and so returning to the start is also not something we can do without making some assumptions about the map. – Misha Lavrov Feb 08 '21 at 23:56
  • there is a missing path, how to verify if the hypthesis is correct. You need to save left, right etc. until to the restaurnt, right? For that you need test every combination in a graph with start and endpoint and compare within one hyptohtesis. I think that you have described that in your previous answer. – jester Feb 09 '21 at 18:18
  • What do you mean, how to verify if the hypothesis is correct? If the hypothesis is correct, it gets you to the restaurant, and then you win. – Misha Lavrov Feb 09 '21 at 18:33
  • Different possible graphs, or even the same graph with a different start and endpoint, are different hypotheses. – Misha Lavrov Feb 09 '21 at 18:34