To honor the tenth anniversary of the Oregon Badlands Wilderness designation, the Oregon Natural Desert Association (ONDA) is hosting a six-month long exploration challenge:
I bet one can, but how?
The problem
The map below (Figure 1) shows all 13 major trails. There’s a bunch of smaller connector segments in addition. So how does one go about completing all of these trails?
Of course you could do them one after another, in whatever order feels good. Yet, for this blog post I’m interested to find the shortest possible route that visits each and every trail at least once. Hmmm?! At which of the 5 trailheads does one start? And in what order does one complete the trails? How does one avoid having to complete some trail segments more than once? Is it better to start at one trailhead and to finish there as well? Or are there shorter routes that start at one trailhead but end somewhere else?
If you try to answer these questions by exploring possible solutions by hand, you will very quickly realize that such an attempt is utterly futile. There are simply too many combinations to explore. Also, how would you know that a given sequence is actually the shortest one?
Thankfully, modern graph theory provides us with a rich toolset to get to the bottom of this problem. Let’s get started!
A bit of graph theory
A graph G = (V, A) is composed by a set of nodes (or vertices) V and a set of edges (or links) A. Edges can be directed or undirected. Figure 2 shows both a directed and an undirected graph.
The above trail map from Figure 1 can straightforwardly be transformed into an abstract undirected graph. The graph is undirected because trails don’t have a direction. Figure 3 shows a visualization that retained the spatial location of the trailheads and trail intersections. The graph nodes V, i.e., the red dots, represent the trail intersections and trailheads (nodes 1, 9, 11, 14, and 24). Node IDs, which are essentially an arbitrary but unique number, are indicated in red. There’s a total of |V| = 24 nodes. The graph edges A, i.e., the black lines, represent trails. The |A|= 32 edges between the nodes represent trails. Each edge has an associated “cost,” which in our case is nothing more than the length of the trail segment measured in miles (indicated in bold/black).
The problem reformulated
Now that we have an abstract undirected graph with |V| = 24 nodes and |A| = 32 edges, we can really get down to business. Given the list of nodes V and the list of edges A (including their distance), what is the shortest possible route that visits each and every edge (i.e., trail) at least once?
This is different from the Traveling Salesman Problem (TSP), which seeks the shortest possible route that visits each and every node at least once. If we’d apply a TSP algorithm, we’d end up with a solution that visits all trail intersections, but not necessarily all trails.
Luckily our problem has a name and a solution as well: it’s called the Chinese Postman Problem (CPP) and is part of a more general class of route inspection problems. The CPP consists in finding the shortest closed route (or circuit) that visits each and every edge of a connected, undirected graph. Chinese mathematician Kwan Mei-Ko studied that problem in 1960. For more info, see for example here (pdf). There are many interesting variants of this problem, such as the Rural Postman Problem (RPP) or the Windy Postman Problem (WPP). Needless to say that most of these problems – and obviously their solutions – are hugely important for modern logistics that involve vehicle routing, delivery planning, scheduling, etc.
An undirected graph that has a closed route, i.e., a circuit, that visits every edge exactly once is called an Eulerian circuit. An Eulerian trail (or Euler walk) in an undirected graph is a walk that visits each edge exactly once. Note that, as opposed to the circuit, the Eulerian trail does not end where it starts. From the list of properties for an Eulerian circuit to exist, we can see right away that our trail graph in Figure 3 does unfortunately not have an Eulerian circuit. That’s not quite good news because it means that one will have to visit one or more edges several times.
Because most people are probably interested to start/finish at the same trailhead for the Oregon Badlands Challenge, we shall focus on a circuit here, but alas not an Eulerian one.
The solution
There are thankfully several algorithms and solvers for the Chinese Postman Problem (CPP). I’ll spare you all the technical details and present you with the solution to our problem. Here’s a summary of the most important solution details:
Distance, total | 65.4mi |
Distance, crossed once | 50.1mi |
Distance, doublebacked | 15.3mi |
Trail segments, total | 45 |
Trail segments, doublebacked | 13 |
Trail segments, crossed once | 32 |
That means if one wants to visit all trails in a single push and start/finish at the same trailhead, one will have to complete a distance of 65.4 miles, that is 15.3 miles longer than the sum of all trails. As we already knew, there wouldn’t be a solution that visits each and every edge once and only once. In fact, 13 trail segments will have to be crossed twice.
The optimal trail sequence is listed in the table below. It shows the node IDs from Figure 3. An overlay map with the same IDs is shown in Figure 4. The circuit starts at node 1, which is the Tumulus trailhead (and the infamous start of the famous Oregon Desert Trail). I’ve created a spreadsheet with that info that one can use, copy, and download: http://bit.ly/BadlandsSegments. In addition, here is a downloadable pdf handout.
Segment number | Start node | End node | Segment distance [mi] | Cumulative distance [mi] | Double- backed | Trail name |
1 | 1 | 2 | 0.5 | 0.5 | Yes | Tumulus |
2 | 2 | 4 | 1.5 | 2 | Tumulus | |
3 | 4 | 6 | 3 | 5 | Tumulus | |
4 | 6 | 7 | 2 | 7 | Yes | Tumulus |
5 | 7 | 15 | 3.3 | 10.3 | Badlands Rock | |
6 | 15 | 10 | 2.7 | 13 | Yes | Badlands Rock |
7 | 10 | 11 | 0.3 | 13.3 | Yes | Badlands Rock |
8 | 11 | 10 | 0.3 | 13.6 | Badlands Rock | |
9 | 10 | 12 | 2.1 | 15.7 | Homestead | |
10 | 12 | 13 | 0.1 | 15.8 | Yes | Flatiron Rock |
11 | 13 | 14 | 1.9 | 17.7 | Ancient Juniper | |
12 | 14 | 13 | 1.2 | 18.9 | Flatiron Rock | |
13 | 13 | 12 | 0.1 | 19 | Flatiron Rock | |
14 | 12 | 16 | 1.5 | 20.5 | Flatiron Rock | |
15 | 16 | 17 | 2 | 22.5 | Flatiron Rock | |
16 | 17 | 18 | 0.7 | 23.2 | Yes | Mazama Ash |
17 | 18 | 23 | 0.7 | 23.9 | Mazama Ash | |
18 | 23 | 19 | 0.7 | 24.6 | Yes | Chitwood |
19 | 19 | 23 | 0.7 | 25.3 | Chitwood | |
20 | 23 | 22 | 0.3 | 25.6 | Chitwood | |
21 | 22 | 24 | 0.2 | 25.8 | Yes | Chitwood |
22 | 24 | 22 | 0.2 | 26 | Chitwood | |
23 | 22 | 21 | 0.7 | 26.7 | Chitwood | |
24 | 21 | 20 | 3.2 | 29.9 | Chitwood | |
25 | 20 | 21 | 1.8 | 31.7 | Yes | Chitwood Cutoff |
26 | 21 | 20 | 1.8 | 33.5 | Chitwood Cutoff | |
27 | 20 | 19 | 1.9 | 35.4 | Chitwood | |
28 | 19 | 18 | 1.8 | 37.2 | Sand Lily | |
29 | 18 | 17 | 0.7 | 37.9 | Mazama Ash | |
30 | 17 | 5 | 0.8 | 38.7 | Mazama Ash | |
31 | 5 | 17 | 0.8 | 39.5 | Yes | Mazama Ash |
32 | 17 | 16 | 2 | 41.5 | Yes | Flatiron Rock |
33 | 16 | 15 | 1.1 | 42.6 | The Castle | |
34 | 15 | 10 | 2.7 | 45.3 | Badlands Rock | |
35 | 10 | 8 | 5.1 | 50.4 | Dry River | |
36 | 8 | 9 | 2.9 | 53.3 | Yes | Dry River |
37 | 9 | 8 | 2.9 | 56.2 | Dry River | |
38 | 8 | 7 | 0.5 | 56.7 | Tumulus | |
39 | 7 | 6 | 2 | 58.7 | Tumulus | |
40 | 6 | 5 | 2.2 | 60.9 | Mazama Ash | |
41 | 5 | 3 | 1.5 | 62.4 | Black Lava | |
42 | 3 | 4 | 0.6 | 63 | Yes | Basalt |
43 | 4 | 3 | 0.6 | 63.6 | Basalt | |
44 | 3 | 2 | 1.3 | 64.9 | Black Lava | |
45 | 2 | 1 | 0.5 | 65.4 | Tumulus |
As you will notice quickly, the algorithm does not care about following particular trails, i.e., complete the Badlands trail first, then do the Dry River trail, etc. Well, why would it? That’s just a human thing we feel we have to perhaps do. Instead, the algorithm switches trails in a way that does not seem to make much sense, at least not without seeing the big picture.
I’ve created an animation so that you can better see the route. Direct URL: https://youtu.be/90g1fKtVkgE
The route is provably the shortest possible route that visits each and every trail at least once. There may be other routes that are equally short, but none will be shorter. Well, I should say there clearly care other routes that are equally short. For example, several of the out-and-backs can be done from one side or the other. That leads to the same overall distance, but the sequence would be different. If you are willing to start and finish at different trailheads, that’s a separate story that I’m not addressing in this post.
No matter what you end up doing, enjoy it, remember that you are a guest in nature, and be safe. Safety last.
Notes
Here are a few notes about route variants:
- Since the above-presented route visits all 5 trailheads, you can start at any of them and simply do the sequence from there. The total route length will be unchanged.
- Some out-and-backs can be done from two sides. Either way will lead to the same total distance.
- Some loops can be done clockwise or counter-clockwise. Either way will lead to the same total distance.
- You could shorten the total distance by starting and finishing at different trailheads. The above-presented route is only optimal if the start/finish trailhead is identical.
- You could further shorten the route if you would allow cross-country travel. The above-presented route assumes that you are always staying on trails.
Resources
- ONDA Badlands Challenge: https://onda.org/Badlands-Challenge
- Oregon Desert Trail: https://onda.org/regions/oregon-desert-trail