An
r×c grid graph is a graph whose vertices correspond to the points in the plane with integer coordinates,
xxx-coordinates being in the range
111, ...,
rrr,
yyy-coordinates being in the range
111, ...,
ccc, and two vertices are connected by an edge whenever the corresponding points are at distance 1. An
r×cr\times cr×c cyclic grid graph is a graph formed by connecting the first row with the last row and the first column with the last column on the basis of the
r×cr\times cr×c grid graph. Formally, in a
r×cr\times cr×c cyclic grid graph,
(x,y)(x,y)(x,y) and
(x,ymodc+1)(x, y\bmod c+1)(x,ymodc+1) is adjacent, and
(x,y)(x,y)(x,y) and
(xmodr+1,y)(x\bmod r+1, y)(xmodr+1,y) is adjacent.
Desprado2 constructed an
r×cr\times cr×c grid graph, but unfortunately, there are some broken vertices into the graph. This graph has some properties:
-
r, c≥5r,\ c\ge 5r, c≥5.
-
Each unbroken vertex is adjacent to at least three unbroken vertices.
-
Every row and column has at least four unbroken vertices.
-
For any broken vertices uuu and vvv, if they are not in the same connected component, then the shortest distance between uuu and vvv is at least 555.
Some examples are shown above, where white denotes unbroken vertices while black denotes broken vertices.
-
The graph in (a) is valid.
-
The graph in (b) is invalid, because the shortest distance between broken vertices (3,3)(3,3)(3,3) an (5,5)(5,5)(5,5) is only 4, which breaks property 444.
-
The graph in (c) is invalid, because the shortest distance between two broken vertices is 3, which breaks property 444.
-
The graph in (d) is invalid, because the row 333 only contains 333 unbroken vertices, which breaks property 3.
-
The graph in (e) is invalid, because the unbroken vertex (4,3)(4,3)(4,3) is adjacent to only two unbroken vertices, which breaks property 222.
After removing all the broken vertices in the graph and numbering the unbroken vertices
arbitrarily, he got an undirected graph of
nnn vertices and
mmm edges. There is an edge between
uuu and
vvv in the undirected graph if and only if
uuu and
vvv are adjacent in the original cyclic grid graph. Unfortunately again, after some days, he only remembered the undirected graph and forgot the coordinates of vertices in the original cyclic grid graph.
Please help Desprado2 to restore the original cyclic grid graph.