From this information it is possible to find the children of any given node in the tree, reversing the links given by the parent subroutine: they are simply the neighbors whose parent is the given node. It is these reversed links to child nodes that the algorithm searches.
A classical depth-first search of this spanning tree would traverse the tree recursively, starting from the root, at each node listing all of the children and making a recursive call for each one. Unlike a depth-first search of a graph with cycles, it is not necessary to maintain the set of already-visited nodes to avoid repeated visits; such repetition is not possible in a tree. However, this recursive algorithm may still require a large amount of memory for its call stack, in cases when the tree is very deep. Instead, reverse search traverses the spanning tree in the same order while only storing two objects: the current object of the traversal, and the previously traversed object. Initially, the current object is set to the root of the tree, and there is no previous object. From this information, it is possible to determine the next step of the traversal by the following case analysis:
This algorithm involves listing the neighbors of an object once for each step in the search. However, if there are
N
{\displaystyle N}
objects to be listed, then the search performs
2
N
−
1
{\displaystyle 2N-1}
steps, so the number of times it generates neighbors of objects is within a factor of two of the number of times the recursive depth-first search would do the same thing.
Examples of the problems to which reverse search has been applied include the following combinatorial generation problems:
Vertices of simple convex polytopes
If a
d
{\displaystyle d}
-dimensional
Avis, David; Fukuda, Komei (1992), "A pivoting algorithm for convex hulls and vertex enumeration of arrangements and polyhedra", Discrete & Computational Geometry, 8 (3): 295–313, doi:10.1007/BF02293050, MR 1174359; preliminary version in Seventh Annual Symposium on Computational Geometry, 1991, doi:10.1145/109648.109659 /wiki/David_Avis
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Avis, David (2000), "A revised implementation of the reverse search vertex enumeration algorithm", in Kalai, Gil; Ziegler, Günter M. (eds.), Polytopes—combinatorics and computation: Including papers from the DMV-Seminar "Polytopes and Optimization" held in Oberwolfach, November 1997, DMV Seminar, vol. 29, Basel: Birkhäuser, pp. 177–198, MR 1785299 /wiki/David_Avis
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Sleumer, Nora H. (1999), "Output-sensitive cell enumeration in hyperplane arrangements", Nordic Journal of Computing, 6 (2): 137–147, MR 1709978 /wiki/MR_(identifier)
Lawson, C. L. (1972), Generation of a triangular grid with applications to contour plotting, Memo 299, Jet Propulsion Laboratory
Sibson, R. (1973), "Locally equiangular triangulations", The Computer Journal, 21 (3): 243–245, doi:10.1093/comjnl/21.3.243, MR 0507358 /wiki/Robin_Sibson
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Liang, Xiaodong; Wang, Rui; Meng, Ji xiang (2017), "Code for polyomino and computer search of isospectral polyominoes", Journal of Combinatorial Optimization, 33 (1): 254–264, doi:10.1007/s10878-015-9953-z, MR 3595411, S2CID 254655722 /wiki/Doi_(identifier)
Horiyama, Takashi; Yamane, Shogo (2011), "Generation of polyiamonds for p6 tiling by the reverse search", in Akiyama, Jin; Jiang, Bo; Kano, Mikio; Tan, Xuehou (eds.), Computational Geometry, Graphs and Applications - 9th International Conference, CGGA 2010, Dalian, China, November 3-6, 2010, Revised Selected Papers, Lecture Notes in Computer Science, vol. 7033, Springer, pp. 96–107, doi:10.1007/978-3-642-24983-9_10, ISBN 978-3-642-24982-2, MR 2927314 978-3-642-24982-2
Caporossi, Gilles; Hansen, Pierre (May 1998), "Enumeration of polyhex hydrocarbons to
h
=
21
{\displaystyle h=21}
", Journal of Chemical Information and Computer Sciences, 38 (4): 610–619, doi:10.1021/ci970116n /wiki/Journal_of_Chemical_Information_and_Computer_Sciences
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Avis, David; Fukuda, Komei (1996), "Reverse search for enumeration", Discrete Applied Mathematics, 65 (1–3): 21–46, doi:10.1016/0166-218X(95)00026-N, MR 1380066 /wiki/David_Avis
Kurita, Kazuhiro; Wasa, Kunihiro (2022), "Constant amortized time enumeration of Eulerian trails", Theoretical Computer Science, 923: 1–12, arXiv:2101.10473, doi:10.1016/j.tcs.2022.04.048, MR 4436557 /wiki/Theoretical_Computer_Science_(journal)
Eppstein, David (2009), "All maximal independent sets and dynamic dominance for sparse graphs", ACM Transactions on Algorithms, 5 (4): A38:1–A38:14, arXiv:cs/0407036, doi:10.1145/1597036.1597042, MR 2571901, S2CID 2769046 /wiki/David_Eppstein
Avis, David (1996), "Generating rooted triangulations without repetitions", Algorithmica, 16 (6): 618–632, doi:10.1007/s004539900067, MR 1412663 /wiki/David_Avis
Deza, Antoine; Fukuda, Komei; Rosta, Vera (1994), "Wagner's theorem and combinatorial enumeration of 3-polytopes", Proceedings of a symposium held at the Research Institute for Mathematical Sciences, Kyoto University, Kyoto, May 17–19, 1993, RIMS Kôkyûroku Bessatsu, vol. 872, pp. 30–34, MR 1330480 /wiki/Komei_Fukuda
Avis, David; Katoh, Naoki; Ohsaki, Makoto; Streinu, Ileana; Tanigawa, Shin-ichi (June 2007), "Enumerating non-crossing minimally rigid frameworks" (PDF), Graphs and Combinatorics, 23 (S1): 117–134, doi:10.1007/s00373-007-0709-0, S2CID 10874512 /wiki/David_Avis
Yamanaka, Katsuhisa; Avis, David; Horiyama, Takashi; Okamoto, Yoshio; Uehara, Ryuhei; Yamauchi, Tanami (2021), "Algorithmic enumeration of surrounding polygons" (PDF), Discrete Applied Mathematics, 303: 305–313, doi:10.1016/j.dam.2020.03.034, MR 4310502 /wiki/David_Avis
Fukuda, Komei (2004), "From the zonotope construction to the Minkowski addition of convex polytopes", Journal of Symbolic Computation, 38 (4): 1261–1272, doi:10.1016/j.jsc.2003.08.007, MR 2094220 /wiki/Komei_Fukuda
Weibel, Christophe (2010), "Implementation and parallelization of a reverse-search algorithm for Minkowski sums", in Blelloch, Guy E.; Halperin, Dan (eds.), Proceedings of the Twelfth Workshop on Algorithm Engineering and Experiments, ALENEX 2010, Austin, Texas, USA, January 16, 2010, Society for Industrial and Applied Mathematics, pp. 34–42, doi:10.1137/1.9781611972900.4, ISBN 978-0-89871-931-4 978-0-89871-931-4
Bayer, Dave; Taylor, Amelia (2009), "Reverse search for monomial ideals", Journal of Symbolic Computation, 44 (10): 1477–1486, doi:10.1016/j.jsc.2009.05.002, MR 2543431 /wiki/Dave_Bayer