Reverse-search algorithm

From HandWiki

Reverse-search algorithms are a class of algorithms for generating all objects of a given size, from certain classes of combinatorial objects. In many cases, these methods allow the objects to be generated in polynomial time per object, using only enough memory to store a constant number of objects (polynomial space). (Generally, however, they are not classed as polynomial-time algorithms, because the number of objects they generate is exponential.) They work by organizing the objects to be generated into a spanning tree of their state space, and then performing a depth-first search of this tree. Reverse-search algorithms were introduced by David Avis and Komei Fukuda in 1991, for problems of generating the vertices of convex polytopes and the cells of arrangements of hyperplanes.[1] They were formalized more broadly by Avis and Fukuda in 1996.[2]

Principles

A reverse-search algorithm generates the combinatorial objects in a state space, an implicit graph whose vertices are the objects to be listed and whose edges represent certain "local moves" connecting pairs of objects, typically by making small changes to their structure. It finds each objects using a depth-first search in a rooted spanning tree of this state space, described by the following information:[2]

  • The root of the spanning tree, one of the objects
  • A subroutine for generating the parent of each object in the tree, with the property that if repeated enough times it will eventually reach the root
  • A subroutine for listing all of the neighbors in the state space (not all of which may be neighbors in the tree)

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.[2]

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:[2]

  • If there is no previous object, or the previous object is the parent of the current object, then this is the first time the traversal has reached the current object, so it is output from the search. The next object is its first child or, if it has no children, its parent.
  • In all other cases, the previous object must be a child of the current object. The algorithm lists the children (that is, state-space neighbors of the current object that have the current object as their parent) one at a time until reaching this previous child, and then takes one more step in this list of children. If another child is found in this way, it is the next object. If there is no next child and the current object is not the root, the next object is the parent of the current object. In the remaining case, when there is no next child and the current object is the root, the reverse search terminates.

This algorithm involves listing the neighbors of an object once for each step in the search. However, if there are [math]\displaystyle{ N }[/math] objects to be listed, then the search performs [math]\displaystyle{ 2N-1 }[/math] 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.[2]

Applications

Examples of the problems to which reverse search has been applied include the following combinatorial generation problems:

Vertices of simple convex polytopes
If a [math]\displaystyle{ d }[/math]-dimensional convex polytope is defined as an intersection of half-spaces, then its vertices can be described as the points of intersection of [math]\displaystyle{ d }[/math] or more hyperplanes bounding the halfspaces; it is a simple polytope if no vertex is the intersection of more than [math]\displaystyle{ d }[/math] of these hyperplanes. The vertex enumeration problem is the problem of listing all of these vertices. The edges of the polytope connect pairs of vertices that have [math]\displaystyle{ d-1 }[/math] hyperplanes in common, so the vertices and edges form a state space in which each vertex has [math]\displaystyle{ d }[/math] neighbors. The simplex algorithm from the theory of linear programming finds a vertex maximizing a given linear function of the coordinates, by walking from vertex to vertex, choosing at each step a vertex with a greater value of the function; there are several standard choices of "pivot rule" that specify more precisely which vertex to choose. Any such pivot rule can be interpreted as defining the parent function of a spanning tree of the polytope, whose root is the optimal vertex. Applying reverse search to this data generates all vertices of the polytope. A similar algorithm can also enumerate all bases of a linear program, without requiring that it defines a polytope that is simple.[2][3]
Cells of hyperplane arrangements
A hyperplane arrangement decomposes Euclidean space into cells, each described by a "sign vector" that describes whether its points belong to one of the hyperplanes (sign 0), are on one side of the hyperplane (sign +1), or are on the other side (sign −1). The cells form a connected state space under local moves that change a single sign by one unit, and it is possible to check that this operation produces a valid cell by solving a linear programming feasibility problem. A spanning tree can be constructed for any choice of root cell by defining a parent operator that makes the first possible change that would bring the sign vector closer to that of the root. Using reverse search for this state space and parent operator produces an algorithm for listing all cells in polynomial time per cell.[2][4]
Point-set triangulations
The triangulations of a planar point set are connected by "flip" moves that remove one diagonal from a triangulation and replace it by another. If the Delaunay triangulation is chosen as the root, then every triangulation can be flipped to the Delaunay triangulation by steps in which the triangulation of some subset of four points is replaced by its Delaunay triangulation.[5][6] Choosing the first Delaunay flip as the parent of each triangulation, and applying local search, produces an algorithm for listing all triangulations in polynomial time per triangulation.[2]
Connected subgraphs
The connected subgraphs, and connected induced subgraphs, of a given connected graph form a state space whose local moves are the addition or removal of a single edge or vertex of the graph, respectively. A spanning tree of this state space can be obtained by adding the first edge or vertex (in some ordering of the edges or vertices) whose addition produces another connected subgraph; its root is the whole graph. Applying local search to this state space and parent operator produces an algorithm for listing all connected subgraphs in polynomial time per subgraph.[2]

Other applications include algorithms for generating the following structures:

References

  1. "A pivoting algorithm for convex hulls and vertex enumeration of arrangements and polyhedra", Discrete & Computational Geometry 8 (3): 295–313, 1992, doi:10.1007/BF02293050 ; preliminary version in Seventh Annual Symposium on Computational Geometry, 1991, doi:10.1145/109648.109659
  2. 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 "Reverse search for enumeration", Discrete Applied Mathematics 65 (1–3): 21–46, 1996, doi:10.1016/0166-218X(95)00026-N, http://cgm.cs.mcgill.ca/~avis/doc/avis/AF96a.ps 
  3. "A revised implementation of the reverse search vertex enumeration algorithm", Polytopes—combinatorics and computation: Including papers from the DMV-Seminar "Polytopes and Optimization" held in Oberwolfach, November 1997, DMV Seminar, 29, Basel: Birkhäuser, 2000, pp. 177–198 
  4. Sleumer, Nora H. (1999), "Output-sensitive cell enumeration in hyperplane arrangements", Nordic Journal of Computing 6 (2): 137–147 
  5. Lawson, C. L. (1972), Generation of a triangular grid with applications to contour plotting, Memo 299, Jet Propulsion Laboratory 
  6. "Locally equiangular triangulations", The Computer Journal 21 (3): 243–245, 1973, doi:10.1093/comjnl/21.3.243 
  7. 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 
  8. Horiyama, Takashi; Yamane, Shogo (2011), "Generation of polyiamonds for p6 tiling by the reverse search", Computational Geometry, Graphs and Applications - 9th International Conference, CGGA 2010, Dalian, China, November 3-6, 2010, Revised Selected Papers, Lecture Notes in Computer Science, 7033, Springer, pp. 96–107, doi:10.1007/978-3-642-24983-9_10, ISBN 978-3-642-24982-2 
  9. Caporossi, Gilles; Hansen, Pierre (May 1998), "Enumeration of polyhex hydrocarbons to [math]\displaystyle{ h=21 }[/math]", Journal of Chemical Information and Computer Sciences 38 (4): 610–619, doi:10.1021/ci970116n 
  10. Kurita, Kazuhiro; Wasa, Kunihiro (2022), "Constant amortized time enumeration of Eulerian trails", Theoretical Computer Science 923: 1–12, doi:10.1016/j.tcs.2022.04.048 
  11. "All maximal independent sets and dynamic dominance for sparse graphs", ACM Transactions on Algorithms 5 (4): A38:1–A38:14, 2009, doi:10.1145/1597036.1597042 
  12. "Generating rooted triangulations without repetitions", Algorithmica 16 (6): 618–632, 1996, doi:10.1007/s004539900067 
  13. Deza, Antoine (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, 872, pp. 30–34 
  14. "Enumerating non-crossing minimally rigid frameworks", Graphs and Combinatorics 23 (S1): 117–134, June 2007, doi:10.1007/s00373-007-0709-0, https://www-cgrl.cs.mcgill.ca/~avis/doc/avis/AKOST06a.pdf 
  15. Yamanaka, Katsuhisa (2021), "Algorithmic enumeration of surrounding polygons", Discrete Applied Mathematics 303: 305–313, doi:10.1016/j.dam.2020.03.034, http://cgm.cs.mcgill.ca/~avis/doc/avis/YAHOUY20.pdf 
  16. "From the zonotope construction to the Minkowski addition of convex polytopes", Journal of Symbolic Computation 38 (4): 1261–1272, 2004, doi:10.1016/j.jsc.2003.08.007 
  17. Weibel, Christophe (2010), "Implementation and parallelization of a reverse-search algorithm for Minkowski sums", 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 
  18. "Reverse search for monomial ideals", Journal of Symbolic Computation 44 (10): 1477–1486, 2009, doi:10.1016/j.jsc.2009.05.002