# Book embedding

In graph theory, a book embedding is a generalization of planar embedding of a graph to embeddings in a book, a collection of half-planes all having the same line as their boundary. Usually, the vertices of the graph are required to lie on this boundary line, called the spine, and the edges are required to stay within a single half-plane. The book thickness of a graph is the smallest possible number of half-planes for any book embedding of the graph. Book thickness is also called pagenumber, stacknumber or fixed outerthickness. Book embeddings have also been used to define several other graph invariants including the pagewidth and book crossing number.
Every graph with n vertices has book thickness at most $\lceil n/2\rceil$, and this formula gives the exact book thickness for complete graphs. The graphs with book thickness one are the outerplanar graphs. The graphs with book thickness at most two are the subhamiltonian graphs, which are always planar; more generally, every planar graph has book thickness at most four. It is NP-hard to determine the exact book thickness of a given graph, with or without knowing a fixed vertex ordering along the spine of the book. Testing the existence of a three-page book embedding of a graph, given a fixed ordering of the vertices along the spine of the embedding, has unknown computational complexity: it is neither known to be solvable in polynomial time nor known to be NP-hard.
One of the original motivations for studying book embeddings involved applications in VLSI design, in which the vertices of a book embedding represent components of a circuit and the wires represent connections between them. Book embedding also has applications in graph drawing, where two of the standard visualization styles for graphs, arc diagrams and circular layouts, can be constructed using book embeddings.
In transportation planning, the different sources and destinations of foot and vehicle traffic that meet and interact at a traffic light can be modeled mathematically as the vertices of a graph, with edges connecting different source-destination pairs. A book embedding of this graph can be used to design a schedule that lets all the traffic move across the intersection with as few signal phases as possible. In bioinformatics problems involving the folding structure of RNA, single-page book embeddings represent classical forms of nucleic acid secondary structure, and two-page book embeddings represent pseudoknots. Other applications of book embeddings include abstract algebra and knot theory.

## History

The notion of a book, as a topological space, was defined by C. A. Persinger and Gail Atneosen in the 1960s. As part of this work, Atneosen already considered embeddings of graphs in books. The embeddings he studied used the same definition as embeddings of graphs into any other topological space: vertices are represented by distinct points, edges are represented by curves, and the only way that two edges can intersect is for them to meet at a common endpoint.
In the early 1970s, Paul C. Kainen and L. Taylor Ollmann developed a more restricted type of embedding that came to be used in most subsequent research. In their formulation, the graph's vertices must be placed along the spine of the book, and each edge must lie in a single page. Important milestones in the later development of book embeddings include the proof by Mihalis Yannakakis in the late 1980s that planar graphs have book thickness at most four, and the discovery in the late 1990s of close connections between book embeddings and bioinformatics.

## Definitions

A book is a particular kind of topological space, also called a fan of half-planes. It consists of a single line ℓ, called the spine or back of the book, together with a collection of one or more half-planes, called the pages or leaves of the book, each having the spine as its boundary. Books with a finite number of pages can be embedded into three-dimensional space, for instance by choosing ℓ to be the z-axis of a Cartesian coordinate system and choosing the pages to be the k half-planes whose dihedral angle with respect to the xz-plane is an integer multiple of 2π/k.
A book drawing of a finite graph G onto a book B is a drawing of G on B such that every vertex of G is drawn as a point on the spine of B, and every edge of G is drawn as a curve that lies within a single page of B. The k-page book crossing number of G is the minimum number of crossings in a k-page book drawing.
A book embedding of G onto B is a book drawing that forms a graph embedding of G into B. That is, it is a book drawing of G on B that does not have any edge crossings. Every finite graph has a book embedding onto a book with a large enough number of pages. For instance, it is always possible to embed each edge of the graph on its own separate page. The book thickness, pagenumber, or stack number of G is the minimum number of pages required for a book embedding of G. Another parameter that measures the quality of a book embedding, beyond its number of pages, is its pagewidth. This is defined analogously to cutwidth as the maximum number of edges that can be crossed by a ray perpendicular to the spine within a single page. Equivalently (for book embeddings in which each edge is drawn as a monotonic curve), it is the maximum size of a subset of edges within a single page such that the intervals defined on the spine by pairs of endpoints of the edges all intersect each other.
It is crucial for these definitions that edges are only allowed to stay within a single page of the book. As Atneosen already observed, if edges may instead pass from one page to another across the spine of the book, then every graph may be embedded into a three-page book. For such a three-page topological book embedding in which spine crossings are allowed, every graph can be embedded with at most a logarithmic number of spine crossings per edge, and some graphs need this many spine crossings.

## Specific graphs

As shown in the first figure, the book thickness of the complete graph K$_5$ is three: as a non-planar graph its book thickness is greater than two, but a book embedding with three pages exists. More generally, the book thickness of every complete graph with n ≥ 4 vertices is exactly $\lceil n/2\rceil$. This result also gives an upper bound on the maximum possible book thickness of any n-vertex graph.
The two-page crossing number of the complete graph K$_n$ is
    ${\frac {1}{4}}{\biggl \lfloor }{\frac {n}{2}}{\biggr \rfloor }{\biggl \lfloor }{\frac {n-1}{2}}{\biggr \rfloor }{\biggl \lfloor }{\frac {n-2}{2}}{\biggr \rfloor }{\biggl \lfloor }{\frac {n-3}{2}}{\biggr \rfloor },$
matching a still-unproven conjecture of Anthony Hill on what the unrestricted crossing number of this graph should be. That is, if Hill's conjecture is correct, then the drawing of this graph that minimizes the number of crossings is a two-page drawing.
The book thickness of the complete bipartite graph K$_{a,b}$ is at most min(a,b). To construct a drawing with this book thickness, for each vertex on the smaller side of the bipartition, one can place the edges incident with that vertex on their own page. This bound is not always tight; for instance, K$_{4,4}$ has book thickness three, not four. However, when the two sides of the graph are very unbalanced, with b > a(a − 1), the book thickness of K$_{a,b}$ is exactly a.
For the Turán graph T(kr,r) (a complete multipartite graph K$_{k,k,...}$ formed from r independent sets of k vertices per independent set, with an edge between every two vertices from different independent sets) the book thickness t is sandwiched between
    $\left\lceil {\frac {k(r-1)}{2}}\right\rceil \leq t\leq \left\lceil {\frac {kr}{2}}\right\rceil$
and when r is odd the upper bound can be improved to
    $t\leq (r-1)\left\lceil {\frac {k}{2}}\right\rceil +\left\lceil {\frac {k}{4}}\right\rceil .$
The book thickness of binary de Bruijn graphs, shuffle-exchange graphs, and cube-connected cycles (when these graphs are large enough to be nonplanar) is exactly three.

## Properties
### Planarity and outerplanarity

The book thickness of a given graph G is at most one if and only if G is an outerplanar graph. An outerplanar graph is a graph that has a planar embedding in which all vertices belong to the outer face of the embedding. For such a graph, placing the vertices in the same order along the spine as they appear in the outer face provides a one-page book embedding of the given graph. (An articulation point of the graph will necessarily appear more than once in the cyclic ordering of vertices around the outer face, but only one of those copies should be included in the book embedding.) Conversely, a one-page book embedding is automatically an outerplanar embedding. For, if a graph is embedded on a single page, and another half-plane is attached to the spine to extend its page to a complete plane, then the outer face of the embedding includes the entire added half-plane, and all vertices lie on this outer face.
Every two-page book embedding is a special case of a planar embedding, because the union of two pages of a book is a space topologically equivalent to the whole plane. Therefore, every graph with book thickness two is automatically a planar graph. More precisely, the book thickness of a graph G is at most two if and only if G is a subgraph of a planar graph that has a Hamiltonian cycle. If a graph is given a two-page embedding, it can be augmented to a planar Hamiltonian graph by adding (into any page) extra edges between any two consecutive vertices along the spine that are not already adjacent, and between the first and last spine vertices. The Goldner–Harary graph provides an example of a planar graph that does not have book thickness two: it is a maximal planar graph, so it is not possible to add any edges to it while preserving planarity, and it does not have a Hamiltonian cycle. Because of this characterization by Hamiltonian cycles, graphs that have two-page book embeddings are also known as subhamiltonian graphs.
All planar graphs whose maximum degree is at most four have book thickness at most two. Planar 3-trees have book thickness at most three. More generally, all planar graphs have book thickness four. It has been claimed by Mihalis Yannakakis in 1986 that there exist some planar graphs that have book thickness exactly four. However, a detailed proof of this claim, announced in a subsequent journal paper, was not known until 2020, when Bekos et al. presented planar graphs with treewidth 4 that require four pages in any book embedding.

### Behavior under subdivisions

Subdividing every edge of a graph into two-edge paths, by adding new vertices within each edge, may sometimes increase its book thickness. For instance, the diamond graph has book thickness one (it is outerplanar) but its subdivision has book thickness two (it is planar and subhamiltonian but not outerplanar). However, this subdivision process can also sometimes significantly reduce the book thickness of the subdivided graph. For instance, the book thickness of the complete graph K$_n$ is proportional to its number of vertices, but subdividing each of its edges into a two-edge path produces a subdivision whose book thickness is much smaller, only $O({\sqrt {n}})$. Despite the existence of examples such as this one, Blankenship & Oporowski (1999) conjectured that a subdivision's book thickness cannot be too much smaller than that of the original graph. Specifically, they conjectured that there exists a function f such that, for every graph G and for the graph H formed by replacing every edge in G by a two-edge path, if the book thickness of H is t then the book thickness of G is at most f(t). Their conjecture turned out to be false: graphs formed by Cartesian products of stars and triangular tilings have unbounded book thickness, but subdividing their edges into six-edge paths reduces their book thickness to three.

### Relation to other graph invariants

Book thickness is related to thickness, the number of planar graphs needed to cover the edges of the given graph. A graph G has thickness θ if it can be drawn in the plane, and its edges colored with θ colors, in such a way that edges of the same color as each other do not cross. Analogously, a graph G has book thickness θ if it can be drawn in a half plane, with its vertices on the boundary of the half plane, with its edges colored with θ colors with no crossing between two edges of the same color. In this formulation of book thickness, the colors of the edges correspond to the pages of the book embedding. However, thickness and book thickness can be very different from each other: there exist graphs (subdivisions of complete graphs) that have unbounded book thickness, despite having thickness two.
Graphs of treewidth k have book thickness at most k + 1 and this bound is tight for k > 2. Graphs with m edges have book thickness $O({\sqrt {m}})$, and graphs of genus g have book thickness $O({\sqrt {g}})$. More generally, it has been stated that every minor-closed graph family has bounded book thickness. However, the proof of this claim rests on a previous claim that graphs embedded on non-orientable surfaces have bounded book thickness, for which a detailed proof has not been supplied. The 1-planar graphs, which are not closed under minors, have bounded book thickness, but some 1-planar graphs including K$_{2,2,2,2}$ have book thickness at least four.
Every shallow minor of a graph of bounded book thickness is a sparse graph, whose ratio of edges to vertices is bounded by a constant that depends only on the depth of the minor and on the book thickness. That is, in the terminology of Nešetřil & Ossona de Mendez (2012), the graphs of bounded book thickness have bounded expansion. However, even the graphs of bounded degree, a much stronger requirement than having bounded expansion, can have unbounded book thickness.
Because graphs of book thickness two are planar graphs, they obey the planar separator theorem: they have separators, subsets of vertices whose removal splits the graph into pieces with at most 2n/3 vertices each, with only $O({\sqrt {n}})$ vertices in the separator. Here, n refers to the number of vertices in the graph. However, there exist graphs of book thickness three that do not have separators of sublinear size.
The edges within a single page of a book embedding behave in some ways like a stack data structure. This can be formalized by considering an arbitrary sequence of push and pop operations on a stack, and forming a graph in which the stack operations correspond to the vertices of the graph, placed in sequence order along the spine of a book embedding. Then, if one draws an edge from each pop operation that pops an object x from the stack, to the previous push operation that pushed x, the resulting graph will automatically have a one-page embedding. For this reason, the page number of a graph has also been called its stack number. In the same way, one may consider an arbitrary sequence of enqueue and dequeue operations of a queue data structure, and form a graph that has these operations as its vertices, placed in order on the spine of a single page, with an edge between each enqueue operation and the corresponding dequeue. Then, in this graph, each two edges will either cross or cover disjoint intervals on the spine. By analogy, researchers have defined a queue embedding of a graph to be an embedding in a topological book such that each vertex lies on the spine, each edge lies in a single page, and each two edges in the same page either cross or cover disjoint intervals on the spine. The minimum number of pages needed for a queue embedding of a graph is called its queue number.

### Computational complexity

Finding the book thickness of a graph is NP-hard. This follows from the fact that finding Hamiltonian cycles in maximal planar graphs is NP-complete. In a maximal planar graph, the book thickness is two if and only if a Hamiltonian cycle exists. Therefore, it is also NP-complete to test whether the book thickness of a given maximal planar graph is two.
If an ordering of the vertices of a graph along the spine of an embedding is fixed, then a two-page embedding (if it exists) can be found in linear time, as an instance of planarity testing for a graph formed by augmenting the given graph with a cycle connecting the vertices in their spine ordering. Unger (1992) claimed that finding three-page embeddings with a fixed spine ordering can also be performed in polynomial time although his writeup of this result omits many details. However, for graphs that require four or more pages, the problem of finding an embedding with the minimum possible number of pages remains NP-hard, via an equivalence to the NP-hard problem of coloring circle graphs, the intersection graphs of chords of a circle. Given a graph G with a fixed spine ordering for its vertices, drawing these vertices in the same order around a circle and drawing the edges of G as line segments produces a collection of chords representing G. One can then form a circle graph that has the chords of this diagram as vertices and crossing pairs of chords as edges. A coloring of the circle graph represents a partition of the edges of G into subsets that can be drawn without crossing on a single page. Therefore, an optimal coloring is equivalent to an optimal book embedding. Since circle graph coloring with four or more colors is NP-hard, and since any circle graph can be formed in this way from some book embedding problem, it follows that optimal book embedding is also NP-hard. For a fixed vertex ordering on the spine of a two-page book drawing, it is also NP-hard to minimize the number of crossings when this number is nonzero.
If the spine ordering is unknown but a partition of the edges into two pages is given, then it is possible to find a 2-page embedding (if it exists) in linear time by an algorithm based on SPQR trees. However, it is NP-complete to find a 2-page embedding when neither the spine ordering nor the edge partition is known. Finding the book crossing number of a graph is also NP-hard, because of the NP-completeness of the special case of testing whether the 2-page crossing number is zero.
As a consequence of bounded expansion, the subgraph isomorphism problem, of finding whether a pattern graph of bounded size exists as a subgraph of a larger graph, can be solved in linear time when the larger graph has bounded book thickness. The same is true for detecting whether the pattern graph is an induced subgraph of the larger graph, or whether it has a graph homomorphism to the larger graph. For the same reason, the problem of testing whether a graph of bounded book thickness obeys a given formula of first order logic is fixed-parameter tractable.
Bekos, Kaufmann & Zielke (2015) describe a system for finding optimal book embeddings by transforming the problem into an instance of the Boolean satisfiability problem and applying a SAT solver to the resulting problem. They state that their system is capable of finding an optimal embedding for 400-vertex maximal planar graphs in approximately 20 minutes.

## Applications
### Fault-tolerant multiprocessing

One of the main motivations for studying book embedding cited by Chung, Leighton & Rosenberg (1987) involves an application in VLSI design, to the organization of fault-tolerant multiprocessors. In the DIOGENES system developed by these authors, the CPUs of a multiprocessor system are arranged into a logical sequence corresponding to the spine of a book (although this sequence may not necessarily be placed along a line in the physical layout of this system). Communication links connecting these processors are grouped into "bundles" which correspond to the pages of a book and act like stacks: connecting one of the processors to the start of a new communications link pushes all the previous links upward in the bundle, and connecting another processor to the end of a communication link connects it to the one at the bottom of the bundle and pops all the other ones down. Because of this stack behavior, a single bundle can handle a set of communications links that form the edges of a single page in a book embedding. By organizing the links in this way, a wide variety of different network topologies can be implemented, regardless of which processors have become faulty, as long as enough non-faulty processors remain to implement the network. The network topologies that can be implemented by this system are exactly the ones that have book thickness at most equal to the number of bundles that have been made available. Book embedding may also be used to model the placement of wires connecting VLSI components into the layers of a circuit.

### Stack sorting

Another application cited by Chung, Leighton & Rosenberg (1987) concerns sorting permutations using stacks. An influential result of Donald Knuth (1968) showed that a system that processes a data stream by pushing incoming elements onto a stack and then, at appropriately chosen times, popping them from the stack onto an output stream can sort the data if and only if its initial order is described by a permutation that avoids the permutation pattern 231. Since then, there has been much work on similar problems of sorting data streams by more general systems of stacks and queues. In the system considered by Chung, Leighton & Rosenberg (1987), each element from an input data stream must be pushed onto one of several stacks. Then, once all of the data has been pushed in this way, the items are popped from these stacks (in an appropriate order) onto an output stream. As Chung et al. observe, a given permutation can be sorted by this system if and only if a certain graph, derived from the permutation, has a book embedding with the vertices in a certain fixed order along the spine and with a number of pages that is at most equal to the number of stacks.

### Traffic control

As Kainen (1990) described, a book embedding may be used to describe the phases of a traffic signal at a controlled intersection. At an intersection, the incoming and outgoing lanes of traffic (including the ends of pedestrian crosswalks and bicycle lanes as well as lanes for motor vehicles) may be represented as the vertices of a graph, placed on the spine of a book embedding in their clockwise order around the junction. The paths through the intersection taken by traffic to get from an incoming lane to an outgoing lane may be represented as the edges of an undirected graph. For instance, this graph might have an edge from an incoming to an outgoing lane of traffic that both belong to the same segment of road, representing a U-turn from that segment back to that segment, only if U-turns are allowed at the junction. For a given subset of these edges, the subset represents a collection of paths that can all be traversed without interference from each other if and only if the subset does not include any pair of edges that would cross if the two edges were placed in a single page of a book embedding. Thus, a book embedding of this graph describes a partition of the paths into non-interfering subsets, and the book thickness of this graph (with its fixed embedding on the spine) gives the minimum number of distinct phases needed for a signalling schedule that includes all possible traffic paths through the junction.

### Graph drawing

Book embedding has also been frequently applied in the visualization of network data. Two of the standard layouts in graph drawing, arc diagrams and circular layouts, can be viewed as book embeddings, and book embedding has also been applied in the construction of clustered layouts, simultaneous embeddings, and three-dimensional graph drawings.
An arc diagram or linear embedding places vertices of a graph along a line, and draws the edges of the graph as semicircles either above or below this line, sometimes also allowing edges to be drawn on segments of the line. This drawing style corresponds to a book embedding with either one page (if all semicircles are above the line) or two pages (if both sides of the line are used), and was originally introduced as a way of studying the crossing numbers of graphs. Planar graphs that do not have two-page book embeddings may also be drawn in a similar way, by allowing their edges to be represented by multiple semicircles above and below the line. Such a drawing is not a book embedding by the usual definition, but has been called a topological book embedding. For every planar graph, it is always possible to find such an embedding in which each edge crosses the spine at most once.
In another drawing style, the circular layout, the vertices of a graph are placed on a circle and the edges are drawn either inside or outside the circle. Again, a placement of the edges within the circle (for instance as straight line segments) corresponds to a one-page book drawing, while a placement both inside and outside the circle corresponds to a two-page book drawing.
For one-page drawings of either style, it is important to keep the number of crossings small as a way of reducing the visual clutter of the drawing. Minimizing the number of crossings is NP-complete, but may be approximated with an approximation ratio of O(log$^2$ n) where n is the number of vertices. Minimizing the one-page or two-page crossing number is fixed-parameter tractable when parameterized by the cyclomatic number of the given graph, or by a combination of the crossing number and the treewidth of the graph. Heuristic methods for reducing the crossing complexity have also been devised, based e.g. on a careful vertex insertion order and on local optimization.
Two-page book embeddings with a fixed partition of the edges into pages can be interpreted as a form of clustered planarity, in which the given graph must be drawn in such a way that parts of the graph (the two subsets of edges) are placed in the drawing in a way that reflects their clustering. Two-page book embedding has also been used to find simultaneous embeddings of graphs, in which two graphs are given on the same vertex set and one must find a placement for the vertices in which both graphs are drawn planarly with straight edges.
Book embeddings with more than two pages have also been used to construct three-dimensional drawings of graphs. In particular, Wood (2002) used a construction for book embeddings that keep the degree of each vertex within each page low, as part of a method for embedding graphs into a three-dimensional grid of low volume.

### RNA folding

In the study of how RNA molecules fold to form their structure, the standard form of nucleic acid secondary structure can be described diagrammatically as a chain of bases (the RNA sequence itself), drawn along a line, together with a collection of arcs above the line describing the basepairs of the structure. That is, although these structures actually have a complicated three-dimensional shape, their connectivity (when a secondary structure exists) can be described by a more abstract structure, a one-page book embedding. However, not all RNA folds behave in this simple way. Haslinger & Stadler (1999) have proposed a so-called "bi-secondary structure" for certain RNA pseudoknots that takes the form of a two-page book embedding: the RNA sequence is again drawn along a line, but the basepairs are drawn as arcs both above and below this line. In order to form a bi-secondary structure, a graph must have maximum degree at most three: each base can only participate in one arc of the diagram, in addition to the two links to its neighbors in the base sequence. Advantages of this formulation include the facts that it excludes structures that are actually knotted in space, and that it matches most known RNA pseudoknots.
Because the spine ordering is known in advance for this application, testing for the existence of a bi-secondary structure for a given basepairing is straightforward. The problem of assigning edges to the two pages in a compatible way can be formulated as either an instance of 2-satisfiability, or as a problem of testing the bipartiteness of the circle graph whose vertices are the basepairs and whose edges describe crossings between basepairs. Alternatively and more efficiently, as Haslinger & Stadler (1999) show, a bi-secondary structure exists if and only if the diagram graph of the input (a graph formed by connecting the bases into a cycle in their sequence order and adding the given basepairs as edges) is a planar graph. This characterization allows bi-secondary structures to be recognized in linear time as an instance of planarity testing.
Blin et al. (2007) used the connection between secondary structures and book embeddings as part of a proof of the NP-hardness of certain problems in RNA secondary structure comparison. And if an RNA structure is tertiary rather than bi-secondary (that is, if it requires more than two pages in its diagram), then determining the page number is again NP-hard.

### Computational complexity theory

Pavan, Tewari & Vinodchandran (2012) used book embedding to study the computational complexity theory of the reachability problem in directed graphs. As they have observed, reachability for two-page directed graphs may be solved in unambiguous logarithmic space (the analogue, for logarithmic space complexity, of the class UP of unambiguous polynomial-time problems). However, reachability for three-page directed graphs requires the full power of nondeterministic logarithmic space. Thus, book embeddings seem intimately connected with the distinction between these two complexity classes.
The existence of expander graphs with constant page number is the key step in proving that there is no subquadratic-time simulation of two-tape non-deterministic Turing machines by one-tape non-deterministic Turing machines.

### Other areas of mathematics

McKenzie & Overbay (2010) study applications of book thickness in abstract algebra, using graphs defined from the zero divisors of a finite local ring by making a vertex for each zero divisor and an edge for each pair of values whose product is zero.
In a multi-paper sequence, Dynnikov has studied the topological book embeddings of knots and links, showing that these embeddings can be described by a combinatorial sequence of symbols and that the topological equivalence of two links can be demonstrated by a sequence of local changes to the embeddings.