Now, we turn to the proof of the main result.
Proof.  We are sufficient to handle the situation 
 since cases of 
 are trivial. Let 
 be a 
-function such that 
 contains the maximum number of components isomorphic to 
. Suppose to the contrary that 
. Then, 
 since 
 [
11], that is,
        
Formula (
1) indicates that every 2RiDF of 
 has weight at least 
. We will complete our proof by constructing a 2RiDF of 
 of weight at most 
 or a 2RiDF of 
G of weight less than 
.
If 
, then 
, a contradiction; if 
, then 
 and by Lemma 1 
, also a contradiction. Therefore, by Lemma 4,
        
Then, by Lemma 5 (3) we have 
 for 
. In addition, because, by definition, 
 is a clique, 
, it follows that for every 2RiDF 
 of 
,
        
Therefore, by Lemma 2 we can extend every 
-function to a 2RiDF of 
 with weight at most 
, i.e., 
 by Formula (
1).
Claim 1.Denote by ℓ the number of vertices in , which have degree  in . Then,  where . If not, either ℓ is at least 2 or both ℓ and  are equal to 1. Suppose that  and take two vertices , such that they are adjacent to all vertices of  in . Let  be:  for . Clearly,  is a 2RiDF of  and by Lemma 2 we can extend  to a 2RiDF of , which has weight at most , a contradiction. Now, suppose that . Then, , which indicates that  contains a component  s.t. . Since , there is a vertex v, say , which is adjacent to every vertex of  in . By Lemma 6  has a 2RiDF  s.t.  for some  and . Observe that in v is adjacent to all vertices of ; by the rule of Lemma 2 we can extend  to a 2RiDF g of  under which there is at most one vertex in  (and ) not assigned value 0. Thus, , a contradiction. This completes the proof of Claim 1.
Now, we WLOG assume 
. Then, 
 by Formula (
2).
Claim 2. does not contain any isolated vertex v s.t. . Otherwise, define  as: for , and . By Claim 1, in ,  has not more than one vertex adjacent to every vertex in ; say  if such a vertex exists. We further let  for  (or for  if  exists). Since in G every vertex in  (except for ) is adjacent to v and also , f is a 2RiDF of G of weight at most , a contradiction. This completes the proof of Claim 2.
We proceed by distinguishing two cases:  and .
Case 1.. In this case, by Claim 1 each vertex of  owns a neighbor belonging to  in G where = [1,2]; by Theorem 2,  has one component H isomorphic to one of  (),  (),  () and , and other components of  are isomorphic to  or . Let  be a vertex with . Clearly, . Let  and  be two vertices such that every vertex in  has degree in H not exceeding . By the structure of H, for , we have that  and if  has a neighbor ) in H, then . Moreover, by Lemma 5 (1), , which implies that each vertex of  is adjacent to  or  in G.
Claim 3.. Otherwise, let 
. Then, 
 and 
. Suppose that 
 (the case of 
 can be similarly discussed). Let 
 and clearly 
. By Lemma 5 (2), a vertex 
 is adjacent to 
 in 
. We WLOG assume that 
. According to Lemma 6, 
 admits a 2RiDF 
 satisfying 
 and 
 for some 
. Further, let 
 and 
. So 
 is a 2RiDF of 
, and by Lemma 2 and Formula (
3) we can extend 
 to a 2RiDF of 
 with weight at most 
 (since 
), a contradiction. We therefore assume that 
. By Lemma 5 (2) we have 
. WLOG, suppose that in 
, 
 has two neighbors belonging to 
, say 
 and 
. By Lemma 5 (1), 
 is not adjacent to both 
 and 
, and 
 is not adjacent to both 
 and 
 in 
, where 
 and 
. Thus, it follows that 
 and 
, or 
 and 
, which contradicts to Lemma 5 (1) again. This completes the proof of Claim 3.
 By Claim 3, we see that  contains no component isomorphic to  and contains at most one  component.
Claim 4. contains a  component. If not, we have  = H.
Claim 4.1..
Otherwise, for ,  is adjacent to every vertex of  in G, and by Lemma 5 (2)  and . Set , ; then, . Let f be: ,  and  for any x in . So, we get a 2RiDF f of G, which has weight 4, a contradiction. So, Claim 4.1 holds.
Claim 4.2..
Observe that ; it is enough by showing that G admits a 2RiDF f s.t. . When , let f be:  for ,  for , and  for . By Lemma 5 (1), in ,  contains no vertex adjacent to  and also . Therefore, f is a 2RiDF of G of weight . Now, suppose that . By Lemma 5 (1),  contains at most one vertex adjacent to both  and  in ; say u if such a vertex exists. Let f be:  (or  if u exists),  for  (or ) and  for . Notice that by Claim 1 every vertex of  is adjacent to  in G, and by the structure of H and the selection of  and , every vertex of  is adjacent to  in G; f is a 2RiDF of G of weight at most . This completes the proof of Claim 4.2.
By Claim 4.2, we have . Let  in the following.
Claim 4.3.In , for  every vertex in  has not more than one neighbor in .
If not, let 
 be adjacent to two vertices of 
 in 
, say 
. By Lemma 5 (1) 
 or 
 is not adjacent to 
v in 
, say 
. If 
, define 
 as: 
 for every 
, 
, 
. If 
, then 
 and let 
 be: 
; further, let 
 when 
, or let 
 and 
 when 
. According to Lemma 2, in either case the 
 defined above can be extended to a 2RiDF 
g of 
 under which 
 and 
 or 
. Therefore, by Formula (
3) 
, a contradiction. With a similar discussion, there is also a contradiction if we assume 
 contains a vertex that has two neighbors in 
 in 
. This completes the proof of Claim 4.3.
Now, we consider . Suppose that  and let . According to Claim 4.1, we WLOG assume that . This indicates that  by Lemma 5 (1). If  has a neighbor in , say , then according to Lemma 5 (1), , , and  (resp. ) is not adjacent to  (resp. ) in  (otherwise  or  has two neighbors in  or  in , respectively. This contradicts to Claim 4.3). Let f be:  and  for . Observe that  (resp. ) is not adjacent to  (resp. ) in  and by Lemma 5 (1)  contains no vertex adjacent to both  and  for some . Hence, f is a 2RiDF of  of weight 4 and we are able to extend f to a 2RiDF of G with weight at most  according to Lemma 2, a contradiction. Therefore, we may assume that . In this case, when , let f be: , . By Lemma 5 (1)  has not more than one vertex  adjacent to both  and  in  and  has not more than one vertex  adjacent to  in ; for  we further let . Then, f is a 2RiDF of  of weight 3 and according to Lemma 2 we can extend f to a 2RiDF of G of weight at most , a contradiction. We therefore suppose that  has a neighbor in  in , say . With the same argument as , we can show that  as well.
Then, if  and , the function f:  and  for , is a 2RiDF of  with weight 4, and according to Lemma 2, we are able to extend f to a 2RiDF of G with weight at most , a contradiction. Therefore, we suppose that  by the symmetry. By Lemma 5 (1), it has that , and  or , say  by the symmetry. Let f be:  and  for . Since in G every vertex in  has a neighbor in  and also , f is a 2RiDF of  of weight 4 and according to Lemma 2 we can extend f to a 2RiDF of G of weight at most , and a contradiction.
A similar line of thought leads to a contradiction if we assume that , and so Claim 4 holds.
By Claim 4, we see that  contains one component isomorphic to . Let s be the vertex of the  component. We first show that . If not, in  we assume that s has two neighbors in , say . By Lemma 5 (1) for ,  (resp. ) can not be adjacent to  and  (resp.  and ) simultaneously in . This implies that either , , or  and , which violates Lemma 5 (1) as well. Thus, by Claim 2  and the vertex  adjacent to s in  belongs to . Let f be:  for , ,  for . Observe that by Claim 1 all vertices in  are adjacent to  in G. Hence, every vertex in  is adjacent to s and also  in G. Therefore, f is a 2RiDF of G with weight  (since ), a contradiction.
The foregoing discussion shows that there exists a contradiction if we assume that . In what remains, we handle the case when .
Case 2.. Then by Lemma 1 every component of 
 is isomorphic to 
 or 
. Recall that 
 for 
. Take two vertices 
 in 
 s.t. 
 if 
 contains a 
 component and 
 are isolated vertices in 
 otherwise. By Lemma 5 (1), we have
        
 We deal with two subcases in terms of the adjacency property of u and v.
Case 2.1.. Then in ,  contains no vertex adjacent to .
Claim 5.In ,  contains only vertices with degree at most . Suppose that  contains a vertex w such that  for every . If  (or ), define a 2RiDF  of  as:  (or  and  (). According to Lemma 2 we can extend  to a 2RiDF of , under which  contains at most two vertices not assigned 0. Thus, , a contradiction. We therefore assume that  and . By Lemma 5 (2), there are at least three vertices in  that are adjacent to u or v. We WLOG assume that  contains a vertex  s.t. . Construct a 2RiDF  of  as follows: , and . Then, by Lemma 2  can be extended to a 2RiDF g of , under which  contains at most one vertex not assigned value 0. Therefore, , a contradiction. Similarly, we can also obtain a contradiction if we assume that  contains a vertex adjacent to every vertex of . So, Claim 5 holds.
By Claim 5, for = [1,2], each vertex of  is adjacent to a vertex of  in G. If , then in G all vertices of  are adjacent to . Let f be:  for ,  for , and . Obviously, f is a 2RiDF of G s.t.  = , a contradiction. We therefore assume that  contains a vertex s s.t.  and . Then, in , by Lemma 5 (1) no vertex in  is adjacent to u and v simultaneously. Analogously, the function f:  for , and  for  (and  for , and  for ) is a 2RiDF of G with weight  (and ). This implies that  and . Let  =  and  = . Then, in , neither u nor v is a neighbor of  and  simultaneously; otherwise, we, by the symmetry, suppose that  and . Let  be: , and . Obviously,  is a 2RiDF of  with weight 2. According to Lemma 2, we can extend  to a 2RiDF of  with weight at most , a contradiction. In addition, in , , is not adjacent to u and v simultaneously according to Lemma 5 (1). Therefore, we may assume, by the symmetry, that  and .
If no edge between  and  in  exists, then by Lemmas 5 (2),  and . Then, the function  such that , and  is a 2RiDF of  with weight 2. According to Lemma 2, we can extend  to a 2RiDF of  with weight at most , a contradiction. We therefore assume that  contains an edge connecting  and , say  by the symmetry.
If 
, define 
 as: 
. Then, 
 is a 2RiDF of 
 with weight 2. By Lemma 2 and Formula 
3, we are able to extend 
 to a 2RiDF of 
 of weight at most 
, a contradiction. Consequently, we have 
. Then, the function 
 such that 
 is a 2RiDF of 
 with weight 3, and by Lemma 2 and Formula 
3 we can extend 
 to a 2RiDF of 
 with weight at most 
. This contradicts the assumption.
Case 2.2.. Then, by the selection of  and ,  contains only isolated vertices and G does not admit a -function for which the induced subgraph of  by vertices with value 0 contains  components.
For every 
, let 
 for 
. Let 
 be: 
 for 
, 
, and 
. Apparently, 
 is a 2RiDF of 
 with weight 2. According to Lemma 2, we can extend 
 to a 2RiDF of 
G with weight at most 
. To ensure 
, we have
        
Claim 6. and the two vertices in  are adjacent in . Define a 2RiDF  of  as: . Suppose that . Since  and  are cliques in  and every vertex in  is adjacent to u or v in , by Lemma 2 we are able to extend  to a 2RiDF g of  under which at most one vertex in , is not assigned value 0 (here if  contains a vertex, say w, then let ). Clearly, , a contradiction. Moreover, if  contains two nonadjacent vertices in , say , then  and  are not in the same set  for some . Therefore, we can extend  to a 2RiDF g of  via letting  when x is in  and . However, , a contradiction. This completes the proof of Claim 6.
By Claim 6,  contains two adjacent vertices in , say . If there exists a  s.t.  (or ), then set  as: ,  (or ),  (or ). Since in  every vertex in  has a neighbor in  and every vertex in  is a neighbor of , where  for some , we can extend  to a 2RiDF g of  according to Lemma 2. Under g, every vertex in  is assigned value 0 and at most one vertex in  is not assigned value 0. Therefore, , a contradiction. This demonstrates that in  no vertex in  is adjacent to . Furthermore, if there is a , then by Claim 6 we have  and , which implies that . Set  as:  and  for . Then,  is a 2RiDF of  with weight 3, and we can extend  to a 2RiDF of  with weight at most  according to Lemma 2, a contradiction. So far, we have shown that , that is, .
Now, we define a 2RiDF  of  as follows: ,  and . According to Lemma 2, we can extend  to a 2RiDF f of G with weight at most . To ensure , f must be a -function (since ). However,  is isomorphic to . This contradicts the selection of . Eventually, the proof of Theorem 3 is finished.    □