Recognizing Map Graphs of Bounded Treewidth

A map graph is a graph admitting a representation in which vertices are nations on a spherical map and edges are shared curve segments or points between nations. We present an explicit fixed-parameter tractable algorithm for recognizing map graphs parameterized by treewidth. The algorithm has time complexity that is linear in the size of the graph and, if the input is a yes-instance, it reports a certificate in the form of a so-called witness. Furthermore, this result is developed within a more general algorithmic framework that allows to test, for any $k$, if the input graph admits a $k$-map (where at most $k$ nations meet at a common point) or a hole-free~$k$-map (where each point of the sphere is covered by at least one nation). We point out that, although bounding the treewidth of the input graph also bounds the size of its largest clique, the latter alone does not seem to be a strong enough structural limitation to obtain an efficient time complexity. In fact, while the largest clique in a $k$-map graph is $\lfloor 3k/2 \rfloor$, the recognition of $k$-map graphs is still open for any fixed $k \ge 5$.


Introduction
Planarity is one of the most influential concepts in Graph Theory.Inspired by topological inference problems and by intersection graphs of planar curves, in 1998, Chen, Grigni and Papadimitriou [10] suggested the study of map graphs as a generalized notion of planarity.A map of a graph G is a function M that assigns each vertex v of G to a region M(v) on the sphere homeomorphic to a closed disk such that no two regions share an interior point, and any two distinct vertices v and w are adjacent in G if and only if the boundaries of M(v) and M(w) share at least one point.For each vertex v of G, the region M(v) is called the nation of v.A connected open region of the sphere that is not covered by nations is a hole.A graph that admits a map is a map graph, whereas a graph that admits a map without holes is a hole-free map graph; Figures 1a and 1b show a graph and a map of it, respectively.Map graphs generalize planar graphs by allowing local non-planarity at points where more than three nations meet.In fact, the planar graphs are exactly those graphs having a map in which at most three nations share a boundary point [10,21].parameter k.Notably, for graphs of bounded treewidth, our algorithm improves over the existing literature [7,12,33] in three ways: it solves the problem for any fixed k, it can deal with both scenarios where holes are or are not allowed in the sought map, and it exhibits an asymptotically optimal running time in the input size.The following theorem summarizes our main contribution.
Theorem 1.Given an n-vertex graph G and a tree-decomposition of G of width t, there is a O(t O(t) • n)-time algorithm that computes the minimum k, if any, such that G admits a (hole-free) k-map.In the positive case, the algorithm returns a certificate in the form of a witness of G within the same time complexity.
We remark that the problem of recognizing map graphs can be expressed by using MSO 2 logic.Thus the main positive result behind Theorem 1 can be alternatively achieved by Courcelle's theorem [15].A formal proof is reported in the appendix.However, with this approach, the dependency of the time complexity on the treewidth is notoriously very high.As a matter of fact, Courcelle's theorem is generally used as a classification tool, while the design of an explicit ad-hoc algorithm remains a challenging and valuable task [17].
To prove Theorem 1, we first solve the decision version of the problem.For a fixed k, we use a dynamic-programming approach, which can deal with different constraints on the desired witness.While we exploit such flexibility to check whether at most k nations intersect at any point and whether holes can be avoided, other constraints could be plugged into the framework such as, for example, the outerplanarity of the witness (as in [30]).In view of this versatility, future applications of our tools may be expected.
Proof strategy.We exploit the characterization in [11] and test for the existence of a suitable witness of the input graph.The crux of our technique is in the computation of suitable records that represent equivalent witnesses and contain only vertices of a tree-decomposition bag.Each such record must carry enough information, in terms of embedding, so to allow testing whether it can be extended with a new vertex or merged with another witness.Moreover, we need to check whether any such witness yields a k-map and, if required, a hole-free one.To deal with the latter property, we provide a strengthening of the characterization in [11], which we believe to be of independent interest, that translates into maintaining suitable counters on the edges of our records.Additional checks on the desired witness can be plugged in the presented algorithmic framework, provided that the records store enough information.One of the main difficulties is hence "sketching" irrelevant parts of the embedded graph without sacrificing too much information.(A similar challenge is faced in the context of different planarity and beyond-planarity problems [19,27,29].)Also, when creating such sketches, multiple copies (potentially linearly many) of the same edge may appear, which we need to simplify to keep our records small.The formalization of such records then allows us to exploit a dynamic-programming approach on a tree-decomposition.
Paper structure.Section 2 contains preliminary definitions.Section 3 illustrates basic properties of map graphs that will be used throughout the paper.Section 4 introduces the concept of "sketching" an embedding of a witness, the key ingredient of the algorithmic framework, which we present in Section 5. Section 6 contains open problems raised by our work.

Preliminaries
We only consider finite, undirected, and simple graphs, although some procedures may produce non-simple graphs.In such a case the presence of self-loops or multiple edges will be clearly indicated.Let G = (V, E) be a graph; for a vertex v ∈ V , we denote by N (v) the set of neighbors of v in G, and by deg(v) the degree of v, i.e., the cardinality of N (v).

Embeddings.
A topological embedding of a graph G on the sphere Σ is a representation of G on Σ in which each vertex of G is associated with a point and each edge of G with a simple arc between its two endpoints in such a way that any two arcs intersect only at common endpoints.A topological embedding of G subdivides the sphere into topologically connected regions, called faces.If G is connected, the boundary of a face f is a closed walk, that is, a circular list of alternating vertices and edges; otherwise, the boundary of f is a set of closed walks.Note that a cut-vertex of G may appear multiple times in any such walk.A topological embedding of G uniquely defines a rotation system, that is, a cyclic order of the edges around each vertex.If G is connected, the boundary defining each face can be reconstructed from a rotation system; otherwise, to reconstruct the boundary of every face f , we also need to know which connected components are incident to f .We call the incidence relationship between closed walks of different components and faces the position system of G.A combinatorial embedding of G is an equivalence class of topological embeddings that define the same rotation and position systems.An embedded graph G is a graph along with a combinatorial embedding.A pair of parallel edges e and e of G with end-vertices v and w is homotopic if there is a face of G whose boundary consists of a single closed walk v, e, w, e .
Tree-decompositions. Let (X , T ) be a pair such that X = {X 1 , X 2 , . . ., X } is a collection of subsets of vertices of a graph G, called bags, and T is a tree whose nodes are in one-to-one correspondence with the elements of X .When this creates no ambiguity, X i will denote both a bag of X and the node of T whose corresponding bag is X i .The pair (X , T ) is a tree-decomposition of G if: (i) for every edge (u, v) of G, there exists a bag X i that contains both u and v, and (ii) for every vertex v of G, the set of nodes of T whose bags contain v induces a non-empty (connected) subtree of T .The width of (X , T ) is max i=1 |X i | − 1, while the treewidth of G is the minimum width over all tree-decompositions of G.For an n-vertex graph of treewidth t, a tree-decomposition of width t can be found in FPT time [4].Definition 1.A tree-decomposition (X , T ) of a graph G is called nice if T is a rooted tree with the following properties [5].
(P.1) Every node of T has at most two children.
(P.2) If a node X i of T has two children whose bags are X j and X j , then X i = X j = X j .In this case, X i is a join bag.(P.3)If a node X i of T has only one child X j , then X i = X j and there exists a vertex v ∈ G such that either X i = X j ∪ {v} or X i ∪ {v} = X j .In the former case X i is an introduce bag, while in the latter case X i is a forget bag.
(P.4) If a node X i is a leaf of T , then X i contains exactly one vertex, and X i is a leaf bag.
Note that, given a tree-decomposition of width t, a nice tree-decomposition can be computed in O(t • n) time (see, e.g., [28]).

Basic Properties of Map Graphs and Their Witnesses
The following statements have already been discussed in the work by Chen et al. [11], even though in a weaker or different form.For completeness, we provide full proofs.
Let G = (V, E) be a map graph and let W = (V ∪ I, A) be a witness of G, i.e., W is a planar bipartite graph such that Property 1.A graph is a k-map graph if and only if it admits a witness such that the maximum degree of every intersection vertex is k.Property 2. A graph G admits a map if and only if each of its biconnected components admits a map.Also, if G admits a hole-free map, then G is biconnected.
Let W = (V ∪ I, A) be an embedded witness (i.e., with a prescribed combinatorial embedding).An intersection vertex u ∈ I is inessential if deg(u) = 2 and there exists u ∈ I such that N (u) ⊂ N (u ); see Figure 2a.Furthermore, a pair of intersection vertices u 1 , u 2 ∈ I is a twin-pair if N (u 1 ) = N (u 2 ) = {v, w}, for some v, w ∈ V , and W contains a face whose boundary consists of a single closed walk with exactly four edges with end-vertices v, u 1 , w, u 2 ; see Figure 2b.Note that removing an inessential vertex or one vertex of a twin-pair from W does not modify Definition 2. An embedded witness of a map graph is compact if it contains neither inessential intersection vertices nor twin-pairs.We remark that a compact witness is not necessarily minimal, i.e., it may contain intersection vertices of degree greater than 2 whose removal does not modify its half-square; see also [11].However, in our setting, removing further information from a witness would have an impact on the proof of Theorem 2 and on the recognition algorithm (Section 5).
The next lemma shows that focusing on compact witnesses is not restrictive.

Lemma 1.
A graph G = (V, E) is a map graph if and only if it admits a compact witness.Also, G is a k-map graph if and only if it admits a compact witness whose intersection vertices have degree at most k.
Proof.For the first part of the statement, recall that a graph admits a map if and only if it admits a witness [10,11].Thus, if G has a compact witness, it is a map graph.For the other direction, suppose that G admits a map.Let Ŵ be any embedded witness of G. Let W be the embedded graph obtained from Ŵ by removing all inessential intersection vertices and by iteratively removing one intersection vertex for each twin-pair.Since we only removed degree-2 intersection vertices whose neighbors are already incident to a common intersection vertex, it holds that For the second part of the statement, recall that G admits a k-map if and only if it has a witness whose intersection vertices have degree at most k, by Property 1.Moreover, we have seen before that, for every witness Ŵ , there exists (at least) one compact witness W obtained by fixing a combinatorial embedding of Ŵ and by possibly removing intersection vertices of degree 2 that are either inessential or part of a twin-pair.Since Ŵ is bipartite, this implies that any intersection vertex that belongs to both Ŵ and W has the same degree in the two graphs.
Given a graph G such that n V ≥ 3 and a map M of G, the order of a point p ∈ M, denoted by ord(p), is equal to the number of nations and holes whose boundary contains p.Let W = (V ∪ I, A) be the bipartite embedded graph computed with the compact construction, defined as follows.For ease of description, we define W by constructing a topological embedding of it; refer to Figure 1.In particular, the witness of Figure 1c is compact and constructed with the described procedure (which again follows the lines of the work in [11]).For each nation M(v), we place the real vertex v in its interior.For each point p such that ord(p) ≥ 3, we add an intersection vertex u p to I and place it at point p.We connect each real vertex v to the intersection vertices that lie on the boundary of M(v), by drawing crossing-free simple arcs inside M(v).Note that, for each intersection vertex u p , it holds deg(u p ) = ord(p) − h(p), where h(p) is the number of holes in M whose boundary contains p. Finally, we remove inessential intersection vertices and, iteratively, a vertex for each twin-pair.For instance, in Figure 1b the nations colored light-yellow and light-green share two order-3 points that would give rise to inessential intersection vertices, which are indeed not reported in Figure 1c.
Lemma 2. Let W = (V ∪ I, A) be the embedded graph obtained from the map M of G by means of the compact construction.Then W is a compact witness of G.
Proof.The fact that the compact construction defines a topological embedding of W , and in particular that each arc is simple and no two arcs intersect at an interior point, follows by construction.Moreover, we explicitly removed inessential intersection vertices and twin-pairs, if any.So, it remains to prove that W 2 [V ] = G.By construction, for each edge of W 2 [V ], there is an edge in G. Also, any edge of G is represented by at least one point of M whose order is at least 2. Since we created an intersection vertex for each point of order greater than 2, it remains to argue about points of order exactly 2. Any such a point is an interior point of a simple arc along which two nations M(v) and M(w) touch.The two endpoints of this arc must have order at least 3, which implies that edge In [11], it is observed (without a formal argument) that a map graph is hole-free if and only if it admits a witness whose faces have 4 or 6 edges each.The next characterization improves over this observation and hence can be of independent interest.A connected embedded graph is a quadrangulation if each face boundary consists of a single closed walk with 4 edges.Theorem 2. A graph is a hole-free map graph if and only if it admits a compact witness that is a biconnected quadrangulation.Proof.(⇐) Refer to Figure 3.If a graph G admits a compact witness W , then by Lemma 1 G is a map graph.Thus we only need to show that W yields a map that is hole-free, by exploiting the assumption that W is a biconnected quadrangulation.Let W * be the embedded graph defined as follows: We add a dummy vertex inside each face of W and connect it to all vertices on the boundary of the face.Since W is biconnected, each face boundary is a simple cycle, and therefore W * is an embedded triangulation, i.e., each face contains three edges on its boundary.Let Γ be a topological embedding on the sphere of W * .It follows that each triangular face of Γ is incident to exactly one real vertex of W . Also, for each real vertex v of W , the union of the triangular faces incident to v defines a region R v that contains v in its interior.The latter property of Γ allows us to construct a map M of G by setting M(v) to be equal to the closure of R v , for each real vertex v of W .The fact that M is a hole-free map follows by construction.Namely, all points of the sphere are covered by nations, hence there are no holes.Also, the points of M of order at least 3 are in a one-to-one correspondence with the intersection vertices of W , and any other order-2 point of M lies along a simple arc connecting two points of higher order.(⇒) Let M be a hole-free map of a graph G.By Property 2, G is biconnected.Let W be the compact witness of G computed by the compact construction from M; for instance, the compact witness in Figure 3a is constructed from the map in Figure 3c by using the compact construction.Since G is biconnected, W is (at least) connected, and thus the boundary of any face of W consists of a single closed walk.In the following we prove that W is a quadrangulation.This, together with the fact that W is simple, implies biconnectivity.Since W is connected, simple and bipartite, the boundary of each of its faces consists of a single closed walk containing at least four edges.Assume for a contradiction that W contains a face f with more than four edges on the closed walk π defining its boundary.Then, since W is bipartite, π contains at least six edges.Consider any intersection vertex u on π.Let v and w be the two (real) vertices that precede and follow u along π, respectively.We distinguish two cases based on whether u is or is not the only intersection vertex in π that is adjacent to both v and w.
Suppose first that u is the only intersection vertex in π that is adjacent to both v and w.By construction, u has been placed on a point p ∈ M such that ord(p) ≥ 3. Since M is hole-free, p is the endpoint of a simple arc a that forms a shared boundary between M(v) and M(w).Let p be the other endpoint of a. Since ord(p ) ≥ 3 and M is hole-free, again W contains an intersection vertex u that has been placed on p .Either u belongs to π or not.In the first case, we contradict the fact that u is the only intersection vertex of π adjacent to both v and w; see Figure 4a for an illustration.In the second case, p is on the boundary of a hole, which contradicts the fact that M is hole-free; see Figure 4b for an illustration.
Suppose now that there is another intersection vertex u in π adjacent to both v and w; refer to Figure 4c for an illustration.Since u and u are both adjacent to v and w and both belong to π, in order for π to contain six (or more) edges, at least one of v, u, w, u occurs more than once along π, and between its (at least) two occurrences, there must be a real vertex w .Note that, by definition of v and w, such vertex occurring multiple times along π cannot be u.We assume that such vertex is u , the remaining cases can be handled with symmetric arguments.Consider a traversal of π that visits v, u, w in this order.Up to a renaming of the vertices, we can assume that w is the vertex that precedes the last occurrence of u in this traversal.Let q be the point of M where u has been placed on.By construction, q is the endpoint of a simple arc b that forms a shared boundary between M(w ) and M(v).Let q be the other endpoint of b.Since ord(q ) ≥ 3 and M is hole-free, again W contains an intersection vertex u that has been placed on q and that belongs to π by construction.Since u is adjacent to both v and w , we get a contradiction to the fact that the last occurrence of u before v is encountered after w in the above traversal.
Proof.Suppose first that G is hole-free.Let W = (V ∪ I, A) be a compact witness of G that is a quadrangulation, which exists by Theorem 2. We start with the following claim.
Proof of the claim.Suppose, for a contradiction, that W contains an intersection vertex u such that deg(u) = 2 and let f be any face of W that contains u on its boundary.Let u be the other intersection vertex on the boundary of f , and observe that N (u) ⊆ N (u ).If N (u) = N (u ), then u and u form a twin-pair.Otherwise u is inessential.Both cases contradict the fact that W is compact.
Since W is crossing-free and bipartite (because W is a witness), it holds Suppose now that G is not hole-free.Let W be any compact witness of G and let W be the graph obtained by removing all degree-2 intersection vertices from W . Since W is crossing-free and bipartite and since its intersection vertices have degree at least 3, we can conclude as above that W has at most 3n V − 4 vertices.We now claim that W has no more than 3n V − 6 degree-2 intersection vertices, which concludes the proof, since these are exactly the vertices in W \ W .To prove the claim, replace each degree-2 intersection vertex of W with an edge connecting its two neighbors.Since W is crossing-free, the resulting graph W * is also crossing-free.Also, each intersection vertex in W * has degree greater than 2. Since W contains no twin-pairs, W * contains no pairs of homotopic parallel edges.Thus, Euler's formula for planar graphs still applies and therefore W * contains at most 3n V − 6 edges.Since each edge of W * corresponds to at most one degree-2 intersection vertex of W , the claim follows.
Based on Lemma 3, we can make the following remark.
Remark 1.Without loss of generality, we assume in the following that any compact witness W of G has n ≤ 3n V − 4 vertices if G is hole-free, or n ≤ 6n V − 10 vertices otherwise.

Embedding Sketches
Let G be an input graph.Property 2 allows us to assume that G is biconnected, and thus every witness of G, if any, is connected.Also, by Lemma 1, it suffices to consider compact witnesses.
Let (X , T ) be a nice tree-decomposition of G of width t = ω − 1, i.e., each bag contains at most ω vertices.Given a bag X ∈ X , we denote by T X the subtree of T rooted at X, and by G X = (V X , E X ) the subgraph of G induced by all the vertices in all bags of T X .Let W is either a real vertex of X or an intersection vertex whose neighbors in W X all belong to X. Observe that if an intersection vertex u has a neighbor v in V X \ X, then no real vertex in V \ V X is adjacent to v, and therefore there is no way to add further edges to u without creating a false adjacency involving v.
We will exploit anchor vertices to reduce the size of W X from O(|V X |) to O(ω), by "sketching" parts of the embedding that are not relevant1 .The idea of sketching an embedded graph is inspired by a previous work about orthogonal planarity [19]; applying such idea to our problem requires the development of several new tools and concepts, described in the remainder of this section (and partly in Section 2).A face f of W X is active either if its boundary contains only one vertex v (which implies W X = ({v}, ∅)) and v is an anchor vertex, or if its boundary contains more vertices among which there are at least two anchor vertices; refer to Figure 5a.The active boundary of f (red in Figure 5a) is obtained by shortcutting all non-anchor vertices of f , where the shortcut operation is defined as follows.For a closed walk π and a vertex v in π, shortcutting v consists of removing each occurrence of v (if more than one), together with the edge (u, v) that precedes it in π, and the edge (v, u ) that follows it in π, and of adding the edge (u, u ) between u and u in π. Figure 6 illustrates a single face f and the corresponding active boundary.The embedding sketch (for short the sketch) of W X with respect to X is the embedded graph S(W X , X) formed by all the vertices and edges that belong to the active boundaries of W X .For each active boundary B f of an active face f of W X , S(W X , X) has an active face f * (light red in Figures 5a and 6).Note that S(W X , X) also has faces that are not active (white in Figures 5a and 6).Also, the position system of W X yields a position system for S(W X , X), since if two closed walks of distinct components of W X were incident to the same active face f , then the two corresponding closed walks of S(W X , X) are also incident to the same active face f * .However, S(W X , X) may not be bipartite any longer (as in Figure 6) and it may contain multiple edges (but no self-loops).It is worth noting that the embedding sketch of W X can be defined with respect to any bag X as long as V X = V X (see Figure 5a).We now further refine S(W X , X) to avoid active boundaries that are not useful for our purposes.Namely, an active boundary is non-extensible if it consists of two homotopic parallel edges.Given a witness W of G, the restriction of W to G X is the compact witness W [G X ] of G X obtained from W by removing all the real vertices not in G X , all the intersection vertices that are isolated (due to the removal of some real vertices) or inessential, as well as a vertex for each twin-pair until the graph contains none of them.The next lemmas allow us to bound the size of a sketch.Lemma 4. If G is a map graph, then it admits a compact witness W with the following property.If S(W [G X ], X) contains h > 1 non-extensible active boundaries that share the same pair of end-vertices, then the vertices of W lie in at most one of these h active boundaries.Proof.Refer to Figure 7. Let Ŵ be a compact witness of G, and suppose S( Ŵ [G X ], X) contains h > 1 non-extensible active boundaries B 1 , B 2 , . . ., B h with common end-vertices v, w.Let H i be the subgraph of W that lies inside B i (if any), for 1 ≤ i ≤ h.Since each B i consists of two parallel edges, v and w separate H i and S(W [G X ], X) \ H i .We obtain a new compact witness W of G by modifying the rotation system of Ŵ so that each H i lies inside B 1 .
Remark 2. By Lemma 4, we assume in the following that for any compact witness W of G such that, for some X ∈ X , the sketch S(W [G X ], X) contains h > 1 non-extensible active boundaries, the vertices of W lie in at most one of such active boundaries.Therefore, in S(W [G X ], X), we keep only one of the corresponding h pairs of homotopic parallel edges.
Lemma 5. A sketch S(W X , X) contains O(ω) vertices and edges.
Proof.With a similar argument as in the proof of Lemma 3 we can show that, in W X , each real vertex in X is adjacent to O(ω) intersection vertices that are anchor vertices.Therefore, S(W X , X) contains O(ω) vertices in total.Concerning the number of edges, since S(W X , X) is embedded on the sphere, it contains O(ω) edges such that each pair of edges is either non-parallel or non-homotopic parallel.In addition, since each of these edges participates in at most one homotopic pair by Remark 2, it follows that S(W X , X) contains O(ω) edges.
We now exploit the concept of sketch to define an equivalence relation among witnesses.
Definition 3. Two compact witnesses W X and W X of G X are X-equivalent if they have the same sketch with respect to X, i.e., S(W X , X) = S(W X , X).
The next lemma deals with the size of the quotient of such a relation.Lemma 6.The X-equivalence relation yields ω O(ω) classes for the compact witnesses of G X .
Proof.Let n 1 be the number of possible (abstract) graphs that can be obtained from the real vertices of X and all possible sets of intersection vertices.For each such graph, let n 2 be the maximum number of possible rotation and position systems that it can have.It follows that the number of X-equivalent classes is upper bounded by the product of n 1 and n 2 .
Given the set X of real vertices and a compact witness W X of G X , any sketch S(W X , X) contains O(ω) intersection vertices, as otherwise W X would contain inessential intersection vertices or twin-pairs.Since each intersection vertex is adjacent to a set of at most ω real vertices, we can bound the number n int of possible sets of intersection vertices by a • ω i=2 ω i < a • 2 ω , where a is the maximum number of intersection vertices in any sketch that have the same set of neighbors.Since a ∈ O(ω), we have that n int ∈ 2 O(ω) .Let I X be one of the n int possible sets of intersection vertices.The number n abs of distinct abstract graphs with vertex set X ∪ I X can be upper bounded by the number of possible neighborhoods of a real vertex combined for all real vertices, that is For a fixed graph S, the number of possible rotation systems n rot is upper bounded by the number of possible permutations of edges around each vertex.Thus we have Each rotation system of S fixes the closed walk of each face of each connected component of S. Since S contains, over all its connected components, at most ω closed walks (at most one for each real vertex in X) and hence at most ω faces, for the number n pos of possible position systems it holds n pos ≤ ω ω .Therefore we have n 2 ≤ n rot • n pos ∈ ω O(ω) , which yields n 1 • n 2 ∈ ω O(ω) , as desired.

Algorithmic Framework
Let G = (V, E) be an input graph, let k be an integer, and let (X , T ) be a nice tree-decomposition of G of width t = ω − 1.We present an algorithmic framework to test whether G is a k-map graph or a hole-free k-map graph.Namely, we traverse T bottom-up and equip each bag X ∈ X with a suitably defined set of sketches, called record R X .The framework can be tailored by imposing different properties for the records.The next three properties are rather general; the first two are useful to prove the correctness of our approach, as shown in Theorem 3, whereas the third property comes into play when dealing with the efficiency of the approach, and in particular in Lemma 7.
Definition 4. The record R X is feasible if the following properties hold: F1 For every compact witness W X of G X , R X contains its sketch S(W X , X).
Proof.By F1-F3, the entries of R X are all and only the possible sketches of W X and are all distinct.Hence, |R X | ∈ ω O(ω) by Lemma 6.Each sketch has size O(ω) by Lemma 5.
We now describe the additional properties that we incorporate in the framework.In order to verify that G admits a k-map we exploit Property 1, which translates into verifying that, for each sketch, the degree of any intersection vertex is at most k.Definition 5. A record R X is k-map feasible if it is feasible and it contains a non-empty subset R * X ⊆ R X , called subrecord, for which the following additional property holds: F4 For every entry r ∈ R X , it holds r ∈ R * X if and only if r contains no intersection vertex u with deg(u) > k.
It is worth observing that, since an intersection vertex of degree k implies the existence of a clique of size k in the input graph G, property F4 is trivially verified when k ≥ ω.On the other hand, the size of the largest clique of a k-map graph is 3k/2 (see, e.g., [11]).
To check whether G has a hole-free k-map, we exploit Theorem 2. Namely, consider a sketch S(W X , X) and an active boundary B f of S(W X , X).Let f be the active face of W X corresponding to B f .Note that any edge e that is part of B f represents a subsequence π e of a closed walk π in the boundary of f .Therefore, to control the number of edges on the boundary of each face of W X , for every edge e that is part of an active boundary of S(W X , X) we also store a counter c(e) ≥ 1 , which represents the number of edges in π e .If there is an edge e such that c(e) > 4, then G does not admit a compact witness W that is a quadrangulation and such that W X = W [G X ]; hence we can avoid storing counters greater than 4.Moreover, for any face f of a compact witness W of G, we know there exist two bags X and X in T such that X is the child of X, X is a forget bag, the active boundary representing f in X has more than one anchor vertex, while the one in X has only one anchor vertex (and hence is not part of S(W X , X)).We call such an active boundary complete in X , as it will not be modified anymore by the algorithm.As such, for each complete active boundary, the sum of the counters of its edges in S(W X , X ) must be exactly 4, otherwise G does not admit a compact witness W that is a biconnected quadrangulation such that W X = W [G X ].Definition 6.A record R X is hole-free feasible if it is feasible and it contains a non-empty subset R • X ⊆ R X , called subrecord, for which the following additional property holds: F5 For every entry r ∈ R X , it holds r ∈ R • X if and only if r contains no intersection vertex u with deg(u) > k and each complete active boundary of r (if any) is such that its edge counters sum up to 4.
Each leaf bag contains only one vertex v, thus its record consists of one sketch with only one active face whose active boundary is v .Such a record can be computed in O(1) time and it is trivially feasible.Also, it is hole-free (and hence k-map) feasible, as its unique active boundary is not complete.The next three operations are performed on a non-leaf bag X of T , based on the type of X, to compute a k-map or hole-free feasible record R X , if any.
Deletion operation.Let X be a forget bag whose child X in T has a k-map (hole-free) feasible record R X .Let v be the vertex forgotten by X.We generate R X from R X as follows.
For a fixed sketch S(W X , X ) of R X , let N I (v) ⊆ N (v) be the set of intersection vertices adjacent to v in S(W X , X ).Since v is forgotten by X, all its neighbors have already been processed, thus no vertex in N I (v) can connect vertices that will be introduced by bags visited after X.Therefore, for every vertex y ∈ N I (v) ∪ {v} and for every sketch S(W X , X ) of R X , we apply a deletion operation, which consists of updating each active boundary B f of S(W X , X ) containing y; see Figure 5b.Namely, let B f be one of these active boundaries, we distinguish two cases based on whether B f contains only y or it contains further vertices.Let π y be the closed walk of B f that contains all occurrences of y (there might be more than one).If B f contains only y, we remove π y (and hence the whole active boundary B f ) from S(W X , X ).If B f contains further vertices, we shortcut every occurrence of y in π y .Also for each edge e introduced to shortcut y such that e replaces edges e 1 and e 2 of π y , we set c(e) = c(e 1 ) + c(e 2 ).Observe that, if y has only one neighbor u in π y , this procedure creates a self-loop at u, which we remove.If this procedure generates more than one pair of homotopic parallel edges with the same pair of end-vertices, then we keep only one such pair.Once all active boundaries have been updated, the resulting embedded graph is stored in R X .After each sketch of R X has been processed, we might have produced the same embedded graph for R X from two distinct sketches of R X ; in this case we keep only one copy.
Addition operation.Let X be an introduce bag whose child X in T has a k-map (hole-free) feasible record R X .Let v be the vertex introduced by X and N X (v) ⊆ N (v) be the set of vertices that are neighbors of v and belong to X.We generate R X from R X with the following addition operation.For each sketch S(W X , X ) of R X , the high-level idea is to exhaustively generate all possible embedded graphs that can be obtained by introducing v in S(W X , X ).We distinguish two cases.Case 1: N X (v) = ∅.For each active boundary B f of S(W X , X ), we generate a new embedded graph by adding the closed walk v to B f .Case 2: N X (v) = ∅.We look for a face f * of S(W X , X ) that contains all the vertices of N X (v) on its active boundary B f (which may consist of multiple closed walks).If such a face does not exist, we discard S(W X , X ).Else, for each such face, we generate a set of entries E f * as follows.Intuitively, we will insert v inside f * and generate one entry of E f * for each possible way in which v can be connected to its neighbors.Namely, we can connect v to its neighbors by means of different check whether the parent of X is a forget bag such that the shortcuttings due to the removal of the forgotten vertex make that active boundary a self-loop.If any complete active boundary does not meet this condition, the corresponding sketch does not belong R • X .As before if R • X = ∅ the algorithm rejects the instance, otherwise R X is hole-free feasible.By Lemma 7, R X contains ω O(ω) entries, each of size O(ω).Updating each of them takes O(ω) time.Also, R X contains at most as many entries as R X .It follows that removing duplicates can be naively done in (ω O(ω) ) 2 ∈ ω O(ω) time.For the sake of efficiency, if we interpret each rotation and position system together as a number with Õ(ω 2 ) bits, then removing duplicates can be done in Õ(ω 2 ) • ω O(ω) ∈ ω O(ω) time by using radix sort (we omit the details as the asymptotic running time would be the same).We have seen that condition F4 is always verified.Checking condition F5 requires scanning each active boundary in R X and decide whether it is complete or not, and if so to verify whether it will become a self-loop when visiting the parent of X.This can be done in O(ω) time for each of the O(ω) active boundaries of each of the ω O(ω) sketches, and thus in ω O(ω) time overall.Thus R X and its subrecords can be computed in ω O(ω) time, as desired.Lemma 9. Let X be an introduce bag whose child X in T has a k-map (resp.hole-free) feasible record R X .The algorithm either rejects the instance or computes a k-map (resp.hole-free) feasible record R X of X in ω O(ω) time.
Proof.Let v be the vertex introduced by X.We prove that the record R X generated by applying the addition operation is feasible, given that R X is feasible.Regarding F1, let W X and W X be a witness of G X and G X , respectively, such that W X [G X ] = W X .Since F1 holds for R X , we know that S(W X , X ) ∈ R X .Observe that the only difference between W X and W X lies in the presence of vertex v and of a (possibly empty) set I v of intersection vertices adjacent to v.
If N X (v) = ∅, then v forms a trivial closed walk that might be added in any face of W X that either consists of exactly one anchor vertex or contains at least two anchor vertices (among possibly other non-anchor vertices).We recall that an active face satisfying the mentioned properties corresponds to an active boundary of the witness' sketch.Also, adding the closed walk to a face that contains more than one vertex, but at most one anchor vertex, on its boundary would imply that the resulting witness cannot be augmented to a witness of G, since G is biconnected.Since Case 1 places v in all possible active boundaries of S(W X , X ), we can conclude that S(W X , X) belongs to R X .
On the other hand, if N X (v) = ∅, then all v's neighbors belong to a common boundary of some face f of W X , as otherwise the rotation system of W X would not be compatible with a topological embedding (in particular, some edges would cross each other).Hence all v's neighbors are part of the same active boundary B f of S(W X , X ).Since Case 2 exhaustively considers all ways in which v can be inserted into B f , avoiding inessential intersection vertices and twin-pairs (which cannot belong to W X since it is compact), we can again conclude that S(W X , X) belongs to R X .Consequently F1 holds for R X .
About F2, it suffices to prove that each entry generated by the addition operation is indeed a sketch of some compact witness of G X with respect to X. Since F2 holds for R X , the addition operation starts from a sketch S(W X , X ) and it generates new entries in which there are neither inessential intersection vertices nor twin-pairs; therefore, such entries are indeed sketches of compact witnesses, as desired.
Concerning F3, if R X contained two entries r 1 , r 2 that are the same (up to a homeomorphism of the sphere), then r 1 and r 2 would have been originated by the same sketch r of R X , as otherwise either r 1 and r 2 would not be the same or F3 would not hold for R X .On the other hand, since the addition operation inserts v in different ways but without repetitions, it cannot generate two entries that are the same starting from a single entry of R X .Thus F3 holds for R X .contains all sketches of R X that are generated from sketches in R • X 1 and R • X 2 and whose complete active boundaries are such that the edge counters sum up to 4. If R • X = ∅, the algorithm rejects the instance, otherwise R X is hole-free feasible.
Concerning the time complexity, we process each pair of sketches, one in R X 1 and one in R X 2 , and since both R X 1 and R X 2 are feasible, we have ω O(ω) such pairs.Each of Steps S.1, S.2, and S.3 generates ω O(ω) new entries, and each entry is computed in O(ω) time.The remaining steps all run in O(ω) time for each processed entry.Condition F4 can be easily verified in O(ω) time, for each of the ω O(ω) sketches of R X .Furthermore, verifying condition F5 requires scanning the active boundaries of each entry in R X and deciding whether it is complete or not.This can also be done in O(ω) time for each of the O(ω) active boundaries of each of the ω O(ω) sketches, and thus in ω O(ω) time overall.Consequently, R X and its subrecords can be computed in ω O(ω) time.
Lemmas 8-10 imply the next theorem, which summarizes the correctness of the approach.
Theorem 3. Let G be a graph in input to the algorithm, along with a nice tree-decomposition (T, X ) of G and an integer k > 0. Graph G is a k-map graph, respectively a hole-free k-map graph, if and only if the algorithm reaches the root ρ of T and the record R ρ is k-map feasible, respectively hole-free feasible.
We are finally ready to prove Theorem 1.We recall that if k ≥ n − 1, recognizing n-vertex (resp.hole-free) k-map graphs coincides with recognizing general n-vertex (resp.hole-free) map graphs.
Proof of Theorem 1.We first discuss the decision version of the problem for a fixed k > 0. Namely, the algorithm described below is used in a binary search to find the optimal value of k.Recall that t is the width of the tree decomposition (i.e., ω = t + 1).Note that, if G is a positive instance, then k varies in the range [1, t + 1], since the size of the largest clique of G is at most t + 1.Thus the algorithm is executed O(log t) times, which however does not affect the asymptotic running time.
If G is not biconnected, by Property 2, it is not hole-free, and it is k-map if and only if all its biconnected components are k-map.Hence we run our algorithm on each biconnected component independently.Theorem 3 implies the correctness of the algorithm (which assumes the input graph to be biconnected).
For the time complexity, suppose that G has h ≥ 1 biconnected components and let n i be the size of the i-th component C i , for each i ≤ h.Decomposing G into its biconnected components takes O(n + m) time [32], where m is the number of edges of G and, since G has treewidth t, it holds m ∈ O(n • t 2 ).Given a tree-decomposition of G with O(n) nodes and width t, we can easily derive a tree-decomposition (T i , X i ) for each C i in overall O(n) time, such that each T i has O(n i ) nodes and width at most t.Then we can apply the algorithm in [5] to obtain, in O(n i )-time, a nice tree-decomposition of C i with O(n i ) nodes without increasing the original width.Since each bag is processed in t O(t) time by Lemmas 8-10, the algorithm runs in t O(t) • n i time for each C i .Since h i=1 n i ∈ O(n), decomposing the graph and applying the algorithm to all its biconnected components takes t O(t) • n time.
To reconstruct a witness of a yes-instance, we store additional pointers for each record (a common practice in dynamic programming).Namely, for each sketch S of a record R X of a bag X, we store a pointer to the sketch of the child bag X that generated S, if X is an introduce or forget bag, and we store two pointers to the two sketches of the children bags X 1 and X 2 that generated S, if X is a join bag.With these pointers at hand, we can apply a top-down traversal of T , starting at any sketch of the non-empty subrecord of ρ, and reconstruct the corresponding witness W by incrementally combining the retrieved sketches, except at forget bags (the only points in which we lose information).Suppose first that G is a k-map graph but not hole-free.If G is not biconnected, a witness W * of G is obtained by merging the witnesses of its biconnected components.Note that distinct witnesses corresponding to distinct biconnected components of G can only share real vertices.Thus, each intersection vertex of W * has degree at most k and W * is a certificate by Property 1. Suppose now that G is a hole-free k-map graph.Then G is biconnected and the resulting witness is a biconnected quadrangulation whose intersection vertices have degree at most k, a certificate by Theorem 2.
(a) A graph G. (b) A map M of G.(c) A witness W of G.

Figure 1 :
Figure 1: (a) A graph G, (b) a map of G -the striped region is a hole, and (c) a witness of G.

Figure 3 :
Figure 3: Illustration for the proof of Theorem 2.

Figure 4 :
Figure 4: Illustrations for the proof of Theorem 2.

Figure 5 :
Figure5: (a) A sketch S(W, X ) computed from the witness W of Figure1with respect to a bag X (V X = V ).The anchor vertices of X are opaque, while the non-anchor vertices are faded.The active boundaries are red and the background of the active faces is light red.(b) A sketch S(W, X), where X ∪ {v} = X computed from S(W, X ) by applying the deletion operation (Section 5).

Figure 7 :
Figure 7: Illustrations for the proof of Lemma 4. Modifying the rotation system of Ŵ such that each H i lies in B 1 and all other non-extensible active boundaries become empty.