1 Introduction and Preliminaries

In graph theory, a mutual-visibility set is a set of vertices in a graph such that any two vertices in the set are mutually visible, which means that there is a shortest path between them that does not pass through any other vertex in the set. The mutual-visibility number of a graph is the size of a largest mutual-visibility set in the graph. The problem of finding the largest mutual-visibility set in the graph can be seen as a relaxation of the general position problem in graphs (for the definition of the problem and the related work see for example [3, 10] and the references therein).

Mutual-visibility sets have been studied in a variety of contexts, including wireless sensor networks, mobile robot networks, and distributed computing: in wireless sensor networks, mutual-visibility sets can be used to place sensors so that they can communicate with each other without interference; in mobile robot networks, mutual-visibility sets can be used to control robots so that they can avoid collisions; in distributed computing, mutual-visibility sets can be used to design efficient algorithms for problems such as consensus and broadcasting [1, 2, 7, 8, 11].

The foregoing problem, with the objective of maximizing the size of the largest mutual-visibility set, was placed on a graph-theoretical footing in 2022 by Di Stefano [9] who shows that this problem is NP-complete and study mutual-visibility sets on various classes of graphs, such as block graphs, trees, Cartesian products of paths and cycles, complete bipartite graphs, and cographs. In particular, the problem has been completely solved for rectangular grid graphs, whereas only partial results have been provided for the Cartesian product of two cycles.

The mutual-visibility in distance-hereditary graphs was studied in [4], where it is shown that the mutual-visibility number can be computed in linear time for this class. In [6], mutual-visibility sets of triangle-free graphs and Cartesian products were considered. In particular, it is shown that computing the mutual-visibility number of a Cartesian product is an intrinsically difficult problem.

Research work from mentioned papers on visibility problems in graphs shows that certain modifications to the visibility properties are of interest. In this respect, [5] introduces a variety of new mutual-visibility problems, including the total mutual-visibility problem, see also [12], the dual mutual-visibility problem, and the outer mutual-visibility problem.

In this paper, we expand the preceding research work on Cartesian products. In particular, we study mutual-visibility sets in two families of graphs: Cartesian products of a cycle and path as well as Cartesian products of two cycles. In the sequel of this section, we present definitions and results needed for the rest of the paper. In the following section, we provide some solutions to the mutual-visibility set problem in Cartesian products of a path and a cycle. In particular, it is established that the mutual-visibility number for most of the graphs of this class equals twofold the length of the cycle. In Sect. 3, we study the mutual-visibility number of Cartesian products of two cycles. The exact mutual-visibility numbers are provided for all graphs of this class. Specifically, it is shown that a largest mutual-visibility set of \(C_s \Box C_t\), \(s \ge t\), is of cardinality 3t if t is large enough.

Let \(G = (V(G),E(G))\) be a graph and \(M \subseteq V(G)\). We say that a shortest uv-path P is M-free, if P does not contain a vertex of \(M \setminus \{u, v \}\). Vertices \(u, v \in M\) are M-visible if G admits an M-free shortest uv-path. Moreover, M is a mutual-visibility set of G if vertices of M are pairwise M-visible. The mutual-visibility number of G is the size of a largest mutual-visibility set of G and it is denoted \(\mu (G)\).

The Cartesian product of graphs G and H is the graph \(G \Box H\) with vertex set \(V(G) \times V(H)\) and \((x_1,x_2)(y_1,y_2) \in E(G \Box H)\) whenever \(x_1y_1 \in E(G)\) and \(x_2=y_2\), or \(x_2y_2 \in E(H)\) and \(x_1=y_1\). It is well-known that the Cartesian product is commutative and associative, having the trivial graph as a unit.

The interval I(uv) between two vertices u and v of a graph G is the set of vertices on shortest uv-paths.

For positive integers n and k we will use the notation \([k] = \{1, 2, \ldots , k\}\), \([k]_0 = \{0, 1, \ldots , k-1\}\) and

$$\begin{aligned}{}[k,n] = \left\{ \begin{array}{ll} \{k, k+1, \ldots , n\}, &{}\quad n \ge k \\ \{n, n+1, \ldots , k\}, &{}\quad k > n \\ \end{array}. \right. \end{aligned}$$

For a positive integer s and \(n,k \in [s]_0\) let

$$\begin{aligned} |n - k|_s = \min \{ |n - k|, s - |n - k|\}. \end{aligned}$$

Moreover, let

$$\begin{aligned}{}[k,n]_s = \left\{ \begin{array}{ll} [k,n], &{}\quad |n - k|_s < \frac{s}{2} \\ {[s]_0}, &{}\quad |n - k|_s = \frac{s}{2} \\ {[s]_0} {\setminus } [k,n], &{} \quad |n - k|_s > \frac{s}{2} \\ \end{array}. \right. \end{aligned}$$

We will assume that \(V(P_s)=[s]_0\) for every \(s\ge 2\) and \(V(C_t)=[t]_0\) for every \(t\ge 3\). Thus, if \(u \in V(X_s \Box X_t)\), where \(X_s\) stands for either \(P_s\) or \(C_s\), while \(u_x \in [s]_0\) and \(u_y \in [t]_0\), we write \(u=(u_x,u_y)\). If \(i \in [t]_0\) (resp. \(j \in [s]_0\)), then the subgraph of \(C_s \Box C_t\) induced by \(V (C_s) \times \{i\}\) (resp. \( \{j\} \times V (C_t) \)) is isomorphic to \(C_s\) (resp. \(C_t\)); it is called a \(C_s\)-fiber (resp. \(C_t\)-fiber) and denoted \(C_s^i\) (resp. \(^j\!C_s\)).

A \(P_s\)-fiber and \(C_t\)-fiber in \(P_s \Box C_t\) denoted by \(P_s^i\) and \(^{j}{}{C_s}\), respectively, are defined analogously.

The following result can be easily confirmed.

Observation 1.1

Let t and s be nonnegative integers.

  1. 1.

    If \(u,v \in V(P_s \Box P_t)\), then \(I(u,v) = [u_x,v_x] \times [u_y,v_y]\).

  2. 2.

    If \(u,v \in V(P_s \Box C_t)\), then \(I(u,v) = [u_x,v_x] \times [u_y, v_y]_t\).

  3. 3.

    If \(u,v \in V(C_s \Box C_t)\), then \(I(u,v) = [u_x,v_x]_s \times [u_y,v_y]_t\).

Note also that for \(u,v \in V(P_s \Box P_t)\), \(u^{\prime },v^{\prime } \in V(P_s \Box C_t)\) and \(u^{\prime \prime },v^{\prime \prime } \in V(C_s \Box C_t)\) we have \(d(u,v) = |u_x - v_x| + |u_y - v_y|\), \(d(u^{\prime },v^{\prime }) = |u_x^{\prime } - v_x^{\prime }| + |u_y^{\prime } - v_y^{\prime }|_t\) and \(d(u^{\prime \prime },v^{\prime \prime }) = |u_x^{\prime \prime } - v_x^{\prime \prime }|_s + |u_y^{\prime \prime } - v_y^{\prime \prime }|_t\).

Lemma 1.2

Let \(M \subseteq V(P_s \Box P_t)\). If M obeys the following conditions

  1. (i)

    \(|M \cap P_s^i| \le 2 \) and \( |M\cap ^{\,\,j}\!\!{P_t}| \le 2\) for every \(i \in [t]_0\) and \(j \in [s]_0\),

  2. (ii)

    if \(M \cap P_s^i = \{ u, v\}\) and \(M \cap P_s^j = \{ w, z\}\) for some \(i,j \in [t]_0\), then \([u_x,v_x] \cap [w_x,z_x] \not = \emptyset \),

  3. (iii)

    if \(M \cap ^{\,\,i}\!\!{P_t} = \{ u, v\}\) and \(M \cap ^{\,\,j}\!\!{P_t} = \{ w, z\}\) for some \(i,j \in [s]_0\), then \([u_y,v_y] \cap [w_y,z_y] \not = \emptyset \),

  4. (iv)

    \(d(u,v) \ge 3\) for every \(u,v \in M\),

then M is a mutual-visibility set of \(P_s \Box P_t\).

Proof

We will show that there exists an M-free shortest uv-path for every \(u,v \in M\). Note that for \(u_x = v_x\) or \(u_y = v_y\), by condition (i) of the lemma, the assertion trivially holds. Let assume w.l.o.g. that \(u_y < v_y\) and let \(M_{u,v}:= (M {\setminus } \{u, v \}) \cap [u_x,v_x] \times [u_y, v_y]\).

The proof is by induction on the cardinality of \(M_{u,v}\). If \(|M_{u,v}|=1\), then \(u_x \not = v_x\) by condition (i) of the lemma. Thus, it is not difficult to construct a shortest uv-path that does not contain the vertex of \(M_{u,v}\).

Suppose now that the lemma does not hold and let u and v be vertices of M which are not mutually visible in \(P_s \Box P_t\). Moreover, let u and v be chosen in the way that \(M_{u,v}\) is the set with the smallest cardinality such that u and v are not M-visible. Suppose first that \(u_x < v_x\). Note that for every \(w \in M_{u,v}\), by the minimality of \(M_{u,v}\), there exists an M-free shortest wv-path, say P. Note that, by \(w_x \le v_x\) and \(w_y \le v_y\), it holds that P admits either the vertex \(w'=(w_x+1,w_y)\) or the vertex \(w''=(w_x,w_y+1)\).

If there exists \(w \in M_{u,v}\) such that \(M_{u,w} = \emptyset \), \(u_x \not = w_x\) and \(u_y \not = w_y\), let \(w_x - u_x = k\) and \(w_y- u_y = \ell \). We will show that we can always find an M-free shortest \(u,w^{\prime }\)- and \(u,w^{\prime \prime }\)-path. Since M is composed of vertices that are pairwise at a distance of at least three, \(P^{\prime }=u, (u_x+1,u_y), \ldots ,(u_x+k,u_y),(u_x+k,u_y+1),\ldots , (u_x+k,u_y+\ell -1), (u_x+k+1,u_y+\ell -1), (u_x+k+1,u_y+\ell ) =w^{\prime }\) is an M-free shortest \(u,w^{\prime }\)-path, while \(P^{\prime \prime }=u, (u_x+1,u_y), \ldots ,(u_x+k-1,u_y),(u_x+k-1,u_y+1),\ldots , (u_x+k-1,u_y+\ell +1), (u_x+k,u_y+\ell +1) =w^{\prime \prime }\) is an M-free shortest \(u,w^{\prime \prime }\)-path.

Otherwise (i.e., M does not admit w from the previous paragraph), suppose w.l.o.g. that there exists \(z^1 \in M_{u,v}\) such that \(z^1_y = u_y\). Let us consider the sequence of vertices \(z^1, z^2, \ldots , z^{a}\), \(z^{i} \in M_{u,v}\) where \( i \in [a]\), such that \(z^{i+1}_y = z^{i}_y + 1\) and \(z^{i+1}_x > z^{i}_x\), where a is the largest integer that allows this sequence. Note that since \(u_y= z^{1}_y\) from condition (ii) of the lemma it follows that \([z^1_x, z^a_x] \times [z^1_y, z^a_y] \cap M = \{z^{1}, \ldots , z^{a} \}\).

If there exists \(w \in M_{u,v}\) and \(i \in [ a]\) such that \(w_y > z^{a}_y\), \(w_x \ge z^{i}_x\) and \(M_{z^{i},w} = \emptyset \), then by the above discussion we have \(M_{u,w} = \{z^{1}, \ldots , z^{i} \}\). Since M is composed of vertices that are pairwise at a distance of at least three, we can now construct, similarly as above, an M-free shortest \(u,w^{\prime }\)- and \(u,w^{\prime \prime }\)-path.

Otherwise (i.e., M does not admit w from the previous paragraph), we clearly have \(M_{z^{a},v} = \emptyset \). But since it is not difficult to construct an M-free shortest uv-path for this case, we obtain a contradiction.

Note that we showed above that we can always construct an M-free shortest \(u,w^{\prime }\)- and \(u,w^{\prime \prime }\)-path. If \(w^{\prime } \in V(P)\), then, \(V(P) {\setminus } \{ w \}\) is an M-free shortest \(w^{\prime },v\)-path. Moreover, the graph induced by \(V(P) \cup V(P^{\prime }) \setminus \{ w \}\) is an M-free shortest uv-path, say Q. Since Q is of length \(w_x + 1 - u_x + v_x - w_x - 1 + w_y-u_y+v_y-w_y = v_x - u_x + v_y- u_y\) it holds that Q is an M-free shortest uv-path and we obtain a contradiction. If \(w^{\prime \prime } \in V(P)\), then we can analogously construct an M-free shortest uv-path that yields a contradiction.

Since the proof for \(u_x > v_x\) is analogous, the proof is complete. \(\square \)

2 Cartesian Products of a Cycle and a Path

A subgraph H of a graph G is said to be convex if all shortest paths in G between vertices of H actually belong to H. The convex hull of \(V^{\prime } \subseteq V(G)\), denoted by \({\textit{hull}} (V^{\prime })\), is defined as the smallest convex subgraph containing \(V^{\prime }\). It is proved in [9, Lemma 2.3] that for a given a graph G with a partition \(V_1, V_2, \ldots , V_k\) of V(G) we have \(\mu (G) \le \sum _ {n=1}^{k}\mu (hull(V_i))\). Since \(\mu (P_s ) = 2\) and \(\mu (C_t ) = 3\) for every \(t>s\ge 2\), the following result easily follows.

Proposition 2.1

If \(s \ge 2\) and \(t \ge 3\), then \(\mu (P_s \Box C_t) \le {\textit{min}}\{3s, 2t \}\).

Fig. 1
figure 1

Mutual-visibility sets of \(P_{2} \Box C_{3}\), \(P_{2} \Box C_{4}\), \(P_{2} \Box C_{5}\) and \(P_{2} \Box C_{6}\)

If the path in a product is of length 2, we obtain the following result.

Proposition 2.2

If \(t \ge 3\), then

$$\begin{aligned} \mu (P_2 \Box C_t) = \left\{ \begin{array}{ll} 4, &{}\quad t = 3 \\ 5, &{}\quad t = 4 \\ 5, &{}\quad t = 5 \\ 6, &{}\quad t \ge 6 \\ \end{array}. \right. \end{aligned}$$

Proof

By Proposition 2.1, we have \(\mu (P_2 \Box C_t) \le 6\). For \(t \le 6\), the result follows from the constructions depicted in Fig. 1 and straightforward case analysis. Since it is not difficult to provide construction with 6 vertices for every \(t \ge 7\), the proof is complete. \(\square \)

The next observation can be easily confirmed.

Observation 2.3

Let t and \(s > k\) be nonnegative integers. If M is a mutual-visibility set of \(P_k \Box C_t\), then M is a mutual-visibility set of \(P_s \Box C_t\).

The following proposition shows that the upper bound on the mutual-visibility number of \(P_s \Box C_t\) is achieved when t and s are big enough.

Theorem 2.4

If \(s + 1 \ge t \ge 6 \), then \(\mu (P_s \Box C_t) = 2t\).

Fig. 2
figure 2

Mutual-visibility set of \(P_{10} \Box C_{10}\) (left) and \(P_{12} \Box C_{13}\) (right)

Proof

By Observation 1.1, for every \(u,v \in V(P_{s} \Box C_{t})\) we have \(I(u,v) = [u_x,v_x] \times [u_y,v_y]_{t}\). Thus, the graph induced by \([u_x,v_x] \times [u_y,v_y]_{t}\) is isomorphic to a subgraph of \(P_{s} \Box P_{\lceil {t+1 \over 2}\rceil }\).

Let \(t \ge 13\) be odd and \(M^{\prime } = \{((2i + j (2 \lfloor {t-3 \over 4}\rfloor + 1)) \, \textrm{mod} \, (t-3), i) \, | \, i \in [t-3]_0, j\in [2]_0 \}\). Obviously, \(M^{\prime }\) is a subset of \(P_{t-3} \Box C_{t-3}\) of cardinality \(2(t-3)\). This set for \(t=13\) is depicted on the left-hand side of Fig. 2. By confirming the conditions of Lemma 1.2 we will show that \(M^{\prime }\) is a mutual-visibility set of \(P_{t-3} \Box C_{t-3}\).

Note first that \(M^{\prime } = \{(2i, (i + j {t-3 \over 2}) \, \textrm{mod} \, (t-3)) \, | \, i \in [{t-3 \over 2}]_0, j\in [2]_0 \} \cup \{(2i+1, (i +\lceil {t-3 \over 4}\rceil + j {t-3 \over 2}) \, \textrm{mod} \, (t-3)) \, | \, i \in [{t-3 \over 2}]_0, j\in [2]_0 \}\). Thus, it readily follows that \(|M' \cap P_{t-3}^k| = 2 \) and \( |M'\cap ^{\,\,\ell }{C_{t-3}}| = 2\) for every \(k, \ell \in [t-3]_0\) which in turn satisfies condition (i) of Lemma 1.2. Moreover, it is not difficult to see that \(d(u,v) \ge 3\) for every \(u,v \in M^{\prime }\). Thus, we are left with conditions (ii) and (iii) of Lemma 1.2. By the above discussion, for every \(u,v \in V(P_{t-3} \Box C_{t-3})\) we have \(I(u,v) = [u_x,v_x] \times [u_y,v_y]_{t-3}\). It follows that the graph induced by \([u_x,v_x] \times [u_y,v_y]_{t-3}\) is isomorphic to a subgraph of \(P_{t-3} \Box P_{\lceil {t-2 \over 2}\rceil }\). Since for every \(u,v \in M^{\prime } \cap P_{t-3}^k\), \(k \in [t-3]_0\), it holds that \(d(u,v)= 2 \lceil {t-3 \over 4}\rceil + 1\), it follows that for every \(u,v \in M^{\prime } \cap P_{t-3}^k\) and every \(w,z \in M^{\prime } \cap P_{t-3}^{k^{\prime }}\) we have \(\min \{u_x, v_x \} < \max \{z_x, w_x \}\). Moreover, since for every \(u,v \in M^{\prime } \cap ^{\,\,\ell }{\!\!C_{t-3}}\), \(\ell \in [t-3]_0\) it holds that \(d(u,v)= \lceil {t-3 \over 2}\rceil \), it follows that for every \(u,v \in M^{\prime } \cap ^{\,\,\ell }{\!\!C_{t-3}}\) and every \(w,z \in M^{\prime } \cap ^{\,\,\ell '}{\!\!C_{t-3}}\) we have \(\min \{u_y, v_y \} < \max \{z_y, w_y \}\). Thus, conditions (ii) and (iii) of Lemma 1.2 are also fulfilled.

Let \(M:= B \cup M_1 \cup M_2 \cup M_3\), where the sets B, \(M_1\), \(M_2\), and \(M_3\) are defined as follows:

  • \(B =\{(0,0),(0,\lceil {t \over 3}\rceil ), (0, \lceil {2 t \over 3}\rceil ),(t-2,0), (t-2,\lceil {t \over 3}\rceil ), (t-2, \lceil {2 t \over 3}\rceil ) \}\),

  • \(M_1 = \{((2i + j (2 \lfloor {t-3 \over 4}\rfloor + 1)) \, \textrm{mod} \, (t-3)+1, i+1) \, | \, i \in [\lceil {t \over 3}\rceil -1]_0, j\in [2]_0 \}\),

  • \(M_2 = \{((2i + j (2 \lfloor {t-3 \over 4}\rfloor + 1)) \, \textrm{mod} \, (t-3)+1, i+2) \, | \, i \in [\lceil {t \over 3}\rceil -1, \lceil {2 t \over 3}\rceil -3], j\in [2]_0 \}\),

  • \(M_3 = \{((2i + j (2 \lfloor {t-3 \over 4}\rfloor + 1)) \, \textrm{mod} \, (t-3)+1, i+3) \, | \, i \in [\lceil {2 t \over 3}\rceil -2, t-4], j\in [2]_0 \}\).

Fig. 3
figure 3

Mutual-visibility set of (left) \(P_{11} \Box C_{11}\) and \(P_{13} \Box C_{14}\) (right)

Note that M is a subset of \(P_{t-1} \Box C_{t}\) and remind that \(M'\) is a mutual-visibility set of \(P_{t-3} \Box C_{t-3}\). We can see that M can be obtained from \(M'\) by inserting in \(P_{t-3} \Box C_{t-3}\) three \(P_ {t-1}\)-fibers and two \(C_ {t}\)-fibers that contains vertices of B (for \(t =13\) see M in the right-hand side of Fig. 2). Thus, \(M {\setminus } B\) is clearly a mutual-visibility set of \(P_{t-1} \Box C_{t}\). Moreover, the vertices of \(B\cup M\) do not violate the conditions of Lemma 1.2 with the exception of condition (iv), i.e., a vertex of B may be at distance two from a vertex of \(M \setminus B\). However, since a vertex \(u \in B\) belongs either to \(^{0}{}{C_{t}}\) or \(^{t-1}{}{C_{t}}\) it is not difficult to obtain an M-free shortest uv-path for every \(v \in M\). Suppose for example that \(u \in \, ^{0}{}{C_{t}}\), \(v, w \in M {\setminus } B\), \(d(u,w)=2\) and \(u_y < w_y \le v_y\). If P denote an M-free shortest wv-path, then either \(w^{\prime }=(w_x+1, w_y)\) or \(w^{\prime \prime }=(w_x, w_y+1)\) belongs to P. Since it is trivial to obtain an M-free shortest \(u,w^{\prime }\)-path and \(u,w^{\prime \prime }\)-path, we can also obtain an M-free shortest uv-path.

It follows that M is a mutual-visibility set of \(P_{t-1} \Box C_{t}\).

Table 1 Mutual-visibility numbers of \(P_s \Box C_t\), where \(t \le 17\)

Let \(t \ge 14\) be even and \(M^{\prime } = \{((2i + j (t-8)) \, \textrm{mod} \, (t-3), i) \, | \, i \in [t-3]_0, j\in [2]_0 \}\). This set for \(t=14\) is depicted on the left-hand side of Fig. 3. Obviously, \(M^{\prime }\) is a subset of \(P_{t-3} \Box C_{t-3}\) of cardinality \(2(t-3)\). We will show that \(M^{\prime }\) is a mutual-visibility set of \(P_{t-3} \Box C_{t-3}\) by confirming the conditions of Lemma 1.2.

We can see that \(M^{\prime } = \{(i, (i {t-2 \over 2} +j {t+2 \over 2} ) \, \textrm{mod} \, (t-3)) \, | \, i \in [t-3]_0, j\in [2]_0 \}\). Thus, it readily follows that \(|M^{\prime } \cap P_{t-3}^k| = 2 \) and \( |M' \cap ^{\,\,\ell }{\!\!C_{t-3}}| = 2\) for every \(k, \ell \in [t-3]_0\) which in turn satisfies condition (i) of Lemma 1.2. Moreover, it is not difficult to see that \(d(u,v) \ge 3\) for every \(u,v \in M'\). In order to see that conditions (ii) and (iii) of Lemma 1.2 are fulfilled, note that for every \(u,v \in M' \cap P_{t-3}^k\), \(k \in [t-3]_0\), it holds that \(d(u,v)= t-8\), while for for every \(u,v \in M^{\prime } \cap ^{\,\,\ell }{\!\!C_{t-3}}\), \(\ell \in [t-3]_0\), it holds that \(d(u,v)= \lceil {t+2 \over 2}\rceil \). Remind that the graph induced by \([u_x,v_x] \times [u_y,v_y]_{t-3}\) is isomorphic to a subgraph of \(P_{t-3} \Box P_{\lceil {t-2 \over 2}\rceil }\). Analogously as for an even t we can then conclude that conditions (ii) and (iii) of Lemma 1.2 are also fulfilled. It follows that \(M'\) is a mutual-visibility set of \(P_{t-3} \Box C_{t-3}\).

Let \(M:= B \cup M_1 \cup M_2 \cup M_3\), where the sets B, \(M_1\), \(M_2\), and \(M_3\) are defined as follows:

  • \(B =\{(0,0),(0,\lceil {t \over 3}\rceil ), (0, \lceil {2 t \over 3}\rceil ),(t-2,0), (t-2,\lceil {t \over 3}\rceil ), (t-2,\lceil {2 t \over 3}\rceil ) \}\),

  • \(M_1 = \{((2i + j (t-8)) \, \textrm{mod} \, (t-3) + 1, i + 1) \, | \, i \in [\lceil {t \over 3}\rceil -1]_0, j\in [2]_0 \}\).

  • \(M_2 = \{((2i + j (t-8)) \, \textrm{mod} \, (t-3) + 1, i + 2) \, | \, i \in [\lceil {t \over 3}\rceil -1, \lceil {2 t \over 3}\rceil -3], j\in [2]_0 \}\),

  • \(M_3 = \{((2i + j (t-8)) \, \textrm{mod} \, (t-3) + 1, i + 3) \, | \, i \in [\lceil {2 t \over 3}\rceil -2, t-4], j\in [2]_0 \}\).

Again, we can see that M can be obtained from \(M^{\prime }\) by inserting in \(P_{t-3} \Box C_{t-3}\) three \(P_ {t-1}\)-fibers and two \(C_ {t}\)-fibers that contains vertices of B and analogously as for an even t we can conclude that M is a mutual-visibility set of \(P_{t-1} \Box C_{t}\) if t is even (for \(t =14\) see M in the right-hand side of Fig. 3).

From the above discussion, it follows that there exists a mutual-visibility set with 2t vertices of \(P_{t-1} \Box C_{t}\) for every \(t \ge 13\). Moreover, since we found a mutual-visibility set of this size for every \(6 \le t \le 12\) (these sets are available on the web page https://omr.fnm.um.si/wp-content/uploads/2023/08/MVS-constructions-for-paths-and-cycles.txt), we have \(\mu (P_{t-1} \Box C_t) = 2t\) for every \(t \ge 6\). Proposition 2.1 and Observation 2.3 now yield the assertion. \(\square \)

Remark 2.5

Mutual-visibility numbers of \(P_s \Box C_t\), for \(t \le 12 \), obtained by a computer, are presented in Table 1, where the symbol \(-\text {''}-\) represents the repeated last value in the corresponding row. Note that this value, the last shown mutual-visibility number in every row, equals 2t.

It can be seen that for every \(12 \le t \le 17\) we have \(\mu (P_s \Box C_t) = {\textit{min}}\{3s, 2t \}\). This observation together with Proposition 2.2 leads us to state the following conjecture.

Conjecture 2.6

If \(t \ge 12\), then \(\mu (P_s \Box C_t) = {\textit{min}}\{3s, 2t \}\).

3 Cartesian Products of Two Cycles

The following result is given in [9].

Proposition 3.1

If \(s \ge t \ge 3\), then \(\mu (C_s \Box C_t) \le 3t\).

The next results show that the upper bound is achieved for most products of the form \(C_t \Box C_t\). Since by Proposition 3.1 it holds that \(\mu (C_t \Box C_t) \le 3t\), we have to show that a mutual-visibility set of cardinality 3t exists for every t.

Proposition 3.2

Let \(t\equiv 3\) (mod 6). If \(t \ge 15\), then \(\mu (C_t \Box C_t) = 3t\).

Proof

We will show that a mutual-visibility set of cardinality 3t exists for every \(t \equiv 3\) (mod 6), \(t \ge 15\). Let \(t=3k\), where \(k\ge 5\) is odd. Note that for every \(u,v \in V(C_{3k} \Box C_{3k})\) we have \(I(u,v) = [u_x,v_x]_{3k} \times [u_y,v_y]_{3k}\). Moreover, the graph induced by \([u_x,v_x]_{3k} \times [u_y,v_y]_{3k}\) is isomorphic to a subgraph of \(P_{ { 3k+1 \over 2 }} \Box P_{{3k+1 \over 2}}\).

Let \(M = \{((2i + jk) \, \textrm{mod} \, 3k, i) \, | \, i \in [3k]_0, j\in [3]_0 \}\). For \(k=5\), the construction is depicted on the left-hand side of Fig. 4. We can see that \(M = \{(i, ({k +1 \over 2} i + jk) \, \textrm{mod} \, 3k) \, | \, i \in [3k]_0, j\in [3]_0 \}\).

Since the vertices of \(M \cap C_{3k}^i \) as well as of \(M \cap ^{\,\,j}{\!\!C_{3k}}\) are pairwise at distance k, it readilly follows that \(|M \cap C_{3k}^i \cap [z_x,w_x]_{3k} \times [z_y,w_y]_{3k}| \le 2 \) and \(|M \cap ^{\,\,j}{\!\!C_{3k}} \cap [z_x,w_x]_{3k} \times [z_y,w_y]_{3k}| \le 2\) for every \(i,j \in [3k]_0\) and every \(z,w \in V(C_{ 3k} \Box C_{3k})\), which in turn satisfies condition (i) of Lemma 1.2. Moreover, since \(d(z_x,w_x) \le {3k - 1 \over 2}\) and \(d(z_y,w_y) \le {3k - 1 \over 2}\) for every \(z,w \in V(C_{ 3k} \Box C_{3k})\), conditions (ii) and (iii) of Lemma 1.2 are also fulfilled.

We can also see that \(d(u,v) \ge 3\) for every \(u,v \in M\), which confirms condition (iv) of Lemma 1.2. It follows that M is a mutual-visibility set of cardinality 9k in \(C_{ 3k} \Box C_{3k}\) if \(k\ge 5\) is odd. \(\square \)

Proposition 3.3

Let \(t\equiv 0\) (mod 6). If \(t \ge 18\), then \(\mu (C_t \Box C_t) = 3t\).

Proof

We will show that a mutual-visibility set of cardinality 3t exists for every \(t \equiv 0\) (mod 3), \(t \ge 18\). Let \(t=3k\), where \(k\ge 6\) is even. Note that for every \(u,v \in V(C_{3k} \Box C_{3k})\) we have \(I(u,v) = [u_x,v_x]_{3k} \times [u_y,v_y]_{3k}\). Moreover, the graph induced by \([u_x,v_x]_{3k} \times [u_y,v_y]_{3k}\) is isomorphic to a subgraph of \(P_{ { 3k+2 \over 2 }} \Box P_{{3k+2 \over 2}}\).

Let \(M = \{((i + j k, 2i + \ell k) \, | \, i \in [{k \over 2}]_0, j, \ell \in [3]_0 \} \cup \{(k-i-1+jk, (2i + 3 + \ell k ) \, \textrm{mod} \, 3k) \, | \, i \in [{k \over 2}]_0, j, \ell \in [3]_0 \}\).

For \(k=6\), the construction is depicted on the right-hand side of Fig. 4. We can see that the vertices of \(M \cap C_{3k}^i \) as well as of \(M \cap ^{\,\,j}{\!\!C_{3k}}\) are pairwise at distance k. Thus, using the same arguments as in the proof of Proposition 3.2 we can see that M satisfies conditions (i), (ii), and (iii) of Lemma 1.2.

Since it is not difficult to confirm that \(d(u,v) \ge 3\) for every \(u,v \in M\), it follows that M is a mutual-visibility set of cardinality 9k in \(C_{ 3k} \Box C_{3k}\) if \(k\ge 6\) is even. \(\square \)

Fig. 4
figure 4

Mutual-visibility set of \(C_{15} \Box C_{15}\) (left) and \(C_{18} \Box C_{18}\) (right)

Fig. 5
figure 5

Mutual-visibility set of \(C_{17} \Box C_{17}\) (left) and \(C_{19} \Box C_{19}\) (right)

Proposition 3.4

Let \(t\equiv 5 \) (mod 6). If \(t \ge 17\), then \(\mu (C_t \Box C_t) = 3t\).

Proof

We will show that a mutual-visibility set of cardinality 3t exists for every \(t \equiv 5\) (mod 6), \(t \ge 17\).

Let \(t=3k+2\), for an odd k. Note that for every \(u,v \in V(C_{3k+2} \Box C_{3k+2})\) we have \(I(u,v) = [u_x,v_x]_{3k+2} \times [u_y,v_y]_{3k+2}\). Moreover, the graph induced by \([u_x,v_x]_{3k+2} \times [u_y,v_y]_{3k+2}\) is isomorphic to a subgraph of \(P_{ {3k+3 \over 2}} \Box P_{3k+3 \over 2}\).

Let \(M = \{(i + j (k+1) \, \textrm{mod} \, (3k+2)), 2i ) \, | \, i \in [{3k+3 \over 2}]_0, j\in [3]_0 \} \cup \{(( i + {3k+3 \over 2} + j (k+1) \, \textrm{mod} \, (3k+2)), 2i+1) \, | \, i \in [{3k+1 \over 2}]_0, j\in [3]_0 \}\). For \(k=5\) the construction is depicted on the left-hand side of Fig. 5. We can see that \(M = \{(i, (2i + jk) \, \textrm{mod} \, (3k+2)) \, | \, i \in [3k+2]_0, j\in [3]_0 \} \).

Note that the distance between vertices of \(M \cap C_{3k+2}^i \) is either k or \(k+1\), while the distance between vertices of \(M \cap ^{\,\, j}\!\! C_{3k+2}\) is either k or \(k+2\). Thus, using the same arguments as in the proof of Proposition 3.2 we can see that M satisfies conditions (i), (ii), and (iii) of Lemma 1.2.

Since we can confirm that \(d(u,v) \ge 3\) for every \(u,v \in M\), It follows that M is a mutual-visibility set of cardinality \(9k+6\) in \(C_{ 3k+2} \Box C_{3k+2}\) if \(k\ge 5\) is odd. \(\square \)

Proposition 3.5

Let \(t\equiv 1 \) (mod 6). If \(t \ge 19\), then \(\mu (C_t \Box C_t) = 3t\).

Proof

We will show that a mutual-visibility set of cardinality 3t exists for every \(t \equiv 1\) (mod 6), \(t \ge 19\).

Let \(t=3k+1\), for an even k. Note that for every \(u,v \in V(C_{3k+1} \Box C_{3k+1})\) we have \(I(u,v) = [u_x,v_x]_{3k+1} \times [u_y,v_y]_{3k+1}\). Moreover, the graph induced by \([u_x,v_x]_{3k+1} \times [u_y,v_y]_{3k+1}\) is isomorphic to a subgraph of \(P_{ {3k+2 \over 2}} \Box P_{3k+2 \over 2}\).

Let \(M = \{((i + j k) \, \textrm{mod} \, (3k+1)),2i) \, | \, i \in [{3k+2 \over 2}]_0, j\in [3]_0 \} \cup \{( (i + {3k+2 \over 2} + j k) \, \textrm{mod} \, (3k+1)), 2i+1) \, | \, i \in [{3k \over 2}]_0, j\in [3]_0 \}\). For \(k=6\) the construction is depicted on the right-hand side of Fig.  5. We can see that \(M = \{(i, (2i + j(k+1)) \, \textrm{mod} \, (3k+1)) \, | \, i \in [3k+1]_0, j\in [3]_0 \} \).

Note that the distance between vertices of \(M \cap C_{3k+1}^i \) is either k or \(k+1\), while the distance between vertices of \(M \cap ^{\,\,j}{\!\!C_{3k+2}}\) is either \(k+1\) or \(k-1\). Thus, using the same arguments as in the proof of Proposition 3.2 we can see that M satisfies conditions (i), (ii), and (iii) of Lemma 1.2.

Since we can confirm that \(d(u,v) \ge 3\) for every \(u,v \in M\), It follows that M is a mutual-visibility set of cardinality \(9k+3\) in \(C_{ 3k+1} \Box C_{3k+1}\) if \(k\ge 6\) is even. \(\square \)

Proposition 3.6

Let \(t\equiv 2 \) (mod 6). If \(t \ge 20\), then \(\mu (C_t \Box C_t) = 3t\).

Proof

We will show that a mutual-visibility set of cardinality 3t exists for every \(t \equiv 2\) (mod 6), \(t \ge 20\).

Let \(t=3k+2\), for an even k. Remind that for every \(u,v \in V(C_{3k+2} \Box C_{3k+2})\) we have \(I(u,v) = [u_x,v_x]_{3k+2} \times [u_y,v_y]_{3k+2}\). Moreover, the graph induced by \([u_x,v_x]_{3k+2} \times [u_y,v_y]_{3k+2}\) is isomorphic to a subgraph of \(P_{ {3k+4 \over 2}} \Box P_{3k+4 \over 2}\).

Let \(M = \{((i + j (k+1)) \, \textrm{mod} \, (3k+2), 2i) \, | \, i \in [{3k+2 \over 2}]_0, j\in [3]_0 \} \cup \{ ((i + {3k +2 \over 2} + j (k+1)) \, \textrm{mod} \, (3k+2), 2i+1)) \, | \, i \in [{3k+2 \over 2}]_0, j\in [3]_0 \}\). For \(k=6\), the construction is depicted on the left-hand side of Fig. 6.

Since \(M = \{( i, 2i ) \, | \, i \in [k+1]_0 \} \cup \{(i, 2i + k+1) \, | \, i \in [k+1]_0 \} \cup \{(i, (2i + 2k) \, \textrm{mod} \, (3k+1)) \, | \, i \in [k+1]_0 \} \cup \{( i+k+1, 2i) \, | \, i \in [k+1]_0 \} \cup \{(i +k+1, 2i + k +1) \, | \, i \in [k+1]_0 \} \cup \{( i + k +1, (2i + 2k + 2) \, \textrm{mod} \, (3k+1)) \, | \, i \in [k+1]_0 \} \cup \{(i + 2k+2, 2i) \, | \, i \in [k]_0 \} \cup \{(i +2k+2, 2i + k+3 ) \, | \, i \in [k]_0 \} \cup \{(i + 2k+2, (2i + 2k+2) \, \textrm{mod} \, (3k+1)) \, | \, i \in [k]_0 \} \), the vertices of \(M \cap ^{\,\,j}{\!\!C_{3k+2}}\) are pairwise at distance \(k+3\), k or \(k-1\), while the distance between vertices of \(M \cap C_{3k+2}^i \) is either \(k+1\) or k. Thus, using the same arguments as in the proof of Proposition 3.2 we can see that M satisfies conditions (i), (ii), and (iii) of Lemma 1.2.

Let \(A =\{(0,0), (k+1,0), (2k+2, 0) \}\) and \(B =\{ (3k+1,3k+1), (k, 3k+1), (2k+1,3k+1) \}\). We can see that \(A \cup B \subseteq M\). Moreover, \(d((0,0), (3k+1,3k+1)) = d((k+1,0), (k,3k+1)) = d((2k+2,0), (2k+1,3k+1))=2\), while for every \(u,v \in M {\setminus } A \) as well as \(u,v \in M {\setminus } B\) we have \(d(u,v)\ge 3\). Thus, \(M {\setminus } A\) and \(M {\setminus } B\) are both mutual-visibility sets in \(C_{3k+2} \Box C_{3k+2}\).

If \(x \in A\) and \(y \in B\) such that \(d(x,y)=2\), then we say that x and y form a cross pair in M. We have to show that for every \(u, v \in M\), where I(uv) includes a cross pair, there exists an M-free shortest uv-path in \(C_t \Box C_t\).

Suppose w.l.o.g. that \(u_y > {3k+2 \over 2}\) and \(v_y < {3k+2 \over 2}\). Assume first that \(u_x \le 2k+1\). Let \(x=(2k+1,3k+1)\), \(y= (2k+2, 0)\) and \(x,y \in I(u,v)\). Let also \(x^{\prime }=(2k,3k+1)\), \(x^{\prime \prime }=(2k+1,3k)\), \(y^{\prime }= (2k+3, 0)\) and \(y^{\prime \prime }= (2k+2, 1)\). Note that every M-free shortest ux-path contains either \(x^{\prime }\) or \(x^{\prime \prime }\), while every M-free shortest vy-path contains either \(y^{\prime }\) or \(y^{\prime \prime }\).

If \(u_y \not \in \{3k-1,3k\}\) and \(u_x < 2k\), it is not difficult to see that we can always find an M-free shortest shortest \(u,x^{\prime }\)- and \(u,x^{\prime \prime }\)-path. Analogously, if \(v_y > 1\) and \(v_x \not \in \{2k+2, 2k+3k\}\), we can always find an M-free shortest \(v,(2k+2, 1)\)- and \(v,(2k+3, 0)\)-path. It follows that we can construct an an M-free shortest uv-path for every uv that satisfy the above conditions.

If \(u_y = 3k + 1\) or \(u_y = 3k\) and \(u_x = {3 k \over 2}\), then \(v_y > 0\) since the vertices of \(M \cap C_{3k+2}^i \) are pairwise at distance either \(k+1\) or k. Thus, there exists an M-free shortest uv-path that contains \((2k+2, 1)\). Analogously, if \(v_y = 0\) or \(v_y = 1\) and \(v_x = {k \over 2} + 1\), then \(u_y < 3k+1\) since the vertices of \(M \cap ^{\,\,j}{\!\!C_{3k+2}}\) are pairwise at distance \(k+3\), k or \(k-1\). Thus, there exists an M-free shortest uv-path that contains \((2k+1,3k)\).

Finally, if \(u_y = 3k\) and \(u_x = {3 k \over 2}\) then we can an find an M-free shortest \(u,x^{\prime }\)- and \(u,x^{\prime \prime }\)-path, while for \(v_y = 1\) and \(v_x = {5k \over 2}+3\) we can find an M-free shortest \(v,y^{\prime }\)- and \(v,v^{\prime \prime }\)-path. It follows that we can construct an M-free shortest uv-path for this selection of u and v.

The above discussion shows that there exists an M-free shortest uv-path for every \(u,v \in M\) where \(u_x \le 2k+1\). The proof for \(u_x \ge 2k+2\) is analogous.

Since for every \(u, v \in M\), where either \(\{ (0,0), (3k+1,3k+1) \} \subseteq I(u,v)\) or \(\{ (k+1,0), (k,3k+1) \} \subseteq I(u,v)\), we can establish in a similar fashion that there exists an M-free shortest uv-path in \(C_t \Box C_t\), the proof is complete. \(\square \)

Proposition 3.7

Let \(t\equiv 4 \) (mod 6). If \(t \ge 22\), then \(\mu (C_t \Box C_t) = 3t\).

Proof

Since \(\mu (C_t \Box C_t) \le 3t\) by Proposition 3.1, we have to show that a mutual-visibility set of cardinality 3t exists for every \(t \equiv 4\) (mod 6).

Let \(t=3k+1\), for an odd k. Let \(M = \{((i + j k) \, \textrm{mod} \, (3k+1)), 2i) \, | \, i \in [{3k+1 \over 2}]_0, j\in [3]_0 \} \cup \{((i + {3k+1 \over 2} + j k) \, \textrm{mod} \, (3k+1)), 2i+1) \, | \, i \in [{3k+1 \over 2}]_0, j\in [3]_0 \}\). For \(k=6\) the construction is depicted on the right-hand side of Fig. 6.

We can see that \(M = \{(i, 2i) \, | \, i \in [k]_0 \} \cup \{(i, 2i + k +2) \, | \, i \in [k]_0 \} \cup \{(i, (2i + 2k +2) \, \textrm{mod} \, 3k ) \, | \, i \in [k]_0 \} \cup \{(i+k, 2i) \, | \, i \in [k]_0 \} \cup \{(i +k, 2i + k +2) \, | \, i \in [k]_0 \} \cup \{(i + k, (2i + 2k) \, \textrm{mod} \, 3k) \, | \, i \in [k]_0 \} \cup \{(i + 2k, 2i) \, | \, i \in [k+1]_0 \} \cup \{( i +2k, 2i + k) \, | \, i \in [k+1]_0 \} \cup \{( i + 2k, (2i + 2k) \, \textrm{mod} \, 3k) \, | \, i \in [k+1]_0 \} \). It follows that the distance between vertices of \(M \cap ^{\,\,j}{\!\!C_{3k+2}}\) is either \(k-1\), k or \(k+2\), while the vertices of \(M \cap C_{3k+1}^i \) are pairwise at distance either \(k+1\) or k. Thus, using the same arguments as in the proof of Proposition 3.2 we can establish that M satisfies conditions (i), (ii), and (iii) of Lemma 1.2.

Note that M admits three cross pairs: \(\{(0,0), (3k+1,3k+1)\}\), \(\{(k,0), (k-1,3k+1)\}\) and \(\{(2k,0), (2k-1,3k+1)\}\). Analogously as in the proof of Proposition 3.6, we can now prove that for every \(u,v \in M\) there exists an M-free shortest uv-path in \(C_t \Box C_t\). \(\square \)

Fig. 6
figure 6

Mutual-visibility set of \(C_{20} \Box C_{20}\) (left) and \(C_{22} \Box C_{22}\) (right)

Theorem 3.8

Let \(t \ge 14\) or \(t=12\). If \(s \ge t\), then \(\mu (C_s \Box C_t) = 3t\).

Proof

Let \(t \equiv 3\) (mod 6). If \(s=t\), this is Proposition 3.2. Since the upper bound is given by Proposition 3.1, we have to show that there exists a mutual-visibility set of cardinality 3t for every \(s>t\).

Let \(M = \{((2i + jk) \, \textrm{mod} \, 3k, i) \, | \, i \in [3k]_0, j\in [3]_0 \}\). Remind that M is a mutual-visibility set of cardinality 3t in \(C_t \Box C_t\) if \(t \equiv 3\) (mod 6).

For \(i \in [3k]\), let \(S_i = \{ (j \, \textrm{mod} \, 3) k + (\lfloor { j \over 3} \rfloor \, \textrm{mod} \, k) \, | \, 0 \le j < i \}\). Note that \(S_i \subseteq [3k]_0\). Moreover, elements of \(S_i\) are uniformly distributed among sets \([k]_0\), \([k,2k-1]\) and \([2k,3k-1]\), i.e., each of the sets \([k]_0\), \([k,2k-1]\) and \([2k,3k-1]\) contains either \(\lfloor { i \over 3} \rfloor \) or \(\lfloor { i \over 3} \rfloor + 1 \) elements from \(S_i\). For a set \(S \subseteq [3k]_0\), let the function \(\delta _S: [3k]_0 \rightarrow [3k]_0\) be defined by \(\delta _S(i) = |\{ j \, | \, j \in S \, \textrm{and } \, j < i \}|\). Moreover, let \(M_i = \{ (u_x + \delta _{S_i}(u_x), u_y) \, | \, u \in M \}\). In other words, a vertex of \(M_i\) is obtained from \(u \in M\) by shifting its first coordinate by \(\delta _{S_i}(u_x)\) positions. Note that \(M_i\) is a subset of \(C_{t+i} \Box C_{t}\) of cardinality 3t.

Loosely speaking, we can say that \(M_i\) is obtained from M by inserting i empty \(C_{3k}\)-fibers. To show that \(M_i\) is a mutual-visibility set in \(C_{t+i} \Box C_{t}\), first note that condition (iv) of Lemma 1.2 clearly holds. For conditions (i)-(iii) we apply the fact that elements of \(S_i\) are uniformly distributed among sets \([k]_0\), \([k,2k-1]\) and \([2k,3k-1]\). Since for every \(j \in [k]_0\) and every \(u,v \in M \cap ^{\,\,j}{\!\!C_{s}}\) we have \(d_{C_t \Box C_{t}}(u,v) = k\), it follows that for \(u,v \in M_i \cap ^{\,\,j}{\!\!C_{s+i}}\) it holds that either \(d_{C_{t+i} \Box C_{t}}(u,v) = k+\lfloor { i \over 3} \rfloor \) or \(d_{C_{t+i} \Box C_{t}}(u,v) = k+\lfloor { i \over 3} \rfloor + 1\). Since for every \(z,w \in V(C_{ 3k} \Box C_{3k})\) we have \(d(z_x,w_x) \le {3k + i \over 2}\), conditions (i)–(iii) of Lemma 1.2 are also fullfiled. Thus, \(M_i\) is a mutual-visibility set in \(C_{t+i} \Box C_{t}\) for \(i \in [3k]\). In order to obtain a mutual-visibility set in \(C_{t+i} \Box C_{t}\) for \(i > 3k\), we consecutively apply the above procedure for \(M=M_{2t}\), \(M=M_{3t}, \ldots \)

Table 2 Mutual-visibility numbers of \(C_s \Box C_t\), where \(t \le 13\)

For other five cases, i.e. if \(t \equiv r\) (mod 6), where \(r \in \{0, 1, 2, 4, 5 \}\), the proof is analogous. We start with the mutual-visibility set M of cardinality 3t of \(C_t \Box C_t\) where \(t \equiv r\) (mod 6). Next, the sets \(S_i\) are defined for every \(i \in [t]\). Finally, the sets \(M_i\) are determined for every \(i \in [t]\). In particular,

  • for \(t \equiv 0\) (mod 6), we set \(M = \{((i + j k, 2i + \ell k) \, | \, i \in [{k \over 2}]_0, j, \ell \in [3]_0 \} \cup \{(k-i-1+jk, (2i + 3 + \ell k ) \, \textrm{mod} \, 3k) \, | \, i \in [{k \over 2}]_0, j, \ell \in [3]_0 \}\) and for \(i \in [3k]\), we set \(S_i = \{ (j \, \textrm{mod} \, 3) k + (\lfloor { j \over 3} \rfloor \, \textrm{mod} \, k) \, | \, 0 \le j < i \}\);

  • for \(t \equiv 5\) (mod 6), then we set \(M = \{(i + j (k+1) \, \textrm{mod} \, (3k+2)), 2i ) \, | \, i \in [{3k+3 \over 2}]_0, j\in [3]_0 \} \cup \{(( i + {3k+3 \over 2} + j (k+1) \, \textrm{mod} \, (3k+2)), 2i+1) \, | \, i \in [{3k+1 \over 2}]_0, j\in [3]_0 \}\) and for \(i \in [3k+2]\) we set \(S_i = \{ (j \, \textrm{mod} \, 3) (k+1) + (\lfloor { j \over 3} \rfloor \, \textrm{mod} \, (k+1) ) \, | \, 0 \le j < i \}\);

  • for \(t \equiv 1\) (mod 6), let \(M = \{((i + j k) \, \textrm{mod} \, (3k+1)),2i) \, | \, i \in [{3k+2 \over 2}]_0, j\in [3]_0 \} \cup \{( (i + {3k+2 \over 2} + j k) \, \textrm{mod} \, (3k+1)), 2i+1) \, | \, i \in [{3k \over 2}]_0, j\in [3]_0 \}\) and for \(i \in [3k]\), let \(S_i = \{ (j \, \textrm{mod} \, 3) k + (\lfloor { j \over 3} \rfloor \, \textrm{mod} \, k) \, | \, 0 \le j < i \}\) and \(S_{3k+1} =[3k+1]_0\);

  • for \(t \equiv 2\) (mod 6), let \(M = \{((i + j (k+1)) \, \textrm{mod} \, (3k+2), 2i) \, | \, i \in [{3k+2 \over 2}]_0, j\in [3]_0 \} \cup \{ ((i + {3k +2 \over 2} + j (k+1)) \, \textrm{mod} \, (3k+2), 2i+1)) \, | \, i \in [{3k+2 \over 2}]_0, j\in [3]_0 \}\) and for \(i \in [3k+2]\), let \(S_i = \{ (j \, \textrm{mod} \, 3) (k+1) + (\lfloor { j \over 3} \rfloor \, \textrm{mod} \, (k+1) ) \, | \, 0 \le j < i \}\);

  • for \(t \equiv 4\) (mod 6), let \(M = \{((i + j k) \, \textrm{mod} \, (3k+1)), 2i) \, | \, i \in [{3k+1 \over 2}]_0, j\in [3]_0 \} \cup \{((i + {3k+1 \over 2} + j k) \, \textrm{mod} \, (3k+1)), 2i+1) \, | \, i \in [{3k+1 \over 2}]_0, j\in [3]_0 \}\) and for \(i \in [3k]\), let \(S_i = \{ (j \, \textrm{mod} \, 3) k + (\lfloor { j \over 3} \rfloor \, \textrm{mod} \, k) \, | \, 0 \le j < i \}\) and \(S_{3k+1} =[3k+1]_0\).

We are left to show that \(C_s \Box C_t\) admits a mutual-visibility set of cardinality 3t, if \(t \in \{12, 14, 16 \}\) and \(s \ge t\).

If \(t=12\), we found a mutual-visibility set of cardinality 3t for every \(s \in \{12, 13, 14, 15, 16, 17, 18 \}\). Moreover, a mutual-visibility set for \(C_{18} \Box C_{12}\) can be applied in \(C_{s} \Box C_{12}\) for every \(s > 18\) analogously as in the proof for \(t \equiv 3\) (mod 6).

If \(t=14\), we found a mutual-visibility set of cardinality 3t for every \(s \in \{14, 15, 16, 17, 18, 19, 20 \}\). Moreover, a mutual-visibility set for \(C_{20} \Box C_{14}\) can be applied in \(C_{s} \Box C_{14}\) for every \(s > 20\) analogously as in the proof for \(t \equiv 2\) (mod 6).

If \(t=16\), we found a mutual-visibility set of cardinality 3t for every \(s \in \{16, 17, 18 \}\). Moreover, a mutual-visibility set for \(C_{18} \Box C_{16}\) can be applied in \(C_{s} \Box C_{16}\) for every \(s > 20\) analogously as in the proof for \(t \equiv 3\) (mod 6).

The above-mentioned constructions are available on the web page

https://omr.fnm.um.si/wp-content/uploads/2023/08/MVS-constructions-for-two-cycles.txt.

Since the presented solutions comprise all graphs of interest, the proof is complete. \(\square \)

The next proposition shows that even for smaller t it holds that \(\mu (C_s \Box C_t) = 3t\) providing that s is big enough.

Proposition 3.9

Let \((s_r, t) \in \{ (6, 3), (8,4), (8,5), (9,6), (12,7), (12,8), (12,9), \) \((12,10), (13,11), (14, 13) \}\). If \(s \ge s_r\), then \(\mu (C_s \Box C_t) = 3t\).

Proof

The proof is based on the constructions of mutual-visibility sets for the graphs of interest that are available on the web page https://omr.fnm.um.si/wp-content/uploads/2023/08/MVS-constructions-for-two-cycles.txt.

We do not give the details here since the reasoning is analogous for all values of t. As an example, we consider the case \(t=3\). We found a mutual-visibility set with 9 vertices of \(C_s \Box C_3\) for every \(s \in [6,18]\). Moreover, we can apply the construction for \(C_{18} \Box C_3\) in a similar manner to the case \(t \equiv 3\) (mod 6) in the proof of Theorem 3.8. \(\square \)

Remark 3.10

Mutual-visibility numbers of \(C_s \Box C_t\), for \(t \le 13 \) are presented in Table 2, where the symbol \(-\text {''}-\) represents the repeated last value in the corresponding row. The majority of the results were obtained using a computer, especially through backtracking. Note that the last mutual-visibility number in a row that corresponds to some t always equals 3t.

4 Conclusions

This paper expands upon previous research on the mutual-visibility number in Cartesian products by investigating mutual-visibility sets within two graph families: Cartesian products of a cycle and a path, as well as Cartesian products of two cycles.

In the first part, the paper addresses the mutual-visibility set problem in Cartesian products of a path and a cycle. It is demonstrated that, for most graphs in this category, the mutual-visibility number is twice the length of the cycle. However, unresolved cases remain where the length of the paths is less than the length of the cycle subtracted by one. Based on computer-generated results, we conjecture that, for the majority of cases, the mutual-visibility number equals the upper bound on this number.

The part of the paper delves into the mutual-visibility number of Cartesian products of two cycles, presenting exact values for all graphs in this class. Particularly, it is established that the largest mutual-visibility set of \(C_s \Box C_t\), where \(s \ge t\), has a cardinality of 3t if t is sufficiently large.

In addition to the aforementioned conjecture, further exploration of this invariant in other families of Cartesian products, such as products of three or more factor graphs (e.g., paths and cycles), would be an intriguing avenue for future research.