1 Introduction

All graphs considered in this paper are simple finite graphs. Given a graph \(G\), we denote its order by \(|G|=n\), its vertex set by \(V(G)\) and the edge set by \(E(G)\). The neighborhood \(N(x)\) of a vertex \(x\) is the set of vertices adjacent to \(x\), and the degree \(d(x)\) of \(x\) is \(|N(x)|\), the size of the neighborhood of \(x\).

Let \(w(x)=\sum _{y\in N_G(x)}l(y)\) for every \(x \in V(G)\).

A distance magic labeling (also called sigma labeling) of a graph \(G=(V,E)\) of order \(n\) is a bijection \(l :V \rightarrow \{1, 2,\ldots , n\}\) with the property that there is a positive integer \(k\) (called magic constant) such that \(w(x) = k\) for every \(x \in V\). If a graph \(G\) admits a distance magic labeling, then we say that \(G\) is a distance magic graph (see [13]).

The concept of distance magic labeling has been motivated by the construction of magic squares. Finding a distance magic labeling of an \(r\)-regular graph turns out to be equivalent to finding equalized incomplete tournament \(\mathrm {EIT}(n, r)\) [4]. In an equalized incomplete tournament \(\mathrm {EIT}(n, r)\) of \(n\) teams with \(r\) rounds, each team plays with exactly \(r\) other teams and the total strength of the opponents that team \(i\) plays is \(k\). Thus, it is easy to observe that finding an \(\mathrm {EIT}(n, r)\) is the same as finding a distance magic labeling of any \(r\)-regular graph on \(n\) vertices. For a survey, we refer the reader to [2].

The following observations were independently proved:

Observation 1.1

([810, 13]) Let \(G\) be an \(r\)-regular distance magic graph on \(n\) vertices. Then \(k = \frac{r(n+1)}{2}\).

Observation 1.2

([810, 13]) No \(r\)-regular graph with \(r\)-odd can be a distance magic graph.

The problem of distance magic labeling of \(r\)-regular graphs was studied recently (see [14, 9, 11]). It is interesting that if you blow up an \(r\)-regular \(G\) graph into some specific \(p\)-regular graph, then the obtained graph \(H\) is distance magic. More formally, we have the following definition.

Definition 1.3

([7], p. 185) The lexicographic product \(G\circ H\) of two graphs \(G\) and \(H\) is defined on \(V(G\circ H)=V(G)\times V(H)\), two vertices \((u,x),(v,y)\) of \(G\circ H\) being adjacent whenever \(uv\in E(G)\), or \(u=v\) and \(xy\in E(H)\).

\(G\circ H\) is also called the composition of graphs \(G\) and \(H\) and denoted by \(G[H]\) (see [6]).

Miller at al. [9] proved the following results.

Theorem 1.4

([9]) The cycle \(C_n\) of length \(n\) is a distance magic graph if and only if \(n = 4\).

Theorem 1.5

([9]) Let \(r \ge 1\), \(n \ge 3\), \(G\) be an \(r\)-regular graph and \(C_n\) the cycle of length \(n\). Then \(G\circ C_n\) admits a distance magic labeling if and only if \(n = 4\).

Theorem 1.6

([9]) Let \(G\) be an arbitrary regular graph. Then \(G\circ \overline{K}_n\) is distance magic for any even \(n\).

Shafiq et al. [12] considered distance magic labeling for disconnected graphs and obtained the following theorems.

Theorem 1.7

([12]) Let \(m \ge 1\), \(n\ge 2\) and \(p \ge 3\). Then \(mC_p\circ K_n\) has a distance magic labeling if and only if either \(n\) is even or \(mnp\) is odd or \(n\) is odd and \(p \equiv 0 (\mathrm{mod}~4)\).

The following problem was posted in [2].

Proposition 1.8

([2]) If \(G\) is non-regular graph, determine if there is a distance magic labeling of \(G\circ C_4\).

The Dutch Windmill Graph \(C_3^{(t)}\), also called a friendship graph, is the graph obtained by taking \(t>1\) copies of the cycle graph \(C_3\) with a vertex in common [5]. We show that the product \(C_3^{(t)}\circ C_4\) is not distance magic for any \(t>1\).

The paper is organized as follows. In the next section we focus on the products of complete bipartite graphs and cycle \(C_4\). In the third section we prove that the product of the Dutch Windmill Graph and the cycle \(C_4\) cannot be distance magic.

2 The Product \(K_{m,n}\circ C_4\)

Let \(K_{m,n}\) have the vertex partite sets \(A\!=\!\!\{x_0, x_1,\ldots ,x_{n-1}\}\) and \(B\!\!=\!\{y_0,y_1,\ldots ,y_{m-1}\}\). Let \(C_4=v^0v^1v^2v^3v^0\) and \(H=K_{m,n}\circ C_4\). For \(0\le i \le n-1\) and \(j=0,1,2,3\), let \(x_i^j\) be the vertices of \(H\) that replace \(x_i\) in \(A\). For \(0\le i \le m-1\) and \(j=0,1,2,3\), let \(y_i^j\) be the vertices of \(H\) that replace \(y_i\) in \(B\). Let \(A[C_4]=\{x_i^j: i=0,1,\ldots ,n-1,j=0,1,2,3, x_i\in A\}\) and \(B[C_4]=\{y_i^j: i=0,1,\ldots ,m-1,j=0,1,2,3, y_i\in B\}\).

The following Lemma holds true.

Lemma 2.1

If \(H=K_{m,n}\circ C_4\), where \(1\le m<n\) is a distance magic graph and \(k\) is the magic constant, then the following conditions hold:

  1. (1)

    \(l(x_i^0)+l(x_i^2)=l(x_i^1)+l(x_i^3)=a \quad \) for some constant \(a\) for all    \(0 \le i\le n-1\) and \(l(y_i^0)+l(y_i^2)=l(y_i^1)+l(y_i^3)=b\)    for some constant \(b\) for all    \(0 \le i\le m-1\),

  2. (2)

    \(b+2an=a+2mb=k\)    and    \(a<b\),

  3. (3)

    \(bm+an=(m+n)(4m+4n+1)\),

Proof

(1)

Notice that: \(w(x_i^j)=l(x_i^{j+1})+l(x_i^{j+3})+\sum _{i=1}^m\sum _{j=1}^4{l(y_i^j)}\) for all \(0 \le i\le n-1\), \(j=0,1,2,3\), where the addition in the superscripts is performed modulo \(4\). Since the graph \(H\) is distance magic we obtain that \(l(x_i^0)+l(x_i^2)=l(x_i^1)+l(x_i^3)=a\) for some constant \(a\) for all \(0 \le i\le n-1\). Similarly \(l(y_i^0)+l(y_i^2)=l(y_i^1)+l(y_i^3)=b\) for some constant \(b\) for all \(0 \le i\le m-1\).

(2) Fact (1) implies that \(w(x_i^j)=a+2bm\) for all \(0 \le i\le n-1\), \(j=0,1,2,3\) and \(w(y_i^j)=b+2an\) for all \(0 \le i\le m-1\), \(j=0,1,2,3\). As \(m<n\), this implies that \(a<b\).

(3) The labeling \(l\) is a bijection, so the sum of all labels has to be equal to \(\sum _{i=1}^{4m+4n}{i}\):

$$\begin{aligned} 2an+2bm=\frac{(4m+4n)(4m+4n+1)}{2}. \end{aligned}$$

\(\square \)

The following theorem completely characterizes the pairs \((m,n)\), for which \(K_{m,n}\circ C_4\) is distance magic.

Theorem 2.2

Let \(m\) and \(n\) be integers such that \(1\le m<n\). Then \(K_{m,n}\circ C_4\) is distance magic if and only if the following conditions hold.

  1. (1)

    The numbers

    $$\begin{aligned} a=\frac{(m+n)(4m+4n+1)(2m-1)}{4mn-m-n} \end{aligned}$$

    and

    $$\begin{aligned} b=\frac{(m+n)(4m+4n+1)(2n-1)}{4mn-m-n} \end{aligned}$$

    are integers.

  2. (2)

    There exist integers \(p,q,t\ge 1\), such that

    $$\begin{aligned}&p+q=b-a,\\&4n=pt,\\&4m=qt. \end{aligned}$$

Proof

First, let us assume that for given \(m\) and \(n\), \(1\le m<n\) there exist \(a\), \(b\), \(p\), \(q\) and \(t\) with desired properties. Then the following labeling is distance-magic: If \(t=4s\) for some integer \(s\), then let

$$\begin{aligned} l(x_{kp+i}^j)=\left\{ \begin{array}{lll} k(2p+2q)+i+1 &{}\quad \mathrm {for}\quad &{} j=0 \\ k(2p+2q)+p+q+i+1 &{}\quad \mathrm {for}\quad &{} j=1, \\ a-f(x_{kp+i}^{j-2}) &{}\quad \mathrm {for}\quad &{} j=2,3, \end{array}\right. \end{aligned}$$

for \(0\le k\le t/4-1,i=0,1,\ldots ,p-1\),

$$\begin{aligned} l(y_{kq+i}^j)=\left\{ \begin{array}{lll} k(2p+2q)+p+i+1 &{}\quad \mathrm {for}\quad &{} j=0, \\ k(2p+2q)+2p+q+i+1 &{}\quad \mathrm {for}\quad &{} j=1, \\ b-f(y_{kq+i}^{j-2}) &{}\quad \mathrm {for}\quad &{} j=2,3. \end{array}\right. \end{aligned}$$

for \(0\le k\le t/4-1,i=0,1,\ldots ,q-1\). Observe that the sets of labels of vertices \(x_i^j\) and \(y_i^j\) for \(j=0,1\) do not intersect and their elements are consecutive numbers from the set \(\{1,\dots ,2(m+n)\}\). And as \(b-a=p+q\), also the sets of labels for \(j=2,3\) do not intersect and they are consecutive numbers from the set \(\{a-(2m+2n)+q,\dots , a+q-1=b-p-1\}\). In order to prove that \(l\) is a bijection it is enough to show that \(a+q-1=4m+4n\). It is true, as we have:

$$\begin{aligned} a(n+m)+(b-a)m=an+bm=(m+n)(4m+4n+1). \end{aligned}$$

But on the other hand,

$$\begin{aligned} (b-a)m=(p+q)m=\frac{4(m+n)m}{t}=(m+n)q, \end{aligned}$$

so finally

$$\begin{aligned} a(n+m)+(m+n)q=(m+n)(4m+4n+1) \end{aligned}$$

and \(a+q=4m+4n+1\).

If \(t\not \equiv 0(\mathrm{mod}~4)\), then \(p\) and \(q\) are even. In such a situation, let

$$\begin{aligned} l(x_{kp/2+i}^j)=\left\{ \begin{array}{lll} k(p+q)+2i+j+1 &{}\quad \mathrm {for}\quad &{} j=0,1, \\ a-f(x_{kp/2+i}^{j-2}) &{}\quad \mathrm {for}\quad &{} j=2,3, \end{array}\right. \end{aligned}$$

for \(0\le k\le \lfloor {t/2}\rfloor -1,i=0,1,\ldots ,p/2-1\), and for \(k=\lfloor {t/2}\rfloor =\lceil {t/2}\rceil -1,i=0,1,\ldots ,p/4-1\),

$$\begin{aligned} l(y_{kq/2+i}^j)=\left\{ \begin{array}{lll} k(p+q)+p+2i+j+1 &{}\quad \mathrm {for}\quad &{} j=0,1, \\ b-f(y_{kq/2+i}^{j-2}) &{}\quad \mathrm {for}\quad &{} j=2,3, \end{array}\right. \end{aligned}$$

for \(0\le k\le \lfloor {t/2}\rfloor -1,i=0,1,\ldots ,q/2-1\), and

$$\begin{aligned} l(y_{kq/2+i}^j)=\left\{ \begin{array}{lll} k(p+q)+p/2+2i+j+1 &{}\quad \mathrm {for}\quad &{} j=0,1, \\ b-f(y_{kq/2+i}^{j-2}) &{}\quad \mathrm {for}\quad &{} j=2,3, \end{array}\right. \end{aligned}$$

for \(k=\lfloor {t/2}\rfloor =\lceil {t/2}\rceil -1,i=0,1,\ldots ,q/4-1\) (observe that in both cases the last range is in use if and only if \(t\) is odd and thus \(p\) and \(q\) are divisible by \(4\)). Also in this case it is straightforward to see that the above labeling is bijective and that in both cases the magic constant equals to \(k=a+2mb=b+2na\).

Now, let us assume that \(K_{m,n}\circ C_4\) is distance magic for some integers \(m\) and \(n\), \(1\le m<n\). Let the magic constant be \(k\). From the Lemma 2.1 it follows that the following system of equations must be satisfied:

$$\begin{aligned} \left\{ \begin{array}{l} b+2an=a+2mb,\\ bm+an=(m+n)(4m+4n+1). \end{array} \right. \end{aligned}$$

The above system has only one solution with respect to \(a\) and \(b\):

$$\begin{aligned} \left\{ \begin{array}{l} a=\frac{(m+n)(4m+4n+1)(2m-1)}{4mn-m-n},\\ b=\frac{(m+n)(4m+4n+1)(2n-1)}{4mn-m-n}. \end{array} \right. \end{aligned}$$

Obviously, \(a\) and \(b\) must be integers.

Now we choose any distance magic labeling \(l\) of \(K_{m,n}\circ C_4\). Let \(L_A=\{l(x)|x\in A[C_4]\}\) and \(L_B=\{l(y)|y\in B[C_4]\}\). Let us divide the set of all labels \(\{1,2,\dots , 4m+4n\}\) into intervals in the following way:

  1. (i)

    for each interval \(I\), either \(I\subseteq L_A\) or \(I\subseteq L_B\),

  2. (ii)

    each interval is maximal, i.e., for any two neighboring intervals \(I_1,I_2\) we have either \(I_1\subseteq L_A\) and \(I_2\subseteq L_B\) or \(I_1\subseteq L_B\) and \(I_2\subseteq L_A\).

In the remainder we will use the notation \(I_1<I_2\Leftrightarrow \max \{l(x)|l(x)\in I_1\}<\min \{l(y)|l(y)\in I_2\}\). For any interval \(I\) and integer \(c\), let \(c-I=\{c-l(x)|l(x)\in I\}\) (it is possible that \(c-I=I\)). From the Lemma 2.1 it follows that for each \(x\in \{1,2,\dots , 4m+4n\}\), \(l(x)\in L_A\Leftrightarrow a-l(x)\in L_A\) (in fact, \(l(x_i^j)=a-l(x_i^{j+2})\), where the addition in the superscripts is performed modulo \(4\)). Similarly, \(l(x)\in L_B\Leftrightarrow b-l(x)\in L_B\). This implies that \(a-I\subseteq L_A\Leftrightarrow I\subseteq L_A\) and \(b-I\subseteq L_B\Leftrightarrow I\subseteq L_B\). Also, if \(I_1,I_2\subseteq L_A\) and \(I_1<I_2\) then \(a-I_2<a-I_1\). Similarly, if \(I_1,I_2\subseteq L_B\) and \(I_1<I_2\) then \(b-I_2<b-I_1\).

Let the first two intervals be \(I_1=\{1,\dots ,r\}\) and \(I_2=\{r+1,\dots ,r+s\}\) for some \(r,s\ge 1\).

Observe first that \(I_1\subseteq L_A\) and \(I_2\subseteq L_B\). Otherwise we would have \(b-I_1=\{b-r,\dots ,b-1\}\) and \(a-I_2=\{a-r-s,\dots ,a-r-1\}<b-I_1\). Moreover, as \(a-r-1<b-r-1\), this would imply that there is an interval \(I\in L_A\), \(a-I_2<I\) and thus \(a-I<I_2\), a contradiction (\(I_2\) is the first interval being subset of \(L_A\)).

We have \(a-I_1=\{a-r,\dots ,a-1\}\) and \(b-I_2=\{b-r-s,\dots ,b-r-1\}\). As \(\min \{l(x)|l(x)\in a-I_1\}-1=a-r-1<b-r-1=\max \{l(y)|l(y)\in b-I_2\}\) and the intervals \(a-I_1\) and \(b-I_2\) are disjoint, it follows that \(a-I_1<b-I_2\). Moreover there is no integer \(u\) such that \(a-1<u<b-r-s\), as it would mean that there is an interval \(I\subseteq L_A\), \(a-I_1<I\) and thus \(a-I<I_1\), a contradiction. Thus the intervals \(a-I_1\) and \(b-I_2\) consist of \(r+s\) consecutive integers. Moreover, the first entry \(b-r-s\) of \(b-I_2\) follows immediately after the last entry of \(a-I_1\), which is \(a-1\). Hence, we have \(b-r-s=a\) and thus \(r+s=b-a\). Observe also that the intervals \(a-I_1\) and \(b-I_2\) are the last ones contained in \(L_A\) and \(L_B\) respectively.

If \(r+s=4m+4n\), this proves the hypothesis (\(r=4n\), \(s=4m\), so \(t=1\), \(p=r/2\), \(q=s/2\)). Otherwise let us assume that we are given \(d\ge 1\) pairs of intervals \((I_1^i,I_2^i)\), \(i=1,\dots ,d\), such that \(I_1^i\subseteq L_A\), \(I_2^i\subseteq L_B\), \(a-I_1^i\subseteq L_A\), \(b-I_2^i\subseteq L_B\), \(|I_1^i|=r\), \(|I_2^i|=s\), \(I_1^i<I_2^i\), \(a-I_1^i<b-I_2^i\) for \(i=1,\dots ,d\) and \(I_1^i<I_1^{i+1}\), \(I_2^i<I_2^{i+1}\), \(a-I_1^{i+1}<a-I_j^i\), \(b-I_2^{i+1}<b-I_2^i\) for \(i=1,\dots ,d-1\). Moreover, let us assume that there are no elements \(u<\max \{l(y)|l(y)\in I_2^d\}\), \(u\not \in \bigcup _{i=1}^{d}{(I_1^i\cup I_2^i)}\) and no elements \(v>\max \{l(x)|l(x)\in a-I_1^d\}\), \(v\not \in \bigcup _{i=1}^{d}{(a-I_1^i\cup b-I_2^i)}\). We are going to prove that we are able to extend this sequence to \(d+1\) pairs of intervals.

Indeed, let us assume, that next two intervals are \(I_1=\{d(r+s)+1,\dots ,d(r+s)+r_1\}\) and \(I_2=\{d(r+s)+r_1+1,\dots ,d(r+s)+r_1+s_1\}\) for some \(r_1,s_1\ge 1\). Obviously \(I_1\subseteq L_A\) and \(I_2\subseteq L_B\). Moreover we have \(a-I_1=\{a-d(r+s)-r_1,\dots ,a-d(r+s)-1\}\) and \(b-I_2=\{b-d(r+s)-r_1-s_1,\dots ,b-d(r+s)-r_1-1\}\). As \(\min \{l(x)|l(x)\in a-I_1\}-1<\max \{l(y)|l(y)\in b-I_2\}\), it follows that \(a-I_1<b-I_2\). Moreover there is no integer \(u\) between \(a-I_1\) and \(b-I_2\), as there is no interval \(I\subseteq L_A\), \(a-I_1<I\), \(I\not \in \{I_1^1,\dots ,I_1^d\}\). Thus the intervals \(a-I_1\) and \(b-I_2\) consist of \(r+s\) consecutive integers. Thus \(a-d(r+s)-1=b-d(r+s)-r_1-s_1-1\) and in consequence \(r_1+s_1=b-a\). Similar reasoning leads us to the conclusion that there are no elements between \(b-I_2\) and \(a-I_1^d\), so \(b-d(r+s)-r_1-1=a-(d-1)(r+s)-r-1\) and thus \(b-a=r_1+s\). This means that \(r_1=r\) and \(s_1=s\). Obviously the intervals \(a-I_1\) and \(b-I_2\) are the last ones contained in \(L_A\) and \(L_B\), that do not belong to \(\{I_1^1,\dots ,I_1^d\}\) and \(\{I_2^1,\dots ,I_2^d\}\), respectively.

By induction we obtain that we are able to construct such a sequence of pairs for every \(d\). As the number of pairs \((I_1^i,I_2^i)\) has to be finite, after some number of steps (say \(t\)) we exhaust all labels. Obviously

$$\begin{aligned} rt=\sum _{i=1}^{t}{|I_1^i|}=4n, \end{aligned}$$

and

$$\begin{aligned} st=\sum _{i=1}^{t}{|I_2^i|}=4m. \end{aligned}$$

Putting \(p=r\) and \(q=s\), we arrive at the hypothesis. \(\square \)

The pairs \((m,n)\) that satisfy the assumptions of the Theorem 2.2 are very rare. We checked all the pairs where \(1\le m<n\le 80000\) and only for the following ones the graphs \(K_{m,n}\circ C_4\) are distance magic: \((9,21)\), \((20,32)\), \((428,548)\), \((2328,2748)\), \((6408,10368)\), \((7592,8600)\), \((10098, 24378)\), \((18860,20840)\), \((39540,42972)\), \((73808,79268)\).

3 The Product \(C^{(t)}_3\circ C_4\)

Let \(C^{(t)}_3\) have the central vertex \(x\) and vertices \(x,y_i,z_i\) for \(i=1,\dots ,t\) belong to \(i\)th copy of cycle \(C_3\). Let \(C_4=v^0v^1v^2v^3v^0\) and \(H=C^{(t)}_3\circ C_4\). For \(0\le i \le t-1\) and \(j=0,1,2,3\), let \(y_i^j\), \(z_i^j\) be the vertices of \(H\) that replace \(y_i^j\), \(z_i^j\) \(0 \le i\le t-1\) in \(C^{(t)}_3\) and \(x^0,x^1,x^2,x^3\) be the vertices of \(H\) that replace \(x\).

Theorem 3.1

The graph \(C^{(t)}_3\circ C_4\) is not distance magic for any \(t>1\).

Proof

Suppose that \(l\) is a distance magic labeling of the graph \(H=C^{(t)}_3\circ C_4\) and \(k = w(x)\), for all vertices \(x\in V(H)\). It is easy to observe that there exist natural numbers \(b\), \(a^i_y\) and \(a^i_z\), \(0\le i \le t-1\), such that:

  • \(l(x^0)+l(x^{2})=l(x^1)+l(x{^3})=b\).

  • \(l(y_i^0)+l(y_i^{2})= l(y_i^1)+l(y_i^{3}) = a_y^i\) for \(0 \le i\le t-1\).

  • \(l(z_i^0)+l(z_i^{2})= l(z_i^1)+l(z_i^{3}) = a_z^i\) for \(0 \le i\le t-1\).

Since \(a_y^i+2a_z^i+2b=w(y_i^j)=w(z_i^j)=a_z^i+2a_y^i+2b\), we obtain that \(a_y^i=a_z^i=a^i\). This implies that for any \(0 \le i,l\le t-1\) and \(0 \le j,h\le 3\), \(3a^i+2b=w(z_i^j)=w(z_l^h)=3a^l+2b\), hence \(a^i=a^l=a\).

Since \(3a+2b=b+4ta=k\) and \(4ta+2b=1+2+\cdots +4(2t+1)\) we obtain that \(b=\frac{(2t+1)(4t-3)(8t+5)}{6t-3}\). Recall that the biggest label we can use is \(4(2t+1)\), hence \(b\le 16t+7\). One can calculate that the only positive integer \(t\) that satisfies the inequality

$$\begin{aligned} (2t+1)(4t-3)(8t+5)\le (16t+7)(6t-3) \end{aligned}$$

is \(t=1\), a contradiction. \(\square \)