# Simultaneous embedding

Simultaneous embedding is a technique in graph drawing and information visualization for visualizing two or more different graphs on the same or overlapping sets of labeled vertices, while avoiding crossings within both graphs. Crossings between an edge of one graph and an edge of the other graph are allowed.
If edges are allowed to be drawn as polylines or curves, then any planar graph may be drawn without crossing with its vertices in arbitrary positions in the plane, where the same vertex placement provides a simultaneous embedding.
There are two restricted models: simultaneous geometric embedding, where each graph must be drawn planarly with line segments representing its edges rather than more complex curves, restricting the two given graphs to subclasses of the planar graphs, and simultaneous embedding with fixed edges, where curves or bends are allowed in the edges, but any edge in both graphs must be represented by the same curve in both drawings. In the unrestricted model, any two planar graphs can have a simultaneous embedding.

## Definition

Simultaneous embedding is a technique in graph drawing and information visualization for visualizing two or more different graphs on the same or overlapping sets of labeled vertices, while avoiding crossings within both graphs. Crossings between an edge of one graph and an edge of the other graph are allowed; it is only crossings between two edges of the same graph that are disallowed.
If edges are allowed to be drawn as polylines or curves, then any planar graph may be drawn without crossings with its vertices in arbitrary positions in the plane. Using the same vertex placement for two graphs provides a simultaneous embedding of the two graphs. Research has concentrated on finding drawings with few bends, or with few crossings between edges from the two graphs.
There are two restricted models: simultaneous geometric embedding and simultaneous embedding with fixed edges, where curves or bends are allowed in the edges, but any edge present in both graphs must be represented by the same curve in both drawings. When a simultaneous geometric embedding exists, it automatically is also a simultaneous embedding with fixed edges.
For simultaneous embedding problems on more than two graphs, it is standard to assume that all pairs of input graphs have the same intersection as each other; that is, the edge and vertex sets of the graphs form a sunflower. This constraint is known as sunflower intersection.
Simultaneous embedding is closely related to thickness, the minimum number of planar subgraphs that can cover all of the edges of a given graph, and geometric thickness, the minimum number of edge colors needed in a straight-line drawing of a given graph with no crossing between same-colored edges. In particular, the thickness of a given graph is two, if the graph's edges can be partitioned into two subgraphs that have a simultaneous embedding, and the geometric thickness is two, if the edges can be partitioned into two subgraphs with simultaneous geometric embedding.

## Geometric

In simultaneous geometric embedding each graph must be drawn as a planar graph with line segments representing its edges rather than more complex curves, restricting the two given graphs to subclasses of the planar graphs. Many results on simultaneous geometric embedding are based on the idea that the Cartesian coordinates of the two given graphs' vertices can be derived from properties of the two graphs. One of the most basic results of this type is the fact that any two path graphs on the same vertex set always have a simultaneous embedding. To find such an embedding, one can use the position of a vertex in the first path as its x-coordinate, and the position of the same vertex in the second path as its y-coordinate. In this way, the first path will be drawn as an x-monotone polyline, a type of curve that is automatically non-self-crossing, and the second path will similarly be drawn as a y-monotone polyline.
This type of drawing places the vertices in an integer lattice of dimensions linear in the graph sizes. Similarly defined layouts also work, with larger but still linear grid sizes, when both graphs are caterpillars or when both are cycle graphs. A simultaneous embedding in a grid of linear dimensions is also possible for any number of graphs that are all stars. Other pairs of graph types that always admit a simultaneous embedding, but that might need larger grid sizes, include a wheel graph and a cycle graph, a tree and a matching, or a pair of graphs both of which have maximum degree two. However, pairs of planar graphs and a matching, or of a Angelini, Geyer, Neuwirth and Kaufmann showed that a tree and a path exist, that have no simultaneous geometric embedding.
Testing whether two graphs admit a simultaneous geometric embedding is NP-hard. More precisely, it is complete for the existential theory of the reals. The proof of this result also implies that for some pairs of graphs that have simultaneous geometric embeddings, the smallest grid on which they can be drawn has doubly exponential size.
When a simultaneous geometric embedding exists, it automatically is also a simultaneous embedding with fixed edges.

## Fixed edges

In simultaneous embedding with fixed edges, curves or bends are allowed in the edges, but any edge present in both graphs must be represented by the same curve in both drawings. The classification of different types of input as always having an embedding or as sometimes not being possible depends not only on the two types of graphs to be drawn, but also on the structure of their intersection. For instance, it is always possible to find such an embedding when both of the two given graphs are outerplanar graphs and their intersection is a linear forest, with at most one bend per edge and with vertex coordinates and bend points all belonging to a grid of polynomial area. However, there exist other pairs of outerplanar graphs with more complex intersections that have no such embedding. It is also possible to find a simultaneous embedding with fixed edges for any pair of a planar graph and a tree.
It is an open question whether the existence of a simultaneous embedding with fixed edges for two given graphs can be tested in polynomial time. However, for three or more graphs, the problem is NP-complete. When simultaneous embeddings with fixed edges do exist, they can be found in polynomial time for pairs of outerplanar graphs, and for Biconnected graphs, i.e. pairs of graphs whose intersection is biconnected.

## Unrestricted

Any two planar graphs can have a simultaneous embedding. This may be done in a grid of polynomial area, with at most two bends per edge. Any two subhamiltonian graphs have a simultaneous embedding with at most one bend per edge.