Mapping Simple Polygons: The Power of Telling Convex from Reflex

We consider the exploration of a simple polygon P by a robot that moves from vertex to vertex along edges of the visibility graph of P. The visibility graph has a vertex for every vertex of P and an edge between two vertices if they see each other—that is, if the line segment connecting them lies inside P entirely. While located at a vertex, the robot is capable of ordering the vertices it sees in counterclockwise order as they appear on the boundary, and for every two such vertices, it can distinguish whether the angle between them is convex (⩽ π) or reflex ( > π). Other than that, distant vertices are indistinguishable to the robot. We assume that an upper bound on the number of vertices is known.
 We obtain the general result that a robot exploring any locally oriented, arc-labeled graph G can always determine the base graph of G. Roughly speaking, this is the smallest graph that cannot be distinguished by a robot from G by its observations alone, no matter how it moves. Combining this result with various other techniques allows the ability to show that a robot exploring a polygon P with the preceding capabilities is always capable of reconstructing the visibility graph of P. We also show that multiple identical, indistinguishable, and deterministic robots of this kind can always solve the weak rendezvous problem in which they need to position themselves such that they mutually see each other—for instance, such that they form a clique in the visibility graph.


INTRODUCTION
Autonomous mobile robots are used for various tasks like cleaning, guarding, data retrieval, etc. in unknown environments. Many tasks require coordination of the robots [Agmon and Peleg 2007;Lin et al. 2007a;2007b; and exploration of the environment [Das et al. 2007;Katsev et al. 2011;Panaite and Pelc 1999;]. We mainly focus on the latter problem, more precisely on the problem of mapping unknown  ] cvv, look-back -free no [Brunner et al. 2008] look-backn free yes poly [Chalopin et al. 2011] angle types, look-back -free yes poly [Bilò et al. 2012] angle types, directions -free yes poly [Bilò et al. 2012] directionsn free yes exp [Disser, Ghosh et al. 2013 polygons. However, we also show how a map of the environment can facilitate coordination and allow robots to solve the weak rendezvous problem. The difficulty of the mapping problem depends on the characteristics of the environment itself and on the sophistication of the robots, i.e., on their sensory and locomotive capabilities. A natural question is how much sophistication a robot needs to be able to solve the problem. The ultimate goal is to characterize the difficulty of the mapping problem by finding minimal robot configurations that allow a robot to create a map. We consider robots operating in environments in the shape of simple polygons. For many tasks, instead of inferring a detailed map of the geometry of the environment, it is enough to obtain the visibility graph. The visibility graph has a node for each vertex of the polygon and an edge connecting two nodes if the corresponding vertices see each other, i.e., if the straight-line segment between them is contained in the polygon. The goal in this context becomes to find minimal robot models that allow a robot inside a polygonal environment to reconstruct the visibility graph of the environment. The information the robot can gather must be sufficient to uniquely infer the visibility graph.
A variety of minimalistic robot models have been studied, focusing on different types of environments and objectives [Ando et al. 1999;Brunner et al. 2008;Cohen and Peleg 2008;Ganguli et al. 2006;Katsev et al. 2011]. The model considered here originates from . Roughly speaking, our robot is allowed to move along edges of the visibility graph. While at a vertex, the robot sees the vertices visible from its current location in counter-clockwise (ccw) order starting with its ccw neighbor along the boundary. Apart from this ordering the vertices are indistinguishable to the robot. In each move the robot may select one of them and move to it. The robot has no way of looking back, i.e., it has no immediate way of knowing which vertex it came from among the vertices it sees now. In this paper, the robot is assumed to be aware of an upper boundn on the number of vertices n. Table 1 summarizes known results that are based on the robot model we use in this paper, as well as open problems. Besides employing different sensors, the results differ in the robot's initial knowledge about n, its movement capabilities, and, in case of positive results, the running times of the reconstruction algorithms. The first part of the table concerns robots that are restricted to moving along the boundary only. It was shown that even with this severe movement restriction robots can still reconstruct the visibility graph, as long as they can measure the exact angle between any pair of visible vertices . On the other hand, only measuring the angle between the two neighboring vertices along the boundary is not sufficient, even if the robot can distinguish whether any two visible vertices are neighbors along the boundary ("cvv" in the table) [Bilò et al. 2012].
For robots that move across the polygon (as opposed to along the boundary), it is sufficient to be able to mark a single vertex (e.g., with a pebble) in order to reconstruct the visibility graph . Without this powerful ability, not being capable to look back makes it difficult for the robot to relate the information it collected so far to subsequent observations. But even with a look-back sensor that allows to identify the vertex the robot came from in its last move, some knowledge of n is required to solve the reconstruction problem [Brunner et al. 2008;Chalopin et al. 2011]. A direction sensor that measures the angle between the boundary and a global reference direction makes it possible to reconstruct the visibility graph, even in the presence of holes [Disser, Ghosh et al. 2013]. In this paper, we equip the robot with an angle-type sensor that distinguishes convex (≤ π) from reflex (> π) angles. It was shown before that, even without knowledge of n, this sensor is powerful enough to allow visibility graph reconstruction, as long as it is combined with a look-back sensor or a direction sensor [Bilò et al. 2012]. In this paper, we show that these extra sensors are not required, provided that the robot knows at least a bound on the number of vertices.
It remains an open problem whether the angle-type sensor is sufficient even when the robot is restricted to moving along the boundary. Other interesting open problems are whether knowledge of n on its own is already enough to reconstruct the visibility graph, and how a distance sensor may be used for reconstruction.
In contrast to most previous results our algorithm requires exponential time. This is due to the difficulty of collecting all of the data available via the agent's sensors. In settings where movement is restricted to be along the boundary, collecting the data essentially requires to visit each vertex once, which allows the corresponding reconstruction algorithms to be very efficient. Similarly, the agent can systematically collect all data if it has a way to retrace movements (e.g. via look-back sensor). In our setting, it is much more difficult to relate observations made at different vertices, which essentially forces us to try all possible ways of stitching together the collected data. The crucial point is that we can at all determine the correct relation between the observations, even if this requires exponential time.
In the robot model we use, robots move along edges of the visibility graph and can locally access some information about the edges. We can model this in the context of general robotic exploration of edge-labeled graphs, where the edge-labeling is usually restricted to be locally bijective at every vertex (i.e., no two edges incident to the same vertex have the same label). In this more general context, robots are aware of the degree of the vertex they are located at as well as of the labels of the edges incident to it. In every step, a robot selects an edge and moves to its other end. It is known that two distinct edge-labeled graphs (of the same size) can appear mutually indistinguishable to a robot, i.e., the reconstruction problem is not always solvable [Angluin 1980;Boldi and Vigna 2002]. The rendezvous problem is generally not solvable either [Chalopin et al. 2006;Yamashita and Kameda 1996]. In this paper we show that while a robot cannot solve the reconstruction problem in general graphs, it can always infer the minimum base graph of a (directed) graph G -the smallest graph among all graphs indistinguishable from G by a robot (a thorough discussion of base graphs and their properties can be found in [Boldi and Vigna 2002]). This result is of independent interest. We will see later that polygon exploration can be transformed to the exploration of a particular class of directed, arc-labeled graphs, where both the reconstruction problem as well as the weak-rendezvous problem become solvable.
As it is impossible to reconstruct general graphs, it is natural to ask how much information a robot can obtain about a graph. This information is encoded in the unique minimum base graph. In general, the mapping from a graph to its minimum base graph is not one-to-one in the sense that there are graphs which share the same minimum base graph. Our question whether a robot with certain capabilities can reconstruct the visibility graph of a polygon can be translated to whether the mapping is one-to-one for the class of visibility graphs with an appropriate labeling. As the main technical contribution of this paper we show that if the labeling locally encodes the convexity information about every angle at a vertex, this mapping becomes one-to-one. In other words, visibility graphs can always be reconstructed from their minimum base graph if the type of every angle (convex or reflex) is known. Combined with the result that a robot can reconstruct the minimum base graph even in general graphs when an upper bound on the number of vertices is given, this solves the reconstruction problem for visibility graphs in this setting.

THE VISIBILITY GRAPH RECONSTRUCTION PROBLEM
We consider the exploration of a (simple) polygon P by a robot that moves from vertex to vertex along straight lines in P. Two vertices u, v that can be connected with a straight line inside P (possibly touching its boundary 1 ) are said to see each other. We define the visibility graph G vis = (V, E) of P to be a directed graph, where V is the set of vertices of P and there is an arc from u to v (and vice versa) if u and v see each other. Whenever convenient, we identify G vis with its canonical straight-line embedding in the polygon. For example, we speak of angles between arcs of G vis , when we mean the angles between the corresponding line segments of its straight-line embedding.
Depending on the additional capabilities we equip a robot with, the robot might or might not be able to perform certain tasks. We focus on the visibility graph reconstruction problem in which the robot has to uniquely infer G vis . Here and throughout this paper we consider isomorphic graphs to be the "same" graph, as we cannot hope to distinguish graphs further. We also consider the weak-rendezvous problem in which multiple identical and deterministic robots need to position themselves on vertices of the polygon that mutually see each other.
Before defining a specific robot model, we introduce some formalism for G vis (cf. Figure 1). We fix a vertex v 0 and denote the vertices of P in ccw order along the boundary by v 0 , v 1 , . . . , v n−1 . Note that v 0 , v 1 , . . . , v n−1 , v 0 is a Hamiltonian cycle in G vis . By chain(v l , v r ) we denote the sequence (v l , v l+1 , . . . , v r ) and by chain v (v l , v r ) we denote the subsequence of chain(v l , v r ) containing only the vertices visible to v. Here and throughout this paper all indices are understood modulo n. For v i ∈ V let (u 1 , . . . , u di ) := chain vi (v i+1 , v i−1 ) be the vertices visible to v i other than v i . We say that d i is the degree of v i and define vis vi (x) := vis vi (− (d i + 1 − x)) := u x , to be the x-th vertex visible to v i in ccw order or equivalently the (d i + 1 − x)-th vertex visible to v i in clockwise (cw) order for 1 ≤ to denote the ccw angle between the arcs (v i , u x ) and (v i , u y ) in that order. Furthermore, we define the angle type T vi (·, ·) as follows: The exploration of G vis can be reduced to the general problem of exploring a strongly connected, directed and arc-labeled (multi-) graph 2 G (from now on we use the word "graph" to refer to such graphs). We write λ(e) to denote the label of an arc e. A robot exploring a graph is assumed to be aware of the labels of all the outgoing arcs at its location. In every move, the robot may choose one of those arcs and follow it to its target. A directed walk is a sequence of arcs (e 1 , e 2 , . . .) such that the target of e 1 is the source of e 2 and so on. A directed path is a directed walk which does not visit any vertex more than once. Every walk p = (e 1 , e 2 , . . .) in the graph uniquely induces a label-sequence λ(p) = (λ(e 1 ) , λ(e 2 ) , . . .). Conversely, any label-sequence Λ induces a set of walks Λ(G) such that λ(p) = Λ for all p ∈ Λ(G). By Λ(v) we denote the set of walks in Λ(G) that start at v. If no two outgoing arcs We have visv 0 (5) = visv 0 (−3) = v 7 and conversely Ov 0 (v 7 ) = 5 or − 3 because v 7 is the fifth vertex that v 0 sees in ccw order and the third in cw order. Finally, we have Tv 0 (2, 5) = 0 and Tv 0 (6, 2) = 1, since v 2 and v 7 form a convex angle at v 0 while v 2 and v 8 form a reflex angle.
of the same vertex share a label, we say the graph has a local orientation or is locally oriented. Then, for every label-sequence Λ and vertex v we have Λ(v) = ∅ or |Λ(v)| = 1; in the latter case we write Λ(v) to denote this unique walk. With "•" we denote the concatenation of label-sequences.
We can now introduce the robot model used in this paper in detail. As described above, a robot is allowed to move along arcs of the visibility graph. In addition, while situated at a vertex v of degree d, the robot can order all outgoing arcs in ccw order starting with the arc to its ccw neighbor along the boundary, and it is aware of We assume the robot to know an upper boundn ≥ n on the total number of vertices n. From now on, when we talk about a robot in a polygon, we refer to this robot model. The exploration of P by a robot is in fact equivalent to the exploration of an arc-labeled version of G vis that encodes the information available to the robot in its labeling. In this setting, upon entering a node u, the robot learns all the labels of arcs leaving u. The labeling needs to encode the local orientation and the angle type information into the labeling of the outgoing arcs at the corresponding vertex in G vis . We introduce a labeling in which each label is a sequence of integers. Let v be a vertex of the visibility graph with degree d and (v, u) be an outgoing arc of v. We label (v, u) with the label (x 0 , x 1 , . . . , x d ), where Note that by the definition of O v our labeling is a local orientation. Further note that the arcs (v, u) and (u, v) may be labeled differently. It is immediate to check that a robot exploring the labeled graph G vis encounters the exact same information as a robot inside the polygon if both start at the same vertex. It is thus sufficient to show that the labeled version of G vis can be reconstructed in the framework of exploring general graphs in order to show that a robot can indeed solve the visibility graph reconstruction problem. From now on we write G vis to denote the arc-labeled visibility graph.

OVERVIEW OF THE ALGORITHM
The visibility graph reconstruction algorithm that we design in this paper combines several old and new graph-theoretical and geometrical properties of visibility graphs as well as techniques developed in earlier studies. Rather than formally introducing all relevant concepts right away, this section aims to give an intuitive overview of the algorithm. We informally describe the underlying techniques and defer their formal discussion to later sections. Note that we are primarily interested in showing that a robot is at all capable of uniquely reconstructing the visibility graph of any simple polygon. The algorithm we provide as a proof does not need to be particularly efficient as long as it is guaranteed to terminate in finite time. An algorithm that solves the weak-rendezvous problem is obtained as a byproduct. In Section 2 we argued that the exploration of P by a robot is equivalent to the exploration of G vis in the context of general graph exploration. In general and without any prior knowledge of the graph, there can be infinitely many graphs that are compatible with the observations of the robot no matter how far it moves, i.e., all these graphs are indistinguishable to the robot (consider for example the family of all cycles). However, it is known [Boldi and Vigna 2002] that for every graph G, there is always a unique graph G that is indistinguishable from G and has minimum size (for a bidirected cycle, G is a graph with one node and two (directed) self-loops). We say G is the minimum base graph of G. Using the fact that G vis is locally oriented and that an upper boundn on n is known a priori, we are able to show the following result.
The main ingredient for this theorem is the observation that given two candidate graphs for G vis , the robot can eliminate one of them in finite time by following an appropriate sequence of arc labels. It is then sufficient to iterate over pairs of graphs with size at most n, discarding one of the two in every step. Once the robot has determined G vis , it has extracted all the information it can possibly gather by moving around. Subsequent steps of the algorithm can thus operate on G vis directly without further need of moving at all in G vis .
We associate each vertex of G vis with a vertex of G vis such that each vertex of G vis represents a class of vertices of G vis . For two vertices u, v of G vis in the same class we have Λ(u) = ∅ ⇔ Λ(v) = ∅ for all label-sequences Λ. Furthermore, the classes with which the vertices of G vis are associated repeat periodically along the boundary of the polygon and in particular all classes have the same size. We define a unique order between the classes and use a procedure similar to the one in [Chalopin et al. 2011] to show that at least one of them forms a clique in G vis . The idea is to repeatedly "cut off" ears of the polygon, i.e., vertices whose neighbors on the boundary see each other. Cutting off such an ear yields a subpolygon of P and we can repeat the process on the subpolygon. However, the robot cannot operate on G vis directly as it only has access to G vis . The following lemma allows the robot to cut off an entire class of vertices at a time, an operation that can be performed in G vis simply by deleting the corresponding vertex (and adjusting the arc labels of its neighboring vertices).
Lemma 3.2. Let v be an ear of P. Every vertex in the same class as v is an ear of P.
As every polygon has at least one ear, the robot can thus "cut off" an entire class of P in order to obtain a new and smaller polygon P (cf. Figure 2). By removing the corresponding vertex of G vis and updating the arc labels, it obtains a graph G vis that is indistinguishable from the visibility graph of P . If this process is repeated, by always selecting for removal the smallest class with respect to a unique order relation, eventually a situation is reached in which only one (uniquely defined) class C remains. As the corresponding subpolygon must again have at least one ear, by the above lemma the entire class C consists of ears and the corresponding subpolygon thus is convex. A convex subpolygon is a clique in the original visibility graph and we may conclude the following crucial theorem.
Theorem 3.3. There exists a uniquely defined class C in G vis whose vertices form a clique.
The above yields an algorithm for multiple robots to weakly meet: As C is unique, every robot can determine C and then simply position itself on a vertex of C . We get Theorem 3.4. Any number of robots in P can solve the weak-rendezvous problem.
Starting from the clique C , we show that by sequentially "gluing" ears back to the polygon, a robot can extend the initial clique and reconstruct the entire visibility graph step by step. Every step relies on a recursive counting method that was introduced in [Bilò et al. 2012]. In order to know how to glue ears back on, the robot explicitly needs to construct C by repeatedly cutting off ears and remembering in which order the classes are cut off in the process.
Theorem 3.5. A robot in P can solve the visibility graph reconstruction problem.

FINDING THE MINIMUM BASE GRAPH
This section focuses on the problem of exploring a general, finite, strongly connected, locally oriented directed (multi-) graph G = (V, E) with a robot. Again, we assume an upper bound n on the number of vertices n to be known and we do not impose a limitation on the memory of the robot. We prove a generalization of Theorem 3.1 to general, locally oriented, directed graphs (cf. Theorem 4.2).
Before we define the notion of the minimum base graph G of G we need to introduce a few graph-theoretical concepts. First, given an arc e from vertex u to vertex v, we denote by s(e) the source of arc e, i.e., the vertex u, and by t(e) the target of arc e, i.e., the vertex v. Note that in the following we allow graphs to have parallel arcs between a pair of vertices. A morphism µ : G → G from G to a graph G is a mapping from G to G that maps vertices to vertices and arcs to arcs and maintains adjacencies and arc labels. More formally, if e is an arc in G from u to v then s(µ(e)) = µ(u), t(µ(e)) = µ(v), and λ(e) = λ(µ(e)). An opfibration ϕ : G →Ḡ withḠ = V ,Ē is a morphism such that for every arcē ∈Ē with u = s(ē) and for every vertex u ∈ ϕ −1 (ū) in the preimage ofū there is a unique arc e with source s(e) = u such that ϕ(e) =ē. We say thatḠ is a base graph of G and G is a total graph ofḠ. Trivially, G is both its own base graph and total graph. If G has no base graph smaller than itself, we say G is opfibration prime. An out-tree is a graph that has a root vertex r such that there is exactly one directed walk from r to every other node.
We give the following properties without proof. For a detailed discussion and proofs, refer to [Boldi and Vigna 2002].
Property 2. There is exactly one opfibration prime base graph of G. We call it the minimum base graph of G and denote it by G .
Property 3. For every v ∈ V , there is a unique (but not necessarily finite) total graph H v of G that is an out-tree with root in ϕ −1 (v), where ϕ is the opfibration mapping H v to G. We call H v the universal total graph of G at v.
Property 4. A graph is opfibration prime iff all its universal total graphs are distinct.
Property 5. Two different opfibration prime graphs have different sets of universal total graphs.
We can now show that if we have a local orientation, there is a label-sequence of finite length that can be used to distinguish two rooted, opfibration prime graphs.
Proof. First, consider the case that G v and G v are the same graph, rooted at different vertices, i.e., G = G . By Proposition 4, the universal total graphs H v and H v are distinct. Let r, r be the roots of H v , H v , respectively. Because H v and H v are distinct and locally oriented, there is a finite label-sequence Λ diff with Λ diff (r) = ∅ and Λ diff (r ) = ∅ or vice versa. By Property 1, this implies Λ diff (v) = ∅ and Λ diff (v ) = ∅ or vice versa. Now assume that G = G . By Proposition 5, and without loss of generality, we may assume that there is a vertex u ∈ V , such that the universal total graph H u of G at u is not a universal total graph of G . Let Λ 1 be the label-sequence associated with the path from v to u in G. This path exists since G is strongly connected. If Λ 1 (v ) = ∅, we have found the desired label-sequence. Otherwise, let u be the vertex at which the path Λ 1 (v ) ends. By our choice of u, we have H u = H u . By the same argument as above, there is a label-sequence Λ 2 with Λ 2 (u) = ∅ and Λ 2 (u ) = ∅ or vice versa. But then, the concatenated label-sequence Λ 1 • Λ 2 has the desired property.
The following theorem holds for directed graphs, i.e., for robots that cannot backtrack their moves. Similar results are known for undirected graphs where robots can identify the edge along which they reached their current location [Chalopin et al. 2011;Dereniowski and Pelc 2012;Yamashita and Kameda 1996].
Theorem 4.2. A robot exploring any finite, directed, strongly connected, locally oriented multi-graph G can determine G if it knows an upper boundn on the number of vertices of G.
Proof. In the following, we describe a strategy for finding G under the assumption that the maximum degree ∆ of G is known, as well as the set L of all arc labels occurring in G. Otherwise, we start with initial guesses of ∆ and L according to the observations of the agent at its starting location. Whenever the agent makes an observation that is inconsistent with its belief of ∆ and L, the agent updates its belief and restarts the whole procedure. As both ∆ and L are finite, the number of times the agent needs to restart is finite. Now, let v start denote the vertex of G at which the robot is initially located, and let v start denote the corresponding vertex of G . By Property 2, G is unique. We will give an algorithm that maintains a finite set C of rooted graphs. This set is always guaranteed to contain G rooted at v start , provided that the belief of ∆ and L is correct. We begin by setting C to contain all opfibration prime graphs of size at mostn and maximum degree ∆, with arc-labelings from L and all possible roots.
While |C| > 1, we let G 1 v1 , G 2 v2 be two rooted graphs in C and describe how to conclude that either G 1 v1 or G 2 v2 can safely be eliminated from C. Once |C| = 1, the only graph left will have to be G . Observe that while the robot has not visited all nodes of G, more than one consistent base graph remains in C (for different outgoing arcs at the unvisited node, different labels and multiplicities). Once |C| = 1, the agent must thus have visited all nodes of G and hence have a correct belief of ∆ and L. In the following, let p hist denote the walk in G the robot has travelled along so far during the execution of the algorithm, and let Λ hist = λ(p hist ) be the associated label-sequence. Note that the robot is aware of Λ hist but not of p hist , since it does not know the graph G, nor v start . For a rooted graph G v , we use v hyp (v) to denote the last vertex on the walk Λ hist (v) in G , i.e., the vertex the robot would currently be located at if it had started the algorithm at vertex v in graph G .
Given two rooted, opfibration prime graphs G 1 v1 , G 2 v2 , we argue how to conclude that one of them cannot be G rooted at v start . First, we can check whether Λ hist (v 1 ) = ∅ or Λ hist (v 2 ) = ∅; if one of the two is the case, we can discard the corresponding rooted graph since it is not compatible with the observations the robot has made so far. Otherwise, we consider G 1 rooted at v hyp (v 1 ) and G 2 rooted at v hyp (v 2 ). By Lemma 4.1, there is a labelsequence Λ diff of finite length, for which Λ diff (v hyp (v 1 )) = ∅ and Λ diff (v hyp (v 2 )) = ∅ or vice versa. The robot tries to move along a path corresponding to Λ diff . If that turns out not to be possible because at some point no outgoing edge has the required label, it can discard otherwise. If it successfully reached the end of Λ diff , the robot can eliminate G 1 v1 from C if Λ diff (v 1 ) = ∅, and G 2 v2 otherwise. We obtain Theorem 3.1 immediately by applying Theorem 4.2 to G vis . Note that the results of this section are not restricted to visibility graphs.

IDENTIFYING THE CLIQUE C
In this section we study structural properties of G vis = (V , E ) which we later use to show Theorem 3.3.
Let ϕ : G vis → G vis be the opfibration from G vis to G vis . As G vis is the minimum base of G vis , ϕ is unique. Every vertex v of G vis corresponds to a set of vertices of G vis . We write From the definition of opfibrations and the minimality of the base graph it follows that every two vertices u, v of the same class C u have the same degree d and that due to local orientation we have C visu(i) = C visv(i) for all 1 ≤ i ≤ d. We may thus write C u (i) := C visu(i) . Finally, we define B := C v0 , C v1 , . . . , C vn−1 to be the sequence in which the classes appear along the boundary.
As G vis is opfibration prime, by Property 4 every vertex has its unique universal total graph. We use this and define a natural order O on the vertices of G vis and thus on the classes of G vis .
Lemma 5.1. The sequence B is periodical with period |V | and thus all classes have the same size.
Proof. The boundary can be traced by following the first edge at every vertex, i.e., the unique edge who's label starts with '1'. It follows that the image of the boundary under ϕ consists of n/|V | copies of a Hamiltonian cycle of G vis . Hence, B is periodical with period |V | and all classes have the size n/|V |.
We show that if a vertex from some class is an ear, then every vertex of the class is an ear. Recall that an ear of G vis is a vertex v i ∈ V for which v i−1 and v i+1 see each other.
Lemma 5.2. Let |V | > 2 and v x , v y ∈ V such that C vx (2) = C vy and C vy (−2) = C vx . Then, C vx+2 = C vy and every vertex in C vx+1 is an ear.
Proof. We first prove that for all v i ∈ V and u = vis vi (2), we have that if v i = vis u (−2), then u = vis vi (2) = v i+2 and thus v i+1 is an ear. For the sake of contradiction assume for some v i ∈ V and u = vis vi (2) we have vis u (−2) = v i but vis vi (2) = v i+2 . Consider the subpolygon induced by chain(v i , vis vi (2)). This subpolygon has size at least Fig. 3. Visualization of the "zig-zag" sequence Z. As Z does not self-intersect, there is a point l 0 from which on Z's entries do not change anymore. There are two cases how this point is reached: either s l 0 −1 is distinct from s l 0 (left) or they are the same (right).
four as vis vi (2) / ∈ {v i+1 , v i+2 }. In the visibility graph of the subpolygon, v i and vis vi (2) are neighbors on the boundary and both have degree two, which is a contradiction to the fact that every polygon must admit a triangulation. Therefore vis vi (2) = v i+2 and v i+1 is an ear as its neighbors on the boundary see each other.
Because of the above observation, it is sufficient to show that for every v ∈ C vx we have vis u (−2) = v, where u := vis v (2). For the sake of contradiction assume in the following that there is a vertex s 0 ∈ C vx with t 1 := vis s0 (2) and vis t1 (−2) = s 0 .
We define an infinite sequence Z = (s 0 , t 1 , s 1 , t 2 , . . .) where t l := vis s l−1 (2) and s l := vis t l (−2) for all l > 0. Obviously s l ∈ C vx , t l+1 ∈ C vy for all l ≥ 0. Intuitively, Z is the zig-zag line obtained by alternately traveling along the first and the last non-boundary arc in ccw order, starting at s 0 (cf. Figure 3). It is immediate to see that for any fixed index l > 0 we have s l , t l ∈ chain(s l , t l ) for all l ≥ l . Hence the part of the boundary in which these vertices lie becomes smaller and smaller and from some index l 0 > 0 on we have s l = s l0 and t l = t l0 for all l ≥ l 0 (we set l 0 to be the smallest such index). Let 0 ≤ i, j < n be such that v i = s l0 , v j = t l0 . We then have vis vi (2) = v j and vis vj (−2) = v i . Thus, by the above observation, v i+1 is an ear and v j = v i+2 . As v i ∈ C vx and v j ∈ C vy , this implies C vx+2 = C vy . It remains to show that every vertex in C vx+1 is an ear.
We have to consider two cases. Either s l0−1 is distinct from s l0 or it is the same vertex (cf. Figure 3). We assume s l0−1 = s l0 and omit the discussion of the second case which is essentially analogous (the same arguments hold for the other case if we switch the roles of s and t and reverse the boundary order). Let 0 ≤ k < n such that v k = s l0−1 . As vis v k (2) = v i+2 , we have that v k does not see any vertex in chain(v k+2 , v i+1 ) (note that this chain is not empty as v k = v i ) and thus as v k+1 ∈ C vx+1 is in the same class as (the ear) v i+1 , the interior angle of the polygon at v k+1 is strictly smaller than π. Since all vertices in chain(v i+3 , v k ) ∪ chain(v k+2 , v i+1 ) lie on the same side of the line through v k and v i+2 and are separated by v i+2 (cf. Figure 4), no vertex in chain(v i+3 , v k ) can see any vertex in chain(v k+2 , v i+1 ). Let X ⊂ C vx be the set of vertices of C vx in chain(v i+3 , v k ) and let Y ⊂ C vy be the set of vertices of C vy in chain(v i+3 , v k ). As |V | > 2, C vx , C vx+1 , and C vx+2 = C vy are all different and thus X and Y are disjoint. Note that because B is periodical with period |V | (Lemma 5.1) we have |X| = |Y | + 1.
We define the (undirected) bipartite graph B xy = (C vx ∪ C vy , E xy ) with the edge-set E xy = {{u, v} ∈ C vx × C vy | (u, v) ∈ E}. In B xy all vertices need to have the same degree d as |C vx | = C vy and all vertices in either class have the same degree. We have |X| = |Y |+1, we have that vertices in X can only have edges to vertices in Y ∪ {v i+2 } and that vertices in Y can only have edges to vertices in X. For all vertices to have the same degree, v i+2 cannot have any edges leading to C vx \X. This is a contradiction to the fact that v i+2 sees v i which is not in chain(v i+3 , v k ) and thus not in X. We can now consider arbitrary values of |V | and prove Lemma 3.2. We will need the following property of the shortest curve between two vertices of P.
Theorem 5.3 ([ Lee and Preparata 1984]). Let s, t ∈ V . There is a unique shortest curve p from s to t that lies in P. This curve is a chain of straight-line segments connected at reflex vertices of P, and the two line segments at any vertex of p form a reflex angle. We say p is the (euclidean) shortest path in P between s and t.
Proof of Lemma 3.2. In the following we let v i ∈ V be an ear and show that all vertices in C vi are ears.
First consider the case |V | > 2. As (v i−1 , v i+1 ) ∈ E, we have vis vi−1 (2) = v i+1 and vis vi+1 (−2) = v i−1 , and thus C vi−1 (2) = C vi+1 and C vi+1 (−2) = C vi−1 . By Lemma 5.2 all vertices in C vi are ears. Now consider the case |V | = 1. In that case, since v i is convex, so are all vertices in C vi , as convexity is encoded in the arc-labeling. As |V | = 1, this means that the polygon is convex and thus all vertices are ears.
It remains to consider the case |V | = 2. Let C vj = C vi be the second class in G vis . Again, v i is convex and thus all vertices in C vi are. For the sake of contradiction assume that there is a vertex v x ∈ C vi which is not an ear. Then v x−1 and v x+1 do not see each other, and by Lemma 5.1, v x−1 , v x+1 ∈ C vj . Let p be the shortest path in P between v x−1 and v x+1 . By Theorem 5.3, all vertices on p are reflex. This means that all vertices on p must be from C vj and thus all vertices of C vj must be reflex. Moreover, every vertex u in C vj has two neighbors u , u in C vj such that the angle between (u, u ) and (u, u ) is reflex. If we cut off v i from P, we do not affect this property (every vertex u in C vj still has two neighbors from C vj forming a reflex angle) and we thus obtain a new polygon in which all vertices in C vj are still reflex (i.e., cutting off an ear cannot make a vertex of C vj convex). We can continue to obtain smaller and smaller subpolygons by selecting ears and cutting them off, maintaining the property that all vertices in C vj are reflex. Thus, in this process, we never cut off a vertex of C vj . This is a contradiction, as every polygon has at least one ear and thus the above process has to cut off all vertices eventually.
Proof of Theorem 3.3. Lemma 3.2 allows us to employ the following procedure repeatedly until only one class C remains: In step i = 1, . . . , |V | − 1, select the class C (i) which is smallest w.r.t. the order O among all classes of ears. We remove C (i) from the polygon by deleting the corresponding vertex from G vis and updating the arc labels of its neighborhood accordingly. Removing class C (i) in that way produces a (not necessarily minimum) base graph G i of the visibility graph G (i) vis of the subpolygon P (i) obtained by cutting off all ears in C (i) . Since the minimum base graph of G (i) vis is also a (minimum) base graph of G i , all vertices of G vis corresponding to a single vertex of G i (i.e., to a class of G vis ) fall into the same class of G (i) vis . As P (i) has again at least one ear, Lemma 3.2 guarantees the existence of a class of G (i) vis that contains only ears. Each of the remaining classes of G vis contains vertices from a single class of G (i) vis , thus one of them contains only ears of P (i) . This allows us to repeat our procedure.
If we repeat the procedure |V |−1 times, we are finally left with a single class C (|V |) = C and the sequence (C (1) , C (2) , . . . , C (|V |−1) ), which is fixed by our order relation O. As C again corresponds to a subpolygon and thus must contain at least one ear, every vertex in C must be an ear. Therefore the corresponding subpolygon is convex and C forms a clique in G vis .
The existence of a clique gives us a way of computing n fromn using G vis . By Lemma 5.1 we have n = |V | · |C|, where C is any class of G vis . If we inspect the number of self-loops of every vertex of G vis , we are sure to encounter at least one vertex with |C| − 1 self-loops, which corresponds to a clique in the visibility graph, and thus |C| is equal to the maximum number of self-loops of any vertex plus one.
By Theorem 3.1, a robot can determine G vis in finite time. Furthermore it can identify which of the classes consist of ears: If |V | ≤ 2, a class of convex vertices only contains ears, and for |V | > 2 the robot can use Lemma 5.2. The robot can hence execute the above procedure explicitly and we obtain Theorem 5.4. A robot in P can determine the lexicographically smallest sequence C = (C (1) , C (2) , . . . , C (|V |) ), such that for every 1 ≤ i ≤ |V |, all vertices in C (i) are ears in the subpolygon obtained by removing the vertices in i−1 j=1 C (j) from P.

RECONSTRUCTING GVIS
In the following, we assume that G vis and the sequence C = (C (1) , C (2) , . . . , C (|V |) ) from Theorem 5.4 have already been determined. For all 1 ≤ i ≤ |V | we denote by G vis is the visibility graph of a subpolygon of P, and we denote this subpolygon by P (i) . As C (|V |) = C , by Lemma 5.1 we have that G (|V |) vis is the complete graph on n/|V | vertices. We will show that G First, we need one more lemma that was used before in [Bilò et al. 2012].
Definition 6.1. Let v i , v h be two vertices that do not see each other, and v b be the first vertex other than v i on the (euclidean) shortest path from v i to v h (and thus v b is reflex). We say v h is hidden from v i by v b .
Lemma 6.2. Let G (i+1) vis be given, as well as a vertex v j ∈ V (i) , a vertex v y ∈ V (i+1) visible to v j in P, and the index b = O vy (v j ). It is possible to determine the number of vertices in C (i) hidden from v j by v y in P.
Proof. By construction, two vertices of P (i) see each other in P if and only if they see each other in P (i) . In particular, the shortest path in P between two vertices of P (i) only bends at vertices of P (i+1) , since the vertices of C (i) are convex in P (i) . We can thus restrict ourselves to counting the number of vertices in C (i) hidden from v j by v y in P (i) , using the fact that no vertex in C (i) is hidden by another vertex of C (i) .
We give an algorithm to count the number of vertices in C (i) hidden from v j by v y in P (i) (cf. Figure 5). Let H = H direct ∪ H indirect be set of these vertices, where H direct are the ones visible to v y and H indirect are the ones not visible to v y . Since b = O vy (v j ) is given, we know which arc of G vis corresponds to (v y , v j ). Hence, by inspecting G vis , we can obtain the arc-labels of all arcs at v y in G (i) vis that form a reflex angle with (v y , v j ). We can infer ACM Journal Name, Vol. V, No. N, Article A, Publication date: January YYYY. Fig. 5. We can count the vertices of C (i) hidden from v j by vy by counting the vertices of C (i) that form a reflex angle with v j at vy (light grey region) and repeating the method recursively on the other (non-C (i) ) vertices that form reflex angles with v j at vy (dark grey).
|H direct |, since G vis encodes to which class each arc-label at v y leads. It remains to show how to determine |H indirect |.
Let U ⊆ V (i+1) be the set of vertices of G (i+1) vis that are visible to v y and form a reflex angle with v j at v y . Since G (i+1) vis is given and since v y ∈ V (i+1) , we can infer the identities of the vertices in U . Every vertex of H indirect is hidden from v y by exactly one vertex of U . Conversely, every vertex of C (i) that is hidden from v y by a vertex of U is part of H indirect . We are given G (i+1) vis , hence, for every u ∈ U , we know the index b = O u (v y ). We can thus use our algorithm recursively for v y and every vertex u ∈ U ⊆ V (i+1) to obtain H indirect .
Proof. The set of vertices V (i) of G (i) vis is given by V (i) = C (i) ∪ V (i+1) . It remains to show how to construct E (i) . Let A be the set of arcs in G vis between vertices of C (i) and V (i+1) , and B be the set of arcs between vertices of C (i) . We will first show how to construct A using the information contained in G (i+1) vis and G vis . After having determined A, we can apply the same approach in order to obtain B. This completes the proof as Note that every arc in G vis has a counterpart of opposite orientation. In order to construct A it is thus sufficient to consider e ∈ V (i+1) × C (i) and show how to decide whether e ∈ A or e / ∈ A. Deciding which elements of C (i) ×V (i+1) are in A is then immediate. Equivalently, we can consider v j ∈ V (i+1) with degree d in G (i) vis and 1 ≤ k ≤ d such that vis vj (k) ∈ C (i) , and show how to "identify" vis vj (k), i.e., how to find the index x such that v x = vis vj (k) in G (i) vis . If k = 1, we have x = j + 1 and if k = d, we have x = j − 1 because v j sees its two neighbors on the boundary. Now assume 1 < k < d. We will show that v y := vis vj (k − 1) cannot lie in C (i) . For the sake of contradiction assume that v y ∈ C (i) . In P (i) all vertices of C (i) are ears and thus convex. By Lemma 5.1 and i < |V |, there is more than one class and thus there is a vertex v z ∈ chain(v y+1 , v x−1 ) which is not visible to v j . The (euclidean) shortest path in P from v j to v z must visit v x or v y , which is a contradiction to both vertices being convex (Theorem 5.3). We can deduce that v y / ∈ C (i) and thus (v j , v y ) ∈ E (i+1) is part of G (i+1) vis and has already been identified, i.e., the index y is known. Because of Lemma 5.1, it is sufficient to know how many vertices of C (i) are in chain(v y+1 , v x−1 ) in order to find x. All these vertices are hidden from v j by v y , again because v x is convex. Either chain(v y+1 , v x−1 ) is empty, or all vertices hidden from v j by v y are in chain(v y+1 , v x−1 ). We can distinguish these cases by inspecting G vis , as knowing G (i+1) vis allows us to infer which edge in G vis corresponds to (v y , v j ). In the first case there trivially are no vertices of C (i) in chain(v y+1 , v x−1 ). In the second case, since we know b = O vy (v j ) as v j ∈ V (i+1) , we can use Lemma 6.2 to count the number of vertices of C (i) in chain(v y+1 , v x−1 ) hidden from v j by v y to determine x (cf. Figure 5). Once we have determined all arcs in A, we can easily obtain their labels by inspecting G vis : For every vertex in V (i+1) , the corresponding vertex of G vis gives us the different arc labels that belong to arcs leading to vertices of C (i) . Since we already identified all those vertices, we know which label belongs to which arc.
Using the fact that the arcs in A have already been identified, we can apply the exact same approach to construct B. More precisely, for each v j ∈ C (i) with degree d, and 1 < k < d such that v x := vis vj (k) is in C (i) , we can infer the index x by counting (Lemma 6.2) the number of vertices in C (i) hidden from v j by v y := vis vj (k − 1). We can do this because again v y / ∈ C (i) , and because the edge (v y , v j ) ∈ A has been identified before.
Theorem 3.5 follows directly from Theorem 5.4, Lemma 6.3 and the fact that G (|V |) is the complete graph on n/|V | vertices.

OUTLOOK
We gave a visibility graph reconstruction algorithm for an agent that is able to distinguish convex from reflex angles. The algorithm first determines the minimum base graph, then finds a class that forms a clique, and starting from this clique constructs the visibility graph by repeatedly adding classes of ears and determining the induced edges of the visibility graph.
Note that knowledge of an upper boundn on the number of vertices is required only in the first step to find the minimum base graph. In addition, the exponential running time of our algorithm is caused by this step. On the other hand, we do not rely on the geometric meaning of the angle data to find the minimum base graph at all. It would be interesting to see whether a specialized method for finding the base graph exists that makes use of the angle data to avoid an exponential running time or to eliminate the need to known. Table 1 lists other configurations of sensors for which the reconstruction problem remains open. Most prominently, we do not even know whether knowledge ofn alone suffices.