A ternary relation for structuring the digital plane

We discuss certain ternary relations, called plain, and show that each of them induces a connectedness on its underlying set. This connectedness allows for definitions of concepts of simple closed and Jordan curves. We introduce a particular plain ternary relation on the digital plane Z2 and, as the main result, we prove a digital analogue of the Jordan curve theorem for the connectedness induced by this relation. It follows that the ternary relation introduced may be used as a convenient structure on the digital plane for the study of the geometric properties of digital images that are related to boundaries because boundaries of objects in digital images are represented by digital Jordan curves. An advantage of this structure over the Khalimsky topology is that it allows Jordan curves to turn at the acute angle π4 at some points.


Introduction
Digital topology is a theory that was founded for the study of geometric and topological properties of digital images.The classical, graph theoretic approach to digital topology is based on using the 4-adjacency and 8-adjacency graphs for structuring Z 2 (cf.[6] and [7]).Unfortunately, neither 4-adjacency nor 8-adjacency itself allows for an analogue of the Jordan curve theorem (cf.[4]) so that a combination of the two adjacency graphs has to be used.To eliminate this deficiency, a new, purely topological approach to the problem was proposed in [2] which utilizes a convenient topology for structuring the digital plane, namely the Khalimsky topology.The convenience of the Khalimsky topology for structuring the digital plane was shown in [2] by proving an analogue of the Jordan curve theorem for the topology (recall that the classical Jordan curve theorem states that a simple closed curve in the Euclidean plane separates this plane into exactly two connected components).The topological approach was then developed by many authors -see, e.g., [3]- [5] and [9].
Since the Khalimsky topological space is an Alexandroff T 0 -space, it corresponds to a partial order on Z 2 , the so-called specialization order.The connectedness in the Khalimsky space then coincides with the connectedness in the underlying (simple) graph of the specialization order.Thus, when studying the connectedness of digital images, this graph, rather than the Khalimsky topology itself, may be used for structuring the digital plane.A disadvantage of this approach is that Jordan curves in the (specialization order of the) Khalimsky topology may never turn at the acute angle π 4 .It would, therefore, be useful to find some new, more convenient structures on Z 2 that would allow Jordan curves to turn, at some points, to form the acute angle π 4 .In the present note, to obtain such a convee-mail: slapal@fme.vutbr.cznient structure, we replace the specialization order of the Khalimsky topology, hence a binary relation on Z 2 , with a ternary relation on Z 2 .We will define a connectedness provided by this ternary relation and will prove a digital Jordan curve theorem for this connectedness thus showing that the ternary relation provides a convenient structure on the digital plane for the study of digital images.
In digital image processing, the 4-adjacency and 8adjacency graphs are the most frequently used structures on the digital plane.But, since the late 1980's, another structure on Z 2 has been used too, namely the Khalimsky topology [2].The specialization order of the Khalimsky topology (see Introduction) is the binary relation ≤ on Z 2 given as follows: For any (x, y), (z, t) ∈ Z 2 , (x, y) ≤ (z, t) if and only if • x, y are even and (z, t) ∈ A 8 (x, y) or • x is even, y is odd, z = x + i where i ∈ {−1, 1}, and t = y or • x is odd, y is even, z = x, and t = y + i where i ∈ {−1, 1}.
A portion of the specialization order ≤ of the Khalimsky topology is demonstrated in Figure 1 by a directed graph with the vertex set Z 2 where an oriented edge from a point p to a point q means that p ≤ q.Recall that, given a directed graph (i.e., a set with a binary relation), its underlying (undirected) simple graph is obtained by just ignoring the direction of the edges.A circle in a simple graph is said to be a simple closed curve if, with each of its vertices, it contains precisely two vertices adjacent to it.A simple closed curve J in a simple graph with the vertex set V is called a Jordan curve if it separates the set V into precisely two components, i.e., if the induced subgraph V − J has exactly two components.
The famous Jordan curve theorem proved for the Khalimsky topology in [2] may be formulated as follows: Theorem 1 In the underlying graph of the specialization order of the Khalimsky topology, every simple closed curve with at least four points is a Jordan curve.
It is readily verified that a simple closed curve (and thus also a Jordan curve) in the underlying graph of the specialization order of the Khalimsky topology may never turn at the acute angle π 4 .It could therefore be useful to replace the specialization order of the Khalimsky topology with some more convenient structure (relation on Z 2 ) that would allow Jordan curves to turn at the acute angle π 4 at some points.And this is what we will do in the next section.

Plain ternary relations and induced connectedness
Recall that, given a positive in integer n and a set X, an nary relation on X is a subset R ⊆ X n .Thus, the elements of R are finite sequences (ordered n-touples) of elements of X (for the basic properties of n-ary relations see [8]).In the sequel, we will restrict our considerations to n = 3, i.e., to ternary relations.
Definition 2 Let R be a plain ternary relation on a set X and n a nonnegative integer.A sequence of elements of X is called an R-walk if the following two conditions are satisfied: I.For every positive integer i < n, there exists II.Every (a 0 , a 1 , a 2 ) ∈ R satisfies the following two conditions: (i) if there exists i ∈ {0, 1, ..., n − 1} such that c i = a 1 and c i+1 = a 2 , then i > 0 and c i−1 = a 0 , (ii) f there exists i ∈ {1, 2, ..., n} such that c i−1 = a 2 and c i = a 1 , then i < n and c i+1 = a 0 .
An R-walk Observe that, if (x 0 , x 1 , ..., x n ) is an R-walk, then (x n , x n−1 , ..., x 0 ) is an R-walk, too (so that R-walks are closed under reversion) and, if ( Definition 3 Let R be a plain ternary relation on a set X. A nonempty, finite and R-connected subset J of X is said to be an R-simple closed curve if every element (a 0 , a 1 , a 2 ) ∈ R with {a 0 , a 1 } ⊆ J satisfies a 2 ∈ J and every z ∈ J fulfills one of the following two conditions: (1) There are exactly two elements (a 0 , a 1 , a 2 ) ∈ R satisfying both {a 0 , a 1 , a 2 } ⊆ J and z ∈ {a 0 , a 2 } and there is no element (2) There is exactly one element Clearly, every R-simple closed curve is an R-circle.
Definition 4 Let R be a plain ternary relation on a set X.
An R-simple closed curve J is called an R-Jordan curve if the subset X−J ⊆ X consists (i.e., is the union) of precisely two R-components.
From now on, R will denote the plain ternary relation on Z 2 given as follows: For every ((x i , y i )| i < 3) such that (x i , y i ) ∈ Z 2 for every i < 3, ((x i , y i )| i < 3) ∈ R if and only if one of the following eight conditions is satisfied: (1) x 0 = x 1 = x 2 and there is k ∈ Z such that y i = 4k + i for all i < 3, (2) (3) y 0 = y 1 = y 2 and there is k ∈ Z such that x i = 4k + i for all i < 3, (4) y 0 = y 1 = y 2 and there is k ∈ Z such that x i = 4k − i for all i < 3, (5) there is k ∈ Z such that x i = 4k + i for all i < 3 and there is l ∈ Z such that y i = 4l + i for all i < 3, (6) there is k ∈ Z such that x i = 4k + i for all i < 3 and there is l ∈ Z such that y i = 4l − i for all i < 3, (7) there is k ∈ Z such that x i = 4k − i for all i < 3 and there is l ∈ Z such that y i = 4l + i for all i < 3, (8) there is k ∈ Z such that x i = 4k − i for all i < 3 and there is l ∈ Z such that y i = 4l − i for all i < 3.
A portion of R is demonstrated in Figure 2. The ordered triples belonging to R are represented by arrows oriented from first to last terms.
Theorem 2 Every circle in the graph demonstrated in Figure 3 that does not turn at any point (4k + 2, 4l + 2), k, l ∈ Z, is an R-Jordan curve.
Proof.Clearly, every circle in the graph demonstrated in Fig. 3 that does not turn at any point (4k + 2, 4l + 2), k, l ∈ Z, is an R-simple closed curve.Let z = (x, y) ∈ Z 2 be a point such that x = 4k + p and y = 4l + q for some k, l, p, q ∈ Z with pq = ±1.Then we define the fundamental triangle T(z) to be the fifteen-point subset of Z 2 given as follows: Graphically, every fundamental triangle T (z) consists of fifteen points and forms a rectangular triangle obtained from a 4 × 4-square by dividing it by a diagonal.More precisely, each of the two diagonals divides the square into just two fundamental triangles having a common hypotenuse coinciding with the diagonal.In every fundamental triangle T (z), the point z is one of the three inside points of the triangle.The (four types of) fundamental triangles are demonstrated in the following figure: Given a fundamental triangle, we speak about its sides -it is clear from the above picture which sets are understood to be the sides (note that each side consists of five points and that two different fundamental triangles may have at most one side in common).Now, one can easily see that: (1) Every fundamental triangle is R-connected (so that the union of two fundamental triangles having a common side is connected).
(2) If we subtract from a fundamental triangle some of its sides, then the resulting set is still R-connected.
(3) If S 1 , S 2 are fundamental triangles having a common side D, then the set (S 1 ∪S 2 )−M is R-connected whenever M is the union of some sides of S 1 or S 2 different from D.
(4) Every R-connected subset of Z 2 with at most two points is a subset of a fundamental triangle.
We will show that the following is also true: (5) For every circle C in the graph demonstrated in Fig. 3 that does not turn at any point (4k + 2, 4l + 2), k, l ∈ Z, there are sequences S F , S I of fundamental triangles, S F finite and S I infinite, such that, whenever S ∈ {S F , S I }, the following two conditions are satisfied: (a) Each member of S, excluding the first one, has a common side with at least one of its predecessors.
(b) C is the union of those sides of fundamental triangles in S that are not shared by two different fundamental triangles from S.
Put C 1 = C and let S 1 1 be an arbitrary fundamental triangle with 1 , S 1 2 , ..., S 1 k are defined, let S 1 k+1 be a fundamental triangle with the following properties: k+1 has a side in common with S 1 k which is not a subset of C 1 and S 1 k+1 S 1  i for all i, 1 ≤ i ≤ k.Clearly, there will always be a (smallest) number k ≥ 1 for which no such fundamental triangle S 1 k+1 exists.Denoting by k 1 this number, we have defined a sequence (S 1  1 , S 1 2 , ..., S 1 k 1 ) of fundamental triangles.Let C 2 be the union of those sides of fundamental triangles in (S 1  1 , S 1 2 , ..., S 1 k 1 ) that are disjoint from C 1 and not shared by two different fundamental triangles in (S 1  1 , S Further, let S 1 = T (z) be a fundamental triangle such that z S whenever S is a member of S. Having defined S 1 , let S = (S 1 , S 2 , ...) be a sequence of fundamental triangles defined analogously to S (by taking S 1 instead of S 1  1 ).Then one of the sequences S, S is finite and the other is infinite.Indeed, S is finite (infinite) if and only if its first member equals such a fundamental triangle T (z) for which z = (k, l) ∈ Z 2 has the property that the cardinality of the set {(x, l) ∈ Z 2 ; x > k} ∩ C is odd (even).The same is true for S .If we put {S F , S I } = {S, S } where S F is finite and S I is infinite, then the conditions (a) and (b) are clearly satisfied.
Given a circle C in the graph demonstrated in Fig. 3 that does not turn at any point (4k + 2, 4l + 2), k, l ∈ Z, let S F and S I denote the union of all members of S F and S I , respectively.Then S F ∪ S I = Z The circles in the graph demonstrated in Fig. 3 that do not turn at any point (4k + 2, 4l + 2), k, l ∈ Z, which are R-Jordan curves by the previous Theorem, provide a rich enough variety of circles to be used for representing borders of objects in digital images.The advantage of the circles over the Jordan curves in the Khalimsky topology is that they may turn at at acute angle π 4 at some points.While the triangle ADE is a R-Jordan curve, it is not a Jordan curve in the (underlying graph of the specialization order of) Khalimsky topology.For this triangle to be a Jordan curve in the Khalimsky topology, we have to delete the points A,B,C and D. But this will lead to a considerable deformation of the triangle.

Conclusions
We have shown that every plain ternary relation induces connectedness on its underlying set.This connectedness was used to define concepts of simple closed and Jordan curves in the underlying set of a given plain ternary relation.We then introduced and discussed a particular plain ternary relation on the digital plane Z 2 and showed that the connectedness induced by this relation allows for a digital analogue of the Jordan curve theorem.Thus, we have shown that the ternary relation introduced provides a convenient structure on the digital plane for the study of digital images.An advantage of this structure over the Khalimsky topology is that it allows the Jordan curves to turn at the acute angle π 4 at some points.Since Jordan curves represent borders of objects in digital images, the structure on Z 2 provided by the ternary relation introduced may be used in digital image processing for solving problems related to boundaries such as pattern recognition, boundary detection, contour filling, data compression, etc.This work was supported by The Ministry of Education, Youth and Sports of the Czech Republic from the National Programme of Sustainability (NPU II) project "IT4Innovations excellence in science -LQ1602".

Figure 1 .
Figure 1.A portion of the specialization order of the Khalimsky topology.

Figure 2 .r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r rFigure 3 .
Figure 2. A portion of the relation R.
2 and S F ∩ S I = C.Let S * F and S * I be the sequences obtained from S F and S I by subtracting C from each member of S F and S I , respectively.Let S * F and S * I denote the union of all members of S * F and S * I , respectively.Then S * F and S * I are connected by (1), (2) and (3) and it is clear that S * F = S F − C and S * I = S I − C. So, S * F and S * I are the two components of Z 2 − C by (4) (S F −C is called the inside component and S I −C is called the outside component).The proof is complete.

Example 1
Consider the following (digital picture of a) triangle: