Introduction

Let \(X=(V(X),E(X))\) be a connected graph. A vertex coloring with m colors is perfect if there is a matrix \(M=(\alpha _{ij})_{i,j=1,2,\ldots m}\) such that the cardinal of vertices of label j connected to a specified vertex of label i is equal to \(\alpha _{i,j}\).

In particular, all vertices of the same color in X have the same degree. This type of coloring gives a partition of V(X) that is called equitable partitions. These partitions of vertices have two properties as follows: The first property is that the vertices of each part \(P_i\) induce a regular graph, and the second is the edges between \(P_i\) and \(P_j\) induce a half-regular graph. In Section 3, we find the parameter matrices of a perfect 2-coloring. Equitable partitions were previously studied in [7].

In fact, the concept of a perfect m-coloring is bridge of among algebraic combinatorics, graph theory and coding theory (including 1-perfect codes). For the definition of 1-perfect codes and more details, we refer the reader to [1].

This type of coloring is generalized the concept of completely regular codes introduced by P. Delsarte ([8]).The problem for the Johnson graphs has been studied (see[4], see[3], see [6]).

In subsequent attempts, the problem of existence of perfect coloring was examined on other graphs. For example, Fon-Der-Flass settled perfect coloring with two colors of n-dimensional hypercube graphs \(Q_n\) for \(n<24\) (see [5]). In this paper, we will list all parameter matrices of perfect 2-coloring of the quartic graphs up to order 8.

Notations and preliminaries result on the existence of perfect coloring

In this section, some basic definitions that will be used in this paper are given and we declare some conditions for existence of perfect 2-coloring of the quartic graphs.

In this paper, all the graphs are simple. A graph \(X=(V(X),E(X))\) is k-regular if for every \(v\in V(X)\) we have deg\((v)=k\), where k is a nonnegative integer number. In particular, graphs that are regular of degrees 3, 4, 5 and 6 are called, respectively, cubic, quartic, quantic and sixtic.

In the following remark, we classify the quartic graphs with at most 8 vertices (see [9]).

Remark 1

The quartic graphs are divided into four classes based on their vertices. This classification is shown in Figs. 1, 2, 3 and 4. For simplicity, we name the vertices as shown in these figures.

Fig. 1
figure 1

Class 1: The quartic graph with 5 vertices

Fig. 2
figure 2

Class 2: The quartic graph with 6 vertices

Fig. 3
figure 3

Class 3: The quartic graph with 7 vertices

Fig. 4
figure 4

Class 4: The quartic graph with 8 vertices

We now introduce the concept of perfect coloring.

Definition 1

Let \(X=(V(X),E(X))\) be a connected graph. A perfect m-coloring with parameter matrix \(M=(\alpha _{ij})_{i,j=1,2,\ldots m}\) is a map C from V(X) to the set of colors \(\lbrace 1,2,\ldots ,m\rbrace \) such that C is surjective, and for a fix vertices v where \(C(v)=i\) we have \(\mid \{w\in V(X)\mid w\) is adjacent to v, \(C(w)=j\}\mid =\alpha _{ij}\), for all ij.

In this case, we say C is a P.m.C (or just P.C). Here, we study P.2.C, where two colors are red and blue.

In this case, we consider the parameter matrix of P.2.C generated by replacing the colors with the primary coloring is equal. This means the parameter matrix \(\begin{pmatrix} a &{} b \\ a' &{} b' \end{pmatrix}\) is equal to the parameter matrix \(\begin{pmatrix} b' &{} b \\ a' &{} a \end{pmatrix}\). We call equality of parameter matrix. Some properties of P.C have been studied recently (see [4, 6, 8]). The main result of them is the next proposition that enumerates the cardinal number of blue vertices in a P.2.C with matrix \(M=(\alpha _{ij})_{i,j=1,2}\) (see [3]).

Proposition 1

Assume thatBis the set of all blue vertices in aP.2.Cof a graph\(X=(V(X),E(X))\)with matrix\(\begin{pmatrix} a &{} b \\ a' &{} b' \end{pmatrix}\). Then we have

$$\begin{aligned} \mid B \mid =\frac{a' \mid V(X) \mid }{b+a'}. \end{aligned}$$
(1)

Now, the following remark provides useful information about calculationP.2.Cof the quartic graphs.

Remark 2

Suppose that \(X=(V(X),E(X))\) be a simple connected graph. Then necessary conditions for existence of P.2.C of X with parameter matrix \(M= \begin{pmatrix} a &{} b \\ a' &{} b' \end{pmatrix}\) are listed as follows:

1. Degree condition: This simple condition that results from the regularity of X tells us:

\(a+b=a'+b'=4\).

2. Connectedness condition: Since the graph X is connected, another condition is induced as follows:

\(b,a'\ne 0\).

We will define a new definition for the third condition. The number \(\mu \) is called an eigenvalue of a graphX, if \(\mu \) is an eigenvalue of the adjacency matrix of X. The number \(\mu \) is called an eigenvalue of aP.2.C with the matrix M, if \(\mu \) is an eigenvalue of M.

The next theorem gives us the third condition and the connection between two types of eigenvalues (see [4]):

Theorem 1

LetCbe aP.m.Cof a graphX. Thus any eigenvalues ofCare an eigenvalues ofX.

It has been proved that aP.2.Cof ak-regular graphXhas just two eigenvalues (see [4]).

Proposition 2

IfCbe aP.2.Cwith parameters matrix\(M=(\alpha _{i,j})_{i,j=1,2}\)of a regular graphXof valencyk, then the numbers\(\alpha _{11}- \alpha _{21}\)andkare eigenvalues ofCand therefore are eigenvalues ofX.

Lemma 1

Given an arbitrarily connected quartic graphX, the following ten matrices are the only matrices that can be selected asacceptableparameter matrices of a perfect 2-coloringC of X:

\({M_1=}\)\(\begin{pmatrix} {0} &{} {4} \\ {4} &{} {0}\\ \end{pmatrix}\) , \({M_2=}\)\(\begin{pmatrix} {0} &{} {4} \\ {3} &{} {1}\\ \end{pmatrix}\) , \({M_3=}\)\(\begin{pmatrix} {0} &{} {4} \\ {2} &{} {2}\\ \end{pmatrix}\) , \({M_4=}\)\(\begin{pmatrix} {0} &{} {4} \\ {1} &{} {3}\\ \end{pmatrix}\) , \({M_5=}\)\(\begin{pmatrix} {1} &{} {3} \\ {3} &{} {1}\\ \end{pmatrix}\)

\({M_6=}\)\(\begin{pmatrix} {1} &{} {3} \\ {2} &{} {2}\\ \end{pmatrix}\) , \({M_7=}\)\(\begin{pmatrix} {1} &{} {3} \\ {1} &{} {3}\\ \end{pmatrix}\) , \({M_8=}\)\(\begin{pmatrix} {2} &{} {2} \\ {2} &{} {2}\\ \end{pmatrix}\) , \({M_9=}\)\(\begin{pmatrix} {2} &{} {2} \\ {1} &{} {3}\\ \end{pmatrix}\)\({M_{10}=}\) , \(\begin{pmatrix} {3}&{}{1} \\ {1}&{}{3}\\ \end{pmatrix}\).

Proof

By Remark 2, Theorem 1, Proposition 2 and equality of parameter matrix, proof is clear. \(\square \)

Note that the word acceptable in the previous lemma states that some of the listed matrices may not be a parameter matrix of a P.2.C of X. Therefore, we reduce them by Proposition 1 in the next lemma (Tables 1, 2, 3, 4):

Lemma 2

LetXbe the quartic graph with at most 8 vertices. According to order ofX, we can reduce the listed parameter matrices in Lemma 1as follows:

Table 1 Acceptable parameter matrices of quartic graph with order 5
Table 2 Acceptable parameter matrices of quartic graph with order 6
Table 3 Acceptable parameter matrices of quartic graph with order 7
Table 4 Acceptable parameter matrices of quartic graph with order 8

Proof

Since the number of blue vertices (|B|) is not an integer, there is not exit a P.2.C of X with the given parameter matrix \(M_i\). \(\square \)

Corollary 1

IfXbe a connected quartic graph with at most 8 vertices, then only the matrices listed in the following table are acceptable as parameter matrices of aP.2.CofX (Table 5):

Table 5 Acceptable parameter matrices of quartic graph with at most order 8

Perfect 2-coloring of the quartic graphs with order at most 8

In the previous section, we determined all acceptable parameter matrices of a P.2.C of a connected quartic graph with at most 8 vertices. In this section, we show which of them have a structure. In the other words, we introduce a perfect 2-coloring C for them.

Lemma 3

Assume thatXbe a connectedk-regular graph. Then there are noP.2.Cwith parameter matrix\(M = \begin{pmatrix} a &{} b \\ a' &{} b'\\ \end{pmatrix}\)such that\(a=|B|\le k\).

Proof

Suppose, contrary to our claim, there is a P.2.C with presumed conditions. Let V be an arbitrary vertex with blue color. So, since \(a= k\), we conclude that all k vertices adjacent to v must be blue. This is in contradiction with \(|B|\le k\). \(\square \)

Corollary 2

There are noP.2.Cof\(Q_2\)with the matrices\(M_9\)and\(M_{10}\) .

Proof

From Lemma 2, we conclude that graph \(Q_2\) has the conditions of Lemma 3, So the proof is straightforward. \(\square \)

We will discuss about acceptability of matrix \(M_7\) is the following lemma:

Lemma 4

There are noP.2.Cof graphs\(Q_6\), \(Q_7\)and\(Q_8\)with matrix\(M_7\).

Proof

Suppose that there is a P.2.C of the graphs with \(M_7\). Note that both adjacent vertices of the graph \(Q_6\), \(Q_7\) and \(Q_8\) have a common vertex. On the other hand, from \(\alpha _{11}=1\) in \(M_7\), we obtain that there are two adjacent vertices with blue color. So, these two blue vertices have common red vertex. This is a contradiction with \(\alpha _{21}=1\). \(\square \)

Lemma 5

There are noP.2.Cof graphs\(Q_5\), \(Q_6\), \(Q_7\), \(Q_8\)and\(Q_9\)with the matrices\(M_1\)and\(M_{10}\) .

Proof

The proof of this lemma is similar to the proof of Lemma 4. \(\square \)

In the following, we will state the main result of this article. For this, we determine which class of the quartic graphs have a structure.

Theorem 2

Only parameter matrices ofP.2.Cof\(Q_1\)are\(M_4\)and\(M_6\) .

Proof

By Corollary 1, only matrices \(M_4\) and \(M_6\) are acceptable as parameter matrices of a P.2.C of \(Q_1\). Two mapping \(C_1\) and \(C_2\) determine two structures for \(Q_1\) with matrices \(M_4\) and \(M_6\), respectively, as follows:

\(C_1(\nu _1)=1 , C_1(\nu _2)=C_1(\nu _3)=C_1(\nu _4)=C_1(\nu _5)=2\), \(C_2(\nu _1)=C_2(\nu _2)=1 , C_2(\nu _3)= C_2(\nu _4)=C_2(\nu _5)=2\).

It is clear that \(C_1\) and \(C_2\) are P.2.C with matrices \(M_4\) and \(M_6\) , respectively. \(\square \)

Theorem 3

The parameter matrices ofP.2.Cof\(Q_2\)are\(M_3\)and\(M_8\).

Proof

From Corollary 1, we deduce that acceptable parameter matrices of \(Q_2\) are \(M_1\), \(M_3\), \(M_5\), \(M_8\), \(M_9\) and \(M_{10}\). We next show that only \(M_3\) and \(M_8\) have a structure. For this, let \(C_1\) and \(C_2\) be given by

\(C_1(\nu _1)=C_1(\nu _6)=1 , C_1(\nu _2)=C_1(\nu _3)=C_1(\nu _4)=C_1(\nu _5)=2\),

\(C_2(\nu _1)=C_2(\nu _3)=C_2(\nu _4)=1 , C_2(\nu _2)=C_2(\nu _5)=C_2(\nu _6)=2\).

It is obvious that the function \(C_1\) and \(C_2\) stats a P.2.C for \(Q_2\) with matrices \(M_3\) and \(M_8\), respectively. In the following, we prove that other matrices can not be as parameter matrices of \(Q_2\). First, we show that there is no P.2.C with the matrix \(M_1\) for the graph \(Q_2\). Contrary to our claim, suppose that C is a P.2.C of \(Q_2\) with the matrix \(M_1\) . There is no loss of generality in assuming \(C(\nu _1)=1\) . From \(M_1,\) we conclude that \(C(\nu _2)=C(\nu _3)=C(\nu _4)=C(\nu _5)=2\). Hence only one vertex remains, even if it is blue, in contradiction with the number of blue vertices \((|B|=3)\).

We have shown in Corollary 2 that there is no P.2.C of \(Q_2\) with the matrices \(M_9\) and \(M_{10}\).

Now we prove that there is no P.2.C of \(Q_2\) with the matrix \(M_5\). Suppose that there is a P.2.C of \(Q_2\) with the matrix \(M_5\), say C. From \(\alpha _{11}=1\), without loss of generality, we assume that \(C(\nu _1)=C(\nu _2)=1\) . Thus, from \(\alpha _{12}=3\), we have \(C(\nu _3)=C(\nu _4)=C(\nu _5)=C(\nu _6)=2\). In this case, the red vertex \(\nu _6\) is connected to the other three red vertices, which leads to a contradiction. \(\square \)

Theorem 4

Only the graph\(Q_4\)has aP.2.Cbetween the quartic graphs with 7 vertices.

Proof

According to Corollary 1, we see that only parameter matrix of \(Q_3\) and \(Q_4\) is \(M_2\). First, we give a structure for \(Q_4\) with matrix \(M_2\) by defining the function C as follows:

\(C(\nu _1)=C(\nu _2)=C(\nu _3)=C(\nu _4)=2 , C(\nu _5)=C(\nu _6)=C(\nu _7)=1\).

It is easy to check that C is a P.2.C of \(Q_4\) with matrix \(M_2\). Now we prove that there is no P.2.C with the matrix \(M_2\) for the graph \(Q_3\). Let C be a perfect 2-coloring of \(Q_3\) with the matrix \(M_2\). Let \(C(\nu _1)=1\). From \(\alpha _{12}=4\), we deduce that all vertices are red except for adjacent vertices \(\nu _4\) and \(\nu _5\). On the other hand, we know that \(|B|=3\). Thus \(C(\nu _4)=C(\nu _5)=1\). This is a contradiction with \(\alpha _{11}=0\). \(\square \)

Finally, we get the following theorem (Table 6):

Theorem 5

The parameter matrices of aP.2.Cof a quartic graph of order 8 are listed in the following table:

Table 6 Parameter matrices of the quartic graphs of order 8

Proof

From Corollary 1, we conclude that acceptable parameter matrices of the quartic graphs with order 8 are \(M_1, M_5, M_7, M_8\) and \(M_{10}\). First, we determine structures for the quartic graphs with order 8 with their listed parameter matrices in Table 6 as follows:

Structure for \(Q_5\) with matrix \(M _7\) :

\(C(\nu _1)=C(\nu _2)=1 , C(\nu _j)=2\, for\, j=3,4,\ldots ,8.\)

Structure for \(Q_5\) with matrix \(M_8\) :

\(C(\nu _1)=C(\nu _2)=C(\nu _3)=C(\nu _4)=1, C(\nu _j)=2\, for\, j=5,6,\ldots ,8.\)

Structure for \(Q_7\) with matrix \(M_7\) :

\(C(\nu _1)=C(\nu _2)=1, C(\nu _j)=2 \,for\, j=3,4,\ldots ,8.\)

Structure for \(Q_7\) with matrix \(M_8\) :

\(C(\nu _1)=C(\nu _2)=C(\nu _3)=C(\nu _4)=1, C(\nu _j)=2 \,for\, j=5,6,\ldots ,8.\)

Structure for \(Q_8\) with matrix \(M_5\) :

\(C(\nu _1)=C(\nu _3)=C(\nu _5)=C(\nu _7)=1, C(\nu _2)=C(\nu _4)=C(\nu _6)=C(\nu _8)=2\).

Structure for \(Q_8\) with matrix \(M_8\) :

\(C(\nu _1)=C(\nu _2)=C(\nu _3)=C(\nu _4)=1, C(\nu _j)=2\, for\, j=5,6,\ldots ,8.\)

Structure for \(Q_9\) with matrix \(M_5\) :

\(C(\nu _1)=C(\nu _3)=C(\nu _5)=C(\nu _7)=1, C(\nu _2)=C(\nu _4)=C(\nu _6)=C(\nu _8)=2\).

Structure for \(Q_9\) with matrix \(M_7\) :

\(C(\nu _1)=C(\nu _2)=1, C(\nu _j)=2\, for\, j=3,4,\ldots ,8.\)

Structure for \(Q_9\) with matrix \(M_8\) :

\(C(\nu _1)=C(\nu _2)=C(\nu _3)=C(\nu _4)=1, C(\nu _5)=C(\nu _6)=C(\nu _7)=C(\nu _8)=2\).

Structure for \(Q_{10}\) with matrix \(M_1\) :

\(C(\nu _1)=C(\nu _3)=C(\nu _5)=C(\nu _7)=1, C(\nu _2)=C(\nu _4)=C(\nu _6)=C(\nu _8)=2\).

Structure for \(Q_{10}\) with matrix \(M_7\) :

\(C(\nu _1)=C(\nu _2)=1, C(\nu _j)=2\, for\, j=3,4,\ldots ,8.\)

Structure for \(Q_{10}\) with matrix \(M_8\) :

\(C(\nu _1)=C(\nu _2)=C(\nu _3)=C(\nu _4)=1, C(\nu _5)=C(\nu _6)=C(\nu _7)=C(\nu _8)=2\).

It is easily to see that the above functions are perfect 2-coloring with their expressed parameter matrices.

Note that, from Lemma 5, we see that there is no perfect 2-coloring for \(Q_5, Q_6, Q_7, Q_8\) and \(Q_9\) with the matrix \(M_1\).

Also, there is no perfect 2-coloring of \(Q_5\) with the matrix \(M_5\). On the contrary, suppose that C is a perfect 2-coloring of \(Q_5\) with the matrix \(M_5\). There is no loss of generality in assuming \(C(\nu _1)=C(\nu _2)=1\). From \(\alpha _{21}=3\) and \(C(\nu _1)=1\), we obtain \(C(\nu _4)=C(\nu _5)=2\). On the other hand, from \(\alpha _{21}=3\) and \(C(\nu _2)=1\), we have \(C(\nu _7)=C(\nu _3)=2\). Thus vertex \(\nu _4\) with red color is adjacent to the other two red vertices (\(\nu _3\) and \(\nu _5\)), contrary to \(\alpha _{22}=1\). The proof for \(Q_5\) with matrix \(M_{10}\) is similar.

Now, we show there are no P.2.C of \(Q_6\) with any matrices \(M_1, M_5, M_7, M_8\) and \(M_{10}\). From Lemmas 4 and 5, we see that there is no P.2.C of \(Q_6\) with matrices \(M_7, M_1\) and \(M_{10}\), respectively. It suffices to show that there is no P.2.C of \(Q_6\) with matrices \(M_5\) and \(M_8\). Suppose that C is a P.2.C of \(Q_6\) with matrix \(M_5\). Let \(C(\nu _1)=1\). From \(\alpha _{11}=1\) we deduce that each of \(\nu _2,\nu _5, \nu _6\) or \(\nu _7\) can be the only blue vertex adjacent to \(\nu _1\). Without restriction of generality, we can assume that \(C(\nu _2)=1\). Thus, from \(M_5\) we have \(C(\nu _3)=C(\nu _4)=C(\nu _5)=C(\nu _6)=C(\nu _7)=2\), which is a contradiction with \(\alpha _{22}=1\). The same conclusion can be drawn for \(M_8\).

For graph \(Q_7\), we only need to show that there is no P.2.C of \(Q_7\) with matrix \(M_5\). Suppose there is a P.2.C of \(Q_7\) with matrix \(M_5\). Without loss of generality, we can suppose that \(C(\nu _1)=C(\nu _2)=1\). Since \(\alpha _{12}=3\), we have \(C(\nu _6)=C(\nu _7)=C(\nu _8)=2\), contrary to \(\alpha _{22}=1\). It remains only to prove that there is no P.2.C of \(Q_{10}\) with matrix \(M_5\). On the contrary, suppose that there is a P.2.C of \(Q_{10}\) with matrix \(M_5\). From \(\alpha _{11}=1\), we conclude that the two adjacent vertices in \(Q_{10}\), all other vertices will be red. This gets to a contradiction with \(|B|=4,\) and the proof is complete. \(\square \)

Corollary 3

The onlyP.2.Cof the quartic graphs with at most 8 vertices is prefect coloring with listed matrices in the following table: (Table 7).

Table 7 All parameter matrices of the quartic graphs up to order 8

Conclusion

The perfect coloring of graphs is closely related to coding theory, algebraic theory, graph theory and combinatorics, including designs. We can consider perfect m-coloring as a generalization of the concept of completely regular codes presented by P. Delsarte for the first time. This class of codes has been of interest to coding theorists and graph theorists alike. In this way, the problem of existence of perfect coloring of the Johnson graphs, the generalized Petersen graphs and the n-dimensional hypercube graphs \(Q_n\) for \(n<24\) has been settled in [2,3,4, 6] and [5].

In this paper, we have listed all parameters of existing perfect 2-coloring in the quartic graphs with order at most 8. The question of existence of perfect 3-coloring of the quartic graphs remains open.