Cross-Layer Network Codes for Completion Time Minimization in Device-to-Device Networks

In this paper, we joinlty optimize cross-layer network coding (CLNC) and device-to-device (D2D) communications to facilitate the recovery of popular common files that are missed at multiple user devices (UDs). In the envisioned system, a group of near-by UDs cooperate with each other and use CLNC to combine their received files, such that the UDs can recover their missing files using D2D communications. The proposed CLNC mechanism enables the cloud base-station (CBS) to select the coding decisions, adapt the rate allocation, and adjust the transmit power of the UDs to reduce the interference. Specifically, such a CLNC configuration brings a new trade-off among selecting the transmitting UDs and their coding decisions, and scheduling the transmission rate and power. To this end, we formulate an optimization problem to minimize the completion time required for recovering the missing files at the UDs. The proposed optimization problem is shown to be intractable because an optimal solution depends on the future coding decisions and UDs’ heterogeneous rates. To overcome such intractiblity, we propose an online solution that is updated at each transmission slot. In particular, we first design a graph called herein the D2D rate-aware instantely decodable NC (RA-IDNC), where its vertices have weights that judiciously balance between the rate of the transmitting UDs and the number of their scheduled UDs. Subsequently, we propose an innovative and efficient CLNC solution that iteratively selects a set of transmitting UDs and optimizes their powers using a function evaluation (FE) method. In each iteration, a new transmitting UD is selected provided that the resultant interference does not significantly degrade the completion time performance. Simulation results show that the proposed CLNC can significantly reduces the completion time compared to the benchmark schemes.


I. INTRODUCTION
The exploding amount of mobile traffic, e.g., streaming applications, YouTube videos, video-on demand, consume large bandwidth and high transmission energy of the resource limited cellular networks. In order to circumvent these challenges, D2D communications have widely been considered as a promising technology [1]- [3]. Consider a group of nearby user devices (UDs) that are interested in receiving a set of popular common files from the cloud base-station (CBS). Here, popular common files are high frequently wanted files by multiple UDs. Due to channel impairments, e.g., fading and interference, each UD receives only a subset of the com-mon files from the CBS in previous broadcast transmissions [4], [5]. To recover the missing files, UDs cooperate with each other using short-range D2D communications. With such a cooperation among UDs for file recovery, the CBS dose not need to re-transmit missing files to UDs. Such D2D communications offer practical advantages such as alleviating the traffic congestion of cellular networks and reducing both the CBS involvement and end-to-end latency [1]. In this work, we consider D2D communications, where multiple UDs exploit their received files and cooperate among them to recover missing files by other UDs. As such, all the missing files are recovered by all UDs within the lowest possible delay.
Network coding (NC) has been shown to be promising for improving throughput and minimizing decoding delay and completion time for numerous applications in wireless networks [2]- [5]. Specifically, random linear NC (RLNC) can achieve the optimal throughput of wireless broadcast networks [5]. However, this throughput achievement comes at the expense of complex encoding (i.e., mixing files using coefficients from a large Galois field), high decoding delay, and prohibitive computational complexity. This is suitable for delay-tolerant applications and UDs with high capabilities and buffer sizes. The report by CISCO [6] shows that a significant portion of network traffic is popular common files (popular videos and photos) that are frequently requested by UDs in short time. Therefore, it is crucial to transmit these delay-sensitive files with minimum possible delay. For this purpose, instantly decodable NC (IDNC) is adopted [7]. IDNC performs simple encoding XOR operation at the transmitter and simple decoding XOR operation at the receiver, and thus instantly decode the received files. Accordingly, it is suitable for implementation in small and low cost UDs [8]. Therefore, D2D communication and IDNC technique can be exploited to transmit popular common files to UDs with the lowest possible delay while offloading the CBS.
For instance, consider that three popular common files f 1 , f 2 , and f 3 are wanted by a set of UDs 1, 2, and 3. Suppose that the CBS has already transmitted these files to the UDs and due to channel impairments UD 1 is missing file f 1 , UD 2 is missing f 2 , and UD 3 is missing file f 3 . These missed files can be traditionally re-transmitted from the CBS to each UD until all UDs obtain them correctly. As a result, the CBS requires at least 3 uncoded transmissions for retransmitting these files, which degrades system performance [9]. However, UDs, which have received files successfully, can transmit their received files to other UDs which are requesting missing files. In our considered example, UD 1 holds files f 2 and f 3 , and accordingly, it can transmit the binary XOR combination f 2 ⊕ f 3 to UDs 2 and 3. Then, UD 2 holds f 1 and can provide it to UD 1. As a result, 2 transmissions are required for re-transmitting all files to all UDs. Therefore, the cooperation among UDs can be utilized with IDNC to combine files and transmit them to interested UDs via D2D links. As such, the missed files can be retransmitted to the requesting UDs quickly while offloading the CBS's radio resource blocks.
In IDNC literature, the file recovery problem is referred as completion time minimization problem. Based on the layer functionalities, existing IDNC solutions that solved the completion time minimization problem can be classified into network layer IDNC [8], [11]- [13] and rate aware IDNC (RA-IDNC) [14]- [19], [21] methods. As its name indicates, network layer IDNC focused only on IDNC at the network layer to minimize the number of transmissions by serving as many UDs as possible. On the other hand, RA-IDNC [14]- [19], [21] incorporates operations in both network and physical layers to reduce the completion time (in second) that is needed to recover all missing files at the requesting UDs.

A. RELATED WORKS AND MOTIVATIONS
Related works in physical layer: Most relevant works in physical layer focused on scheduling UDs to small basestations (SBSs) in order to maximize sum-rate in different system models, e.g., [26]- [30]. For example, the UD scheduling scheme in [26] was developed in [27] to include power allocation optimization for the SBSs. However, these works ignored the available side information at network layer, i.e., missed and previously downloaded files by different UDs. As a result, each SBS sends uncoded file that schedules a single UD. Here, the term "uncoded file" is referred to file without NC. It has been noticed that UDs are interested in requesting same files that represent a popular content, e.g., a popular video, within a small interval of time [13]. Indeed, this frequently happens in a hotspot, e.g., a playground, a public transport, a conference hall, and so on. The aforementioned physical layer schemes transmit the requested files without NC, which degrade the system performance. Therefore, IDNC [8], [11]- [13] can be intelligently leveraged to select a combination of files (binary XOR combination) that can simultaneously serve multiple interested UDs at the same time.
Related works in Network Layer: From only networklayer perspective, IDNC scheduling is adopted to solve the problem in real-time applications in terms of minimizing the number of transmissions [8], [11]- [13]. In particular, these related works modeled the status of physical channels by file erasure probabilities and integrated such erasures in the coding decisions, see for examples [11], [13]. This improves the system's performance from network-layer perspective by scheduling many UDs to the same resource block, but it degrades the performance from physical-layer perspective through selecting the minimum rates of all the scheduled UDs. This results in prolonged transmission duration and hence, consumes the time resources of network. To this end, the RA-IDNC scheme is developed in [22] that considers both aspects of network layer (i.e., coding the available side information at UDs) and physical layer, such as transmission rate.
Related works used RA-IDNC: Unlike network-layer IDNC that depends solely on file combinations for minimizing the completion time, RA-IDNC requires a careful optimization to select the file combination and transmission rate of each radio resource, see for example [14]- [21]. This allows a new degree-of-freedom, such as, choosing the transmitting UDs, their transmission rates, and IDNC file combinations, to optimize the file recovery problem. The authors of [14]- [19], [21] used RA-IDNC in centralized and decentralized networks for optimizing different system parameters. For example, the authors of [17] used RA-IDNC scheme in cloud radio access networks (C-RANs) for completion time minimization. However, the authors assumed that all SBSs maintain a fixed transmit power level. This may violate the Quality-of-Service (QoS) rate guarantee and lead to a longer time for file transmission.
Related works used CLNC: The authors in [18], [19] developed a cross-layer NC (CLNC) scheme that controls the RA-IDNC coding decisions through optimizing the power levels of the SBSs in centralized C-RANs and Fog-RANs, respectively. Essentially, the coding decisions in CLNC scheme not only depends on NC and UDs' rate, but also on the power levels of each transmitter. The authors in [18], [19] showed that cross-layer IDNC decisions are more effective in maximizing throughput and cloud offloading compared to rate oblivious IDNC decisions, respectively. However, these works considered centralized networks with CBSs and distributed SBSs possessing all files without exploiting the potentials of D2D communications. The authors in [20] considered minimizing the completion time in F-RAN systems with D2D communications. They proposed RA-IDNC schemes where SBSs (therein called enhanced remote radio heads (eRRHs)) cache all the requested files and responsible for file transmissions, and D2D transmitters can serve unserved UDs by the eRRHs. Similar to [18], [19], the work in [20] considered centralized networks with CBSs and distributed eRRHs caching all files. In addition, it did not optimize the power allocation of D2D transmitters, which may violate the QoS of UDs.
Related works in D2D Networks: The authors in [31]- [36] considered network-coded D2D communications systems to take advantage of both NC and UDs cooperation. In particular, the authors in [31]- [33] studied RLNC for minimizing the completion time in D2D networks. Due to a large decoding delay and high encoding and decoding complexities associated with RLNC, the authors in [34], [35] adopted IDNC and suggested jointly selecting a transmitting UDs and its XOR file combination to serve a large number of nearby UDs with a new file. The authors in [36] extended the works in [34], [35] and minimized the completion time using IDNC in D2D networks.
The aforementioned works [31], [32], [34]- [36] developed network coding schemes considering that a single UD is allowed to transmit a coded file in each transmission interval. In contrast to the works in [32], [34], [35], the recent works [33], [37], [38] exploited the possibility of simultaneous transmissions from multiple UDs given that there is no destructive interference. Particularly, [33] derived various necessary and sufficient conditions to characterize the completion time minimization problem in D2D networks. The authors in [37] extended the study in [33] and concluded that solving the completion time minimization problem exactly or even approximately is computationally complex. Unlike the linear network coding over a large Galois field in [33], [37], the works in [38] employed binary IDNC to serve a large number of UDs with a new file in each time slot.
Recently, the authors of [21] considered completion time minimization problem by simply selecting only one transmitting UD and its NC combination. However, the main drawback of the work in [21] is that only one UD is allowed to transmit coded file in each transmission slot. Thus, they ignored the interference caused by different transmitting UDs to the scheduled UDs. In D2D networks, UDs are spatially distributed in a region which creates an opportunity to judiciously select multiple transmitting UDs that schedule a significant set of other UDs. Such configuration brings a new trade-off between selecting the transmitting UDs, their coded files, and scheduling the transmission rate/power. However, solving the completion time minimization problem while jointly considering the previously received files of UDs, their transmission rate and power, NC, and D2D communications has not been explored yet. Furthermore, developing a joint cross-layer IDNC for the completion time minimization in D2D networks is a novel concept compared to the existing NC literature. In particular, our proposed work enables both selection of the multiple transmitting UDs and optimization of the employed transmission rate using power control of each transmitting UD. Consequently, our proposed work is realistic for the network-coded file delivery problem using D2D communications.
Motivations: In contrast to the existing works [14]- [19], [21], our motivation is to develop a CLNC solution via joint optimization of selecting transmitting UDs and their file combinations, scheduling the UDs with the transmitting UDs, and transmit power allocations. As such, the completion time is minimized. The considered completion time minimization problem is motivated by real-time applications, i.e., video streaming. In these applications, UDs want to receive a set of popular files from other transmitting UDs with a minimum possible delay, given the required QoS rate. Consider that a popular common video, representing a frame of files, is requested by a set of UDs located in a playground. Many UDs in the playground are interested in receiving this frame. At any time epoch, assume that UDs have already obtained some files and missed some other files from that frame. In order to recover the missing files in that frame without any re-transmission from the CBS, UDs cooperate among them to receive their missing files using D2D communications with a minimum possible delay. For this, UDs can immediately re-XOR the transmitted file combinations from transmitting UDs and use the decoded files at the application layer. This XOR decoding at the UDs ensures the delay requirements and streaming quality.

B. CONTRIBUTIONS
The main contribution of this paper is an optimized rate allocation and power control scheme for IDNC in a D2D network. To our best knowledge, this is the first work that optimizes, jointly, the set of concurrently transmitting UDs, their coding combinations and scheduled UDs, and their power allocations and rate adaptations to effectively deal with the interference problem in IDNC-enabled D2D networks.
Our key contributions are summarized below.
• The completion time minimization problem is computationally intractable due to the interdependence among variables such as the UDs' received and missing files, power optimization, rate adaptation, and coding decisions. Specifically, to optimally solve the completion time minimization problem, all the future coding decisions and UDs' heterogeneous rates are required, and as a result, an optimal solution is infeasible for practical systems. To this end, we propose an efficient online approach to solve this problem at each transmission slot. • We design a new D2D-RA-IDNC graph to efficiently transform the completion time minimization problem to a maximal weight independent set (MWIS) problem. The designed D2D-RA-IDNC graph represents all the feasible rates and NC decisions for all potential transmitting UDs. The problem is then reformulated as an MWIS problem that can be efficiently solved using low complexity graph theoretical solution. The rest of this paper is organized as follows. Section II overviews the system model. The completion time approximation and problem formulation are illustrated in Section III. In Section IV, we present the graph construction and problem transformation and propose CLNC solution in Section V. Finally, we present selected simulation results in Section VI and conclude the work in Section VII.

A. SYSTEM OVERVIEW
Consider a D2D system with a set of U geographically close user-devices (UDs), denoted by the set U = {1, 2, · · · , U }. These UDs are interested in receiving a delay-sensitive popular content (e.g., popular YouTube video) representing a frame of F common files, denoted by the set F = {1, 2, · · · , F }, each of size B bits. This work assumes that UDs have already acquired some files from F from the CBS in previous broadcast transmissions [19], [21]. Essentially, the CBS starts by broadcasting F uncoded files (without network coding) to all UDs. Due to channel impairments, some of these files are erased which creates an arbitrary side information (i.e., lost and received files) at the UDs. If occasionally there exists a file that no UD has received, the CBS keeps broadcasting that file until it is received by at least one UD. After this broadcast phase, the files can be in one of the following two sets for each UD u.
• The Has set H u that represents the set of the files already received at UD u. • The Wants set W u = F\H u that represents the set of requested files for UD u. The Has and Wants sets of all UDs can be summarized in a binary U × F state matrix M = [m u,f ] wherein the entry m u,f = 0 represents that the f -th file is successfully received at the u-th UD and 1 otherwise. In order for all UDs to recover their missing files frame F using D2D communications only, we assume that at the beginning of D2D transmissions each file from F is received by at least one UD in U, i.e., u∈U m u,f ≥ 1, ∀f ∈ F [12], [21]. UDs cooperate to complete the recovery of all missing files by exchanging XOR-encoded files to other UDs. When an UD receives its requested files, it acts as a transmitting UD that provides its received files to the interested UDs. The goal is to recover the missing files of the UDs within the lowest possible completion time by leveraging NC and D2D communications.
Similar to [21], we adopt a fully connected D2D model where each UD can be connected to all other UDs. Our work can easily be adopted for a more general case of partially connected D2D networks can be explained as follows. Note that in partially connected D2D networks, each UD has a limited coverage zone, and thus, it is connected to a subset of UDs. Similar to the fully connected model, our proposed algorithm will select a set of transmitting UDs, their file combinations, and their transmission rates/powers. Unlike the fully connected model that each transmitting UD transmits to all UDs in the network, each transmitting UD in the partially connected model will serve UDs in its coverage zone only.
We consider that each UD is equipped with single antenna and uses half-duplex channel. Accordingly, each UD can either transmit or receive at a given transmission slot. Specifically, at each transmission slot, each UD can be either file requester (receiver) or file holder (transmitter) that can provide its received files to other requesting UDs via D2D links. Unlike the simple D2D model used in [21] that considers only one transmitting UD at a time, we consider a realistic D2D model where multiple UDs can simultaneously transmit using the same frequency channel and we employ a transmit power control approach to mitigate interference among the concurrently active D2D links.
We consider a centralized decision making system wherein a CBS has full knowledge of the distribution of missed and received files at each UD. Such information can be accomplished and collected at the CBS by the transmission of errorfree acknowledgments (ACKs) through a dedicated feedback channel [21]. Therefore, the CBS is responsible for selecting a set of transmitting UDs and their NC combinations and power allocations, that deliver missing files to requesting UDs. Accordingly, the CBS decides the coding combinations that depend on the missing and received files of all UDs, their transmission rates and power allocations.
Let γ k,u denote the channel gain between UD k and UD u and Q max denote the maximum transmit power for D2D link. We consider slow fading channels, and thus, γ k,u is considered to be fixed during a single transmission interval but may change independently from one file transmission to another file transmission. Then, the achievable capacity of a D2D pair (k, u) is given by C k,u = log 2 (1 + SINR k,u (Q)), ∀k ∈ A, where SINR k,u (Q) is the corresponding signal-to-interference plus noise-ratio experienced by UD u when it is scheduled to UD k. This SINR is given where A is the set of transmitting UDs, N 0 is the noise power, Q k , Q m are the transmit powers of UDs k and m which both are bounded by Q max , and Q = [Q k ] is a row vector containing the power levels of the transmitting UDs. The channel capacities of all pairs of D2D links can be stored in an U ×U capacity status matrix (CSM) C = [C k,u ], ∀(k, u). Since UD k cannot transmit to itself, C k,k = 0.

B. RA-IDNC AND EXPRESSION OF THE COMPLETION TIME METRIC
Let U w,t denote the set of UDs that having non-empty Wants sets at the t-th transmission slot is denoted by U w,t , i.e., U w,t = {u ∈ U|W u,t = ∅}. For simplicity, we use time index t to represent the t-th transmission slot, i.e., t = 1 refers to the first transmission slot. Let f k,t denote the XOR file combination to be sent by UD k to the set of scheduled UDs u(f k,t ) at the t-th transmission. The file combination f k is an element of the power set P(H k ) of the received files at UD k. A transmission from the k-th transmitting UD is instantly decodable at the u-th UD if the following constraints are satisfied.
re-XOR f k,t with its previously received files to decode one of its missing files. In IDNC constraint, we have two decodablity conditions: i) f = f ⇒ File f is requested by UDs u and u , and ii) f ∈ H u and f ∈ H u ⇒ Each requested file of each UD is in the Has set of the other UD. With this IDNC constraint, the file combination f ⊕ f is instantly decodable for both UDs u and u . These two conditions jointly represent the fact that there is only one requested file for each UD u in the file combination κ k of its scheduled transmitting UD k, i.e., properly receive the combination f k,t from the k-th UD with a rate below its achievable capacity. This is to ensure successful decoding at the u-th UD. Moreover, to ensure successful decoding at multiple UDs, the maximum transmission rate of a particular transmitting UD is equal to the minimum achievable capacity of its scheduled UDs.
The above two constraints can be mathematically written as u(f k ) = u ∈ U w |f k ∩ W u | = 1 and R k ≤ C k,u . Therefore, this RA-IDNC scheduling ensures providing requested files that can be decoded by the scheduled UDs. The term "targeted users" is given for the scheduled UDs who receive an instantly-decodable transmission. Without loss of generality, the set of all targeted UDs, when |A| transmitting UDs transmit the set of combinations f(A), is represented by and u(f(A)), respectively. Here, the symbol |X | represents the cardinality of the set X . Let T k denote the transmission duration of the k-th UD. The duration for transmitting For transmission synchronization, all transmitting UDs in the set A adopt a common transmission rate, denoted as R. In other words, since files are not fragmentable, we suggest that all transmitting UDs can use the same transmission rate. Indeed, assume these transmitting UDs are using different rates. In this case, each transmitting UD either waits for the other transmitting UDs to finish their transmissions to start a new transmission or does not wait for the other transmitting UDs. In the latter case, each transmitting UD would serve the same group of UDs all the time, which transforms the problem into multiple parallel single transmitting UD model in [21]. Therefore, we assume that all transmitting UDs are using the same transmission rate R(t) at each transmission index t. Therefore, all the nodes (i.e., transmitting UDs) start and finish the transmissions at the same time, i.e., all transmitting UDs have the same transmission duration of B R(t) seconds. Therefore, the adopted transmission duration for sending any coded/uncoded file from any transmitting UD is denoted by T t and expressed by T t = B R seconds. In this work, t represents the transmission slot index and its transmission duration is represented by B R(t) . Consequently, UDs that are not targeted at transmission slot t, experience T t seconds of delay has a cumulative delay as defined below. Definition 1: Any UD with non-empty Wants set experiences T t seconds of time delay if it does not receive any missing file at the t-th transmission. The accumulated time delay of UD u is the sum of T t seconds at each transmission until the t-th transmission, denoted by D u (t), and expressed as Let T u denote the completion time of UD u until it recovers the missing files. The completion time for UD u includes two parts, its accumulated time delay D u due to receiving noninstantly decodable transmissions and the time duration of sending all instantly decodable transmissions. Here, the term "non-instantly decodable transmission" means that the UD cannot reduce the size of its Wants set with that transmission.
Subsequently, the overall completion time is determined by the longest duration time of receiving the missing files among all UDs. Hence, the overall completion time T = max u∈U {T u } is the time required until all UDs recover all missing files. The used notations and variables are summarized in Table 1.
In order to minimize the overall completion time, we need to find the optimal schedule from the beginning of the D2D transmission phase at t = 1 until all UDs recover Transmission rate of UD k T k The transmission duration of UD k Tu The completion time of UD u R k Set of all achievable rates of UD k all missing files at t = |S|. Here, S is defined as a collection of transmitting UDs k ∈ A, file combinations and transmission rates/powers until all UDs in U w receive all F files, i.e., S = {A(t), P(H k (t)), R(t)}, ∀t ∈ {1, ..., |S|}. Thus, the optimal schedule S * that minimizes the overall completion time of all UDs is S where S is the set of all possible D2D transmission schedules, i.e., S ∈ S. This optimal schedule can be formulated as follows Theorem 1. The minimum overall completion time problem in a D2D network can be formulated as a transmission schedule selection problem such that: where |W u (0)| is the initial Wants set size of UD k, D u (S) is the accumulative time delay of UD u in schedule S and R u (S) is the harmonic mean of the transmission rates of time indices that are instantly decodable for UD u in schedule S. Note that the time of instantly decodable transmissions is approximated using the mean transmission time which can be written as a function of the harmonic mean of the rates of the instantly decodabe transmissions for the UDs [10]- [15].
The optimal NC transmission scheduling, that reduces the overall completion time in a D2D network, is the solution of the optimization problem in Theorem 1. Such a scheduling requires to exploit the heterogeneity of UDs' channel capacities and the interdependence of UDs' file reception. Actually, the decision at the current transmission slot depends on the future coding situations, which makes the optimization problem anti-causal. Therefore, it can be inferred that finding the optimal schedule S * is intractable [17], [21].

C. EXAMPLE OF RA-IDNC TRANSMISSIONS IN D2D SYSTEM
In this example, we illustrate the aforementioned definitions and concepts to ease the analysis of the completion time minimization problem reformulation in next section. Consider a simple D2D network that shown in Fig. 1 which consists of 6 users, users' received and missing files and their rates. For example, UD 2 receives f 1 , f 2 , f 4 and misses f 3 . Each file is assumed to have a size of 10 bits. To minimize the completion time for this example, one possible scheduling is given as follows. • UD 4 already has f 1 , so it can XOR the combination Thus, the transmission is instantly decodable for UD 4.
Thus, the transmission is instantly decodable for UD 6. • UDs 3 and 5 can receive f 4 from the u 2 -th UD. Thus, the transmission is instantly decodable for UDs 3 and 5.
Therefore, the updated Wants sets after the first time slot are: Note that T t,1 = 4 seconds. Second time slot: UD 1 can use its received files to transmit f 1 = f 2 ⊕ f 3 with rate R 1 = 3 bits/s to the set u(f 1 ) = {2, 5, 6} which requires transmission time T 1 = T t,2 = 10 3 = 3.33 seconds. The decoding process at UDs side can be explained as follows.
• UD 2 already has f 2 , so it can XOR the combination Thus, the transmission is instantly decodable for UD 2.
Thus, the transmission is instantly decodable for UD 5. • UD 6 already has f 2 , so it can XOR the combination Thus, the transmission is instantly decodable for UD 6.
Consequently, all UDs will recover their missed files. Therefore, the total transmission time is T t,1 + T t,2 = 4 + 3.33 = 7.33 seconds. The above example demonstrates the benefit of NC and D2D communications in minimizing the completion time. We can further improve this result by allocating the power levels efficiently to the transmitting UDs.

III. COMPLETION TIME APPROXIMATION AND PROBLEM REFORMULATION
Minimizing the completion time over all future coding decisions is intractable [16], [21]. Therefore, we approximate the completion time in Theorem 1 to select a set of transmitting UDs, file combinations, and transmission rates/powers at each transmission slot t. To achieve this, at each transmission slot t, a lower bound on the completion times of all UDs is computed [21]. We compute this lower bound separately for each UD without exploiting the interdependence of UDs' file reception and channel capacities. In fact, this lower bound metric facilitates the mapping of the transmission schedule selection problem in (2) into an online maximal independent set selection (MWIS) problem.

Corollary 1.
A lower bound on completion timeT u (t) of UD u ∈ U w in a given transmission slot t can be approximated asT where D u (t) is the accumulated time delay experienced by UD u until transmission slot t andR u is the harmonic mean of the channel capacities from all UDs to UD u.
Proof. The expression in (3) matches the expression in Theorem 1, except D u (S) andR u (S) of Theorem 1 are replaced by D u (t) andR u , respectively. The best case scenario is that all transmissions starting from transmission slot t are instantly decodable for UD u. Thus, it experiences no further time delay, i.e., D u (S) = D u (t). In addition, since a fully connected D2D model is adopted, UD u can receive a missing file from any other UD until it receives all F files. Therefore,R u (S) is replaced byR u , whereR u is the harmonic mean of the channel capacities from all other UDs to UD u. This is an approximation asR u is exactly equal tõ R u (S) if UD u receives an equal number of files from other UDs with the rates of channel capacities.
Using the approximated completion time (3) at each transmission slot t, we are now ready to reformulate the completion time minimization problem in Theorem 1 with the aim to develop a CLNC framework that decides the set of transmitting UDs A for sending f k to the UDs u(f k ), and their transmission rates/power levels {R k , Q k }, ∀k ∈ A. As such, all missing files are recovered by all UDs with minimum completion time. Therefore, the completion time minimization problem in a fully connected D2D system can be formulated as : R k ≥ R th , ∀k ∈ A, where (C1) states that each UD must be scheduled to only one transmitting UD; (C2) ensures that all files to be combined using XOR operation at each transmitting UD k are already received by UD k; (C3) bounds the maximum transmit power of transmitting UDs, and (C4) guarantees the minimum transmission rate R th required to meet the QoS rate requirements.
The optimization variables in P1 contain the NC scheduling parameters u(f k ), potential set of transmitting UDs A, and their adopted power allocations.
Proof. We assume that P1 is not an NP-hard optimization problem, and as a result, there is a polynomial complexity algorithm that can obtain optimal solution to P1. Certainly, it is possible to obtain optimal solution for any special instances of P1. The special instances of P1 can be obtained by relaxing one or more constraints of P1. Let us consider thatP 1 and P 1 are two special instances of P1. In particular,P 1 is obtained by relaxing the NC constraints, andP 1 is obtained by relaxing the power allocation and UD scheduling constraints. One can readily justify thatP 1 boils down to minimizing uncoded completion time for a joint power allocation and UD scheduling problem over interfering D2D channels, which is a known NP-hard problem [19]. On the other hand,P 1 is a NC problem whose objective is to optimally find the file combinations of transmitting UDs, which is also an NPhard problem [17]. Due to the NP-hardness, it is not possible to obtain polynomial complexity algorithm to optimal solve bothP 1 andP 1. Therefore, an optimal polynomial complexity algorithm for P1 does not exist, even when one or more constraints of P1 is relaxed. Essentially we obtain a contradiction with the initial assumption of existence of an optimal polynomial complexity algorithm for P1. Consequently, P1 is an NP-hard optimization problem.
Since P1 is NP-hard, its global optimal solution is intractable for practical systems. To address the computational intractability of P1, in the next section, we analyze the problem and successfully transform it into MWIS problem using graph theory technique.

IV. GRAPH CONSTRUCTION AND PROBLEM TRANSFORMATION
In this section, we first design a novel D2D-RA-IDNC graph to represent the D2D feasible transmissions. Using this designed graph, we transform the problem P1 into a graph theory-based problem. Note that the main reasons of transforming problem P1 to the problem in (6) are as follows: • Reason I: This work proposes a graph-theory based technique that establishes a framework with exact representation of coding decisions and objective transformation. Further, graph theory is self sufficient with numerous proven theorems, and facilitates the analysis and optimization of a problem. It also offers combinatorial techniques allowing the quantitative computation of a problem. Finally, it includes reduction techniques (e.g., maximum weight search methods) that are capable of efficiently analyzing large graphs representing complex problems [30]. Leveraging such advantages, we use graph theory technique to facilitate and transform the initial problem to be solved in the designed novel D2D-RA-IDNC graph. • Reason II: The formulated problem in P 1 is similar to MWIS problems in several aspects. In MWIS, two vertices should be non-adjacent in the graph, and similarly, in problem P 1, same UD cannot be scheduled to two different UDs (i.e., C1). Moreover, the objective of problem P 1 is to minimize the maximum completion time, and similarly, the goal of MWIS is to maximize the number of vertices that have high weights. Therefore, the feasible NC schedules can be considered to be the MWISs. Consequently, we focus on graph-based methods. Therefore, we transform the initial problem P1 to the MWIS problem (6) to be solved efficiently using graph theory. For this objective, we design a novel D2D-RA-IDNC graph that considers all feasible schedules between the transmitting UDs and their file combinations and rates/powers. In what follows, we will construct a graph that allows us to transform problem P 1 into MWIS-based problem.

A. NEW D2D-RA-IDNC GRAPH
In this sub-section, we construct a new weighted undirected graph, referred to D2D-RA-IDNC graph, that considers all possible conflicts for scheduling UDs, such as transmission, network coding, transmission rate, and half-duplex. Let G(V, E) represent the D2D-RA-IDNC graph where V and E stand for the set of all the vertices and the edges, respectively. In order to construct G, we need first to generate the vertices and connect them.
We design the D2D-RA-IDNC graph by generating all vertices for the k-th possible transmitting UD, ∀k ∈ U. The vertex set V of the entire graph is the union of vertices of all UDs. Consider, for now, generating the vertices of UD k. Note that transmitting UD k can encode its IDNC file f k using its previously received files H k . Therefore, each vertex is generated for each single file f ∈ W u ∩ H k that is missed by each UD u ∈ U w and for each achievable rate r of UD k that is defined below. Definition 2: The set of achievable rates R k,u from UD k to UD u is a subset of achievable rates R k that are less than or equal to channel capacity r k,u . It can be expressed by R k,u = {r ∈ R k |r ≤ C k,u and u ∈ U w }.
The above definition emphasizes that the u-th UD can receive a file from transmitting UD k if the adopted transmission rate r is in the achievable set R k,u . Therefore, we generate |R k,u | vertices for a requesting file f ∈ W u ∩ H k , ∀u ∈ U w . In summary, a vertex v k r,u,f is generated for each association of transmitting UD k, a rate r ∈ R k,u , and a missing file f ∈ H k ∩ W u of UD u ∈ U w . Similarly, we generate all vertices for all UDs in U.
Given the above generated vertices, in what follows, we connect them to construct the D2D-RA-IDNC graph. All possible conflict connections between vertices (also known as the conflict edges) in the D2D-RA-IDNC graph are provided as follows. Two vertices v k r,u,f and v k r ,u ,f representing the same transmitting UD k are linked with a coding-conflict edge if the resulting combination violate the instant decodability constraint. This event occurs if one of the following holds.
• The combination is not-instantly decodable, i.e., f = f and (f, f ) / ∈ H u × H u . • The transmission rate is different, i.e., r = r . Similarly, two vertices v k r,u,f and v k r ,u ,f representing different transmitting UDs k = k are conflicting if • The transmission rate is different, i.e., r = r .
• The same UD is scheduled, i.e., u = u . Finally, since we use half-duplex channel, the same UD cannot transmit and receive in the same transmission slot. Thus, two vertices v k r,u,f and v k r ,u ,f are conflicting due to half-duplex channel if k = u or k = u.
In summary, two vertices v k r,u,f and v k r ,u ,f are adjacent by a conflict edge in E if they satisfy one of the following connectivity conditions (CC).
• CC1: k = k and (f = f ) and (f, f ) / ∈ H u × H u . • CC2: r = r . • CC3: k = k and u = u . • CC4: k = u or k = u. Remark 1: For simplicity and unless stated, we use v and v instead of v k r,u,f and v k r,u ,f , respectively.

B. PROBLEM TRANSFORMATION
In this sub-section, we transform the network-coded user scheduling and power optimization problem P 1 into MWIS problem, and consequently, we start by the following definitions. Definition 3: Any independent set (IS) I in graph G must satisfy: i) I ⊆ G; ii) ∀v, v ∈ I, we have (v, v ) / ∈ E. Definition 4: A maximal IS in an undirected graph cannot be expanded to add one more vertex without affecting the pairwise non-adjacent vertices. Definition 5: The independent set I is referred to an MWIS of G if it satisfies: i) I is an IS in graph G; ii) the sum weights of the vertices in I offers the maximum among all ISs of G. Therefore, the MWIS will be denoted as I. Based on the aforementioned designed D2D-RA-IDNC graph and definition of MWIS, we have the following proposition. Proposition 1. The problem of minimizing the approximated completion time in P 1 at the t-th transmission slot is equivalently represented by the MWIS selection among all the ISs in the G graph, where the original weight ω o (v) of each vertex v is given by where d u is the order of UD k in the group that arranges all UDs in U w (t) in decreasing order of lower bound on completion times [21].
Proof. In order to prove this proposition, we first need to sufficiently show that there is a mapping between the set of maximal ISs in the D2D-RA-IDNC graph and the set of feasible transmissions. Then, the weight of each IS is the objective function to P1. As mentioned earlier, the formulated problem in P 1 is similar to MWIS problems. Thus, it is sufficient to show that there exists a one-to-one mapping between the set of feasible transmissions and the set of ISs in the D2D-RA-IDNC graph. From the configuration of the D2D-RA-IDNC graph, it can readily be seen that the feasible transmissions between different transmissions are non-adjacent, i.e., the condition CC3. Since each feasible transmission by a transmitting UD is an IS and they are non-adjacent, then the union of both sets is also an IS. Therefore, all vertices in the sub-graph representing transmitting UD k are nonadjacent to vertices in the sub-graph of transmitting UD k as long as the targeted UDs are distinct. Therefore, each feasible association between targeted UDs-transmitting UDs, file combinations, and the transmission rate is represented by a maximal IS. Conversely, it can readily be seen that each IS represents a feasible condition as it does not violate the connectivity conditions CC1, CC2, CC3, and CC4. Indeed, for I, the transmission of the combination u k = ⊕ v∈I f by transmitting UD k at rate r is instantly for all UDs u(f k ) = ∪ v∈I u.
To conclude the proof, we show that the weight of the IS is the objective function of P 1. Let the weight of vertex v be defined as in (5) and I be the set of maximal ISs in the D2D-RA-IDNC graph G. Consider I ∈ I is the MWIS that has the maximum vertex weights. By the designed graph G, all the feasible decisions of transmitting UDs, transmitted files and transmission rates/powers are mapped to the set of all maximal ISs. Consequently, the completion time minimization problem can be reformulated as a maximal IS selection problem in graph G such as arg max Consequently, the problem of choosing transmitting UDs, file combinations, and transmission rates/powers that results in minimizing the completion time is equivalent to the MWIS selection problem over the D2D-RA-IDNC graph.
It is readily known that finding the MWIS is NP-complete problem [22]. Consequently, solving Proposition 1 is NPhard. In the next section, we greedily select a maximal IS using the vertices' weights defined in (5).

V. PROPOSED SOLUTION
In this section, we develop an efficient CLNC solution that judiciously selects multiple transmitting UDs simultaneously and their coding decisions and transmitting rates/powers. As shown in SINR expression, the increase in the number of transmitting UDs also increases interference of a transmission channel caused by multiple transmitting UDs and therefore, reduces the channel capacity. To control the deleterious impact of interference on channel capacities, a power allocation mechanism is employed that efficiently selects the set of transmitting UDs and allocates the transmitting power to the transmitting UDs such that: (1) a large number of UDs can be targeted with an IDNC combination, and (2) the channel capacities of the transmitting UDs to the targeted UDs still improves the objective function. The overall steps of our proposed solution are as follows. We first present a power allocation algorithm for the given set of transmitting UDs and the scheduled/targeted UDs to these transmitting UDs. Next, we provide a greedy algorithm that selects a set of transmitting and targeted UDs considering known/predefined power allocations. Finally, by combining the aforementioned algorithms, we present an innovative CLNC solution.

A. TRANSMIT POWER ALLOCATION ALGORITHM
In this sub-section, we derive optimal power allocations to maximize sum-throughput for a given set of transmitting UDs. We assume that the system has A transmitting UDs, i.e., A = {1, 2, · · · , A} and the UDs receiving data from the k-th transmitting UD is denoted by the set u(f k ). The power optimization problem to maximize the sum-capacity of A transmitting UDs is formulated as where U k = u∈u(f k ) log 2 (1 + SINR k,u ). The nearoptimal power allocation for the k-th transmitting UD is obtained in the following proposition.
Proposition 2. Let Q k be the given transmit power of the kth transmitting UD at the l-th iteration. A converged power allocation is obtained by updating power at the (l + 1)th iteration, ∀t, according to the following power update equation where SINR m,j , ∀m, j, is obtained by applying the value Q m in the expression of end-to-end SINR.
Proof. Although (7) is a non-convex power allocation problem, a local optimal solution to (7) can be obtained by obtaining the stationary point of the objective function. To obtain a stationary power allocation for the u k -th transmitting UD, we need to solve ∂U k ∂Q k = 0. In particular, we obtain Update the power allocation of the k-th transmitting UD, ∀k, by applying (8). 5: Set Q k = Q k , ∀k = 1, 2, · · · A, and l = l + 1 6: until Objective function of (7) converges or l > l max . 7: Output: Final transmission power for all the transmitting UDs.
Therefore, by solving ∂U k ∂Q k = 0, we obtain By solving (10), one can obtain the stationary point for the objective function of the k-th transmitting UD, ∀k. However, a closed-form power allocation by solving (10) is intractable. Accordingly, we adopt an iterative approach to obtain a nearoptimal stationary power allocation. To this end, we denote Q k as the given power allocation for the k-th transmitting UD, ∀k, and evaluate the R.H.S. of (10) for the given power allocations. Finally, by projecting R.H.S of (10) to the feasible region of the power allocations, we obtain (8).
Based on Proposition 2, an iterative algorithm to obtain transmit power allocations for a given set of transmitting UDs is provided as Algorithm 1. The convergence of Algorithm 1 is justified as follows.
Proposition 3. Algorithm 1 provides a stable and local optimal solution to (7).
Proof. We can proof Proposition 2 by resorting to the game theory. In fact, the proposed power allocation update can be considered as a non-cooperative power control game (NCPCG) where each transmitting UDs act as a rational and selfish player, and wants to maximize its utility by choosing the best possible power allocation strategy. To this end, the utility function of the k-th transmitting UD is given at the top of the next page, where Q −k denotes the power allocation for the transmitting UDs other than the k-th UD.
The utility function has two parts where the first part is the payoff in terms of the achievable throughput and the second term is the payoff for creating less interference to the other players in the system. Obviously, the first and second terms monotonically increase and decrease with the increase of transmission power, Q k , respectively. We denote the R.H.S of (8) as F k { Q k } . We can readily demonstrate that if Q k < From [24,Theorem 3.2], for a non-cooperative game with quasi-concave utility functions, a Nash-equilibrium (NE) point must exists and it is obtained as the best response strategy of the players in the game. Note that, in an NE point, no player can improve its utility by taking an alternative strategy, and consequently, the overall solution must converge. We can easily justify that (8) is same as the best response strategy of the k-th transmitting UD, ∀k. Consequently, the iterative power allocation procedure, given in Algorithm 1, must converge to a stable point. We also emphasize that (8) is derived by satisfying the Karush-Khun-Tucker (KKT) conditions for (7). Hence, a stable power allocation that is obtained by iteratively solving (8) also converges to a local optimal solution to (7). Accordingly, Algorithm 1 provides a stable and local optimal solution to (7) 1 .

B. GREEDY MAXIMAL INDEPENDENT SET SELECTION ALGORITHM
In this sub-section, we propose a maximal IS selection algorithm based on a greedy vertex search in the D2D-RA-IDNC graph and the priority of vertices defined in Proposition 1. Let E v,v be the adjacency connector of vertices v and v in graph G such that Further, let g v denote the weighted degree of vertex v, which can be expressed as is the priority of vertex v defined in (5). Finally, the modified weight of vertex v is defined as To this end, at each step, the vertex search method adds a new vertex based on the maximum weight. Essentially, a vertex v * that has the maximum weight ω m (v * ) is selected and added to the maximal independent set I (i.e., I = {v * }). Then, the subgraph G(I), which consists of vertices in graph G that are not connected to vertex v * is extracted and considered for the next step. Next, a new maximum weight vertex v * is selected from subgraph G(I). We repeat this process until no more vertices that are not connected to all the vertices in the maximal independent set I. The steps of the greedy vertex search selection are summarized in Algorithm 2.
The transmitting UD in I generates a coded file by XORing all the files identified by the vertices in I. It also adopts the transmission rate corresponding to the vertices of I. It is worth mentioning that the MWIS I and its corresponding modified weights in (12) provide the following potential benefits.
• The modified weight of each vertex in I shows the following. The first term r B provides a balance between the transmission rate/power and the number of scheduled UDs to transmitting UD k. The second term ,n =k,m Q n |γ n,j | 2 + Q k |γ k,j | 2 2 Uw−du+1T u (t) classifies the UDs based on their completion time lower bounds. As such, we give them priority for scheduling. More importantly, through the weighted degree g, the modified weight of a vertex v has a large original weight and it is not connected to a large number of vertices that have high original weights. • Each UD is scheduled only to a transmitting UD that cached one of its missed files. • The transmitting UD delivers an IDNC file with an adopted transmission rate/power that provides a lower completion time to a set of UDs. This adopted rate ensures the QoS rate guarantee and ensures successful decoding at all the scheduled UDs.

C. CROSS-LAYER NC SOLUTION
The transformed problem in (6) is an NP-hard problem. Thus, solving it optimally needs an exhaustive search over O(|V| 2 .2 |V| ) where V is the number of vertices in the graph. In other words, it needs to find all maximal-weight independent sets possibilities in the graph, which increases exponentially with the number of vertices [32]. Finding the optimal solution using stochastic shortest path (SSP) solvers for a reasonable D2D network of 8 8 × 3 = 8.2 × 10 31 action space (for more details about the SSP, see [17]). This justifies our resorting to the design of the heuristic algorithms for reasonable network settings.
The iterative proposed CLNC solution maximizes the weighted sum rate subject to completion time reduction constraints, i.e., the problem of determining transmitting UDs and their transmission rates/powers and the transmitted file combinations in a coordinated fashion. Particularly, we iterate between solving the completion time reduction problem for fixed transmit power and optimizing the power level for a given scheduling of completion time reduction. The main philosophy of this heuristic is to iteratively include more transmitting UDs and allocate transmission powers subject to the reduction in the completion time. At each iteration, it first determines the scheduled UDs by the set of chosen transmitting UDs as described in Algorithm 2. Then, given the resulting network-coded user scheduling, it executes a power allocation algorithm to determine the power level of the transmitting UDs that maximizes the sum-rate and minimizes the completion time as described in Algorithm 1. The steps of the proposed iterative solution is described as in Algorithm 3.
In Algorithm 3, A is the set of selected transmitting UDs, M w is the set of UDs having non-empty Wants set, and X is Select v * = arg max v∈G(I) {ω m (v * )}.

7:
Set I ← I ∪ v * .  Proof. At each iteration of the proposed Algorithm 3, the set of transmitting UDs is updated. Let denote A (i) be the set of transmitting UDs at the i-th iteration of Algorithm 3, and R A (i) is the sum-rate of the network with the A (i) set of transmitting UDs. Recall, only a finite number of UDs can be the transmitting UDs in a given TS. Thus, the set of transmitting UDs is evolved as Note that A (1) contains only one transmitting UD. Particularly, the proposed scheme initially selects a transmitting UD with maximum number of potential receiving UDs, and such a transmitting UD is included in A (1) . Subsequently, at each iteration Algorithm 3 adds one more transmitting UDs with the existing set of transmitting UDs given that the total sum-rate is improved. To this end, at each iteration, Algorithm 3 updates the power allocations of all the transmitting UDs to maximize the overall sum-capacity. Essentially, at each iteration of Algorithm 3, the sum-rate is non- (1) . Recall that the interference free solution of [21] selects only one transmitting UD each TS. Thus, the achievable sum-rate of the interference free solution of [21] is given by R A (1) . Hence, the proposed CLNC solution achieves an improved sum-rate compared to the interference free solution of [21].
Remark 2: By exploiting power allocation and timevarying channel of the UDs, the proposed CLNC solution activates multiple transmitting UDs at each TS. However, for severely strong inter-device interference channel, the power allocation may not improve the sum-capacity. In this case, the proposed solution activates only one transmitting UD. Consequently, the the interference free solution of [21] is Construct the D2D-RA-IDNC graph using Section IV-A by considering using M w as the set of potential transmitting or targeted UDs. 6: Select maximal independent set I using Algorithm 2. Let the transmitting UD be u k , the file combination be f in the maximal independent set I, and the set of potential targeted UDs by k be u(f k ).

7:
Compute the lower bound on the individual completion time of targeted UDs in X set using (3) and increase delay of the non-targeted UDs in M w \X by B r(t) .

9:
Consider the UDs in M w \({k} ∪ X (f k )) as future transmitting UDs or more targeted UDs. 10: Compute the SINRs by setting the transmission power as Q o and considering interference from the UDs in the set A.

11:
Optimize the transmission power of the transmitting UDs A using Algorithm 1 to maximize the sum-capacity. 12: If the sum-capacity is improved, A ← A ∪ u and M w ← M w \ u. 13: if |A| > 1 then 14: For each receiving UD, u, compute R u . If R u ≥ R th and u / ∈ X , update X ← X ∪u and M w ← M w \u. On the other hand, if R u < R th and u ∈ X , update X ← X \ u and M w ← M w ∪ u. Repeat this step ∀u ∈ u(f k ) and ∀k ∈ A. 15: end if 16: ∃k ∈ A such that the none of UDs in u(f k ) set satisfies the rate constraint, M w ← M w ∪ k and A ← A \ k. 17: RecomputeT and store the solution that achieves the minimum completion time. 18: until No UDs can be added to the set A. 19: Output: Overall completion timeT. a special case of the proposed CLNC solution. Hence, the proposed CLNC solution always achieves a lower completion time compared to the interference free solution.
Remark 3: When we schedule many UDs to the transmitting UDs, the number of targeted UDs is increased from the side information optimization, however, the sumcapacity may not be maximized. Consequently, we optimize the power/rate of the transmitting UDs to maximize the sum-capacity. Thus, our CLNC solution not only increases the number of targeted UDs, but also maximizes the sumcapacity.

D. SOLUTION EXAMPLE
This example considers a simple D2D system that is shown in Fig. 1. For simplicity of constructing the D2D-RA-IDNC graph, we consider the CSM of the first two UDs 1, 2 as follows: Clearly, this graph considers all possible D2D conflicts that represented in P1 and thus each possible maximal IS is a NC solution to P1. One possible maximal IS I in this graph is {v 1 2.5,4,4 , v 1 2.5,6,1 , v 2 2.5,3,4 }. Note that the CBS judiciously finds an efficient joint NC and UD scheduling solution for the problem P1. If no network-coded user scheduling solution satisfies the constraints, the CBS selects uncoded (without NC) solution where each transmitting UD serves only one UD.

E. COMPLEXITY ANALYSIS
For any arbitrary D2D network setting and at any iteration of the proposed algorithm, we need to construct the D2D-RA-IDNC graph, calculate the power allocation of the transmitting UDs, and find the MWIS.
Since each UD has received only a set of files, the total number of vertices in D2D-RA-IDNC graph corresponding to that UD is V = |H| × U , where |H| is the average number of the received files by UDs. Therefore, we construct the D2D-RA-IDNC graph for all UDs by generating O(V U ) vertices. Building the adjacency matrix needs a computational complexity of O(V 2 U 2 ). For the vertex search algorithm, first we need to calculate the weights of all vertices, and then finding the MWIS. It is easy to show that all UDs having vertices in the independent set have the same transmission rate as they initially corresponding to the same transmitting UD. Thus, the algorithm needs |R| maximal ISs. Note that each maximal IS has at most V vertices as each UD can be targeted by at most one file (i.e., one vertex for each targeted UD) per transmission. Each iteration with a given rate needs a complexity of O(V U ) for weight calculations of the MWIS. It also needs searching for at most U − 1 vertices. Then, the complexity of the algorithm for finding the maximal ISs for all rates and their sum weights, at most, The computational complexity of constructing the D2D-RA-IDNC graph, building the adjacent matrix, and finding the On the other hand, calculating the power allocation for any fixed D2D schedule needs C p = O(|u 1 | × |u 2 | × · · · |u K |). Finally, Algorithm 3 iterates between constructing the D2D-RA-IDNC graph and finding its corresponding MWIS and optimizing power levels of the transmitting UDs, thus leading to an overall computational complexity of O(L(V 2 U 2 + C p )), where L is the number of iterations.
Finally, the transmission overhead that the CBS needs to run Algorithm 3 can be analyzed as follows. Since the UDs report to the CBS about the received and the missed files at their side, all side information is known to the CBS. Clearly, such error-free acknowledgments (ACKs) need a few bytes. Thus, compared to the standard LTE uncoded solution, no additional overhead is needed for the coded UDs-transmitting UDs scheduling scheme. However, the coded solution may need overhead for the headers of each transmitting UDs encoded transmission (to inform transmitting UDs of the XORed files in any transmission), which is negligible in size compared to the entire file's size.

VI. NUMERICAL RESULTS
In this section, we present some numerical results that compare the completion time performance of our proposed CLNC scheme with existing coded and uncoded schemes. We consider a D2D network where UDs are distributed randomly within a hexagonal cell of radius 500 m [21]. We assume the channel gains between UDs follow the standard path-loss model, which consists of three components: 1) path-loss of 148+37.6 log 10 (d k,u ), where d k,u represents the distance between k-th UD and u-th UD in km; 2) log-normal shadowing with 4 dB standard deviation and 3) Rayleigh channel fading with zero-mean and unit variance. We consider that the channels are perfectly estimated. The noise power and maximum' UD power are assumed to be −174 dBm/Hz and Q max = −42.60 dBm/Hz, respectively, and the bandwidth is 1 MHz. Unless otherwise stated, we initially consider that each UD already has about 45% and 55% of F files for the considered schemes. To evaluate the performance of our proposed scheme with different thresholds (R th1 = 0.5 Mbps, and R th2 = 5 Mbps), we simulate various scenarios with different number of UDs, number of files, file sizes, and demand ratio of UDs. These thresholds represent the minimum transmission rates required for QoS. The performances of our proposed scheme for R th1 = 0.5 and R th2 = 5 are shown in solid and dash red lines, respectively. In all simulations, we consider the time for sending all missing files to all UDs until completion, and the presented values of the completion time in the figures are averaged over a large number of iterations.
For the sake of comparison, our proposed scheme is compared with the following existing schemes.
is missing at the largest number of other UDs. In this scheme, the transmitting UD adopts a transmission rate that is equal to the minimum channel capacity of all its assigned UDs. • Cooperative RLNC: This RLNC algorithm picks the UD with the highest side information rank as the transmitting UD in a D2D transmission [25]. The picked UD encodes all files using random coefficient from a large Galois field. However, this algorithm discards the dynamic transmission rates and for the transmission to be successfully received by all other UDs, the minimum channel capacity from the transmitting UD to all other UDs is adopted as the transmission rate. • Cooperative IDNC: This IDNC algorithm considers cooperation among UDs and jointly selects a set of transmitting UDs and their XOR file combinations [11]. However, this algorithm focuses on serving a large number of UDs with a new file in each time index to reduce the overall completion time. Due to ignoring the dynamic rate adaptation, the minimum channel capacity from the transmitting UDs to all targeted UDs is adopted as the transmission rate.
For completeness of this work, we also compare our proposed scheme with the recent RA-IDNC work in [21]. In this scheme, RA-IDNC scheme is employed for D2D network that allows only one transmitting UD to transmit at a time.
In Fig. 3, we depict the average completion time versus the number of UDs U . We consider a D2D model with a frame of 20 files and a file size of 1 Mbits. From this figure, we can observe that the proposed CLNC scheme offers an improved performance in terms of completion time minimization as compared to the other schemes for all considered number of UDs. This improved performance is due the fact that our proposed scheme judiciously selects potential UDs for transmitting coded files to a set of scheduled UDs, adopts the transmission rate, and optimizes the transmission power of each transmitting UD. This in turn aides the file combination selection process. The uncoded broadcast scheme sacrifices the rate optimality by scheduling the maximum number of UDs. Although uncoded scheme needs a fewer number of transmissions, at least F transmissions, it requires longer transmission durations for completion. This leads to a high completion time. On the other hand, the RA-IDNC scheme improves the selection of file process by adapting the transmission rate, but it suffers from activating only one transmitting UD at each transmission slot. This is a clear limitation of the RA-IDNC scheme as it does not fully exploit the simultaneous transmissions from multiple UDs. The proposed CLNC scheme strikes a balance between the aforementioned aspects by jointly selecting the number of targeted UDs and the transmission rate of each transmitting UD such that the overall completion time is minimized. This results in a full utilization of simultaneous transmissions from multiple transmitting UDs. Consequently, an improved performance of our proposed scheme compared to the RA-  IDNC scheme is achieved. Moreover, our proposed scheme improves the transmission rate using power control on each transmitting UD. In Fig. 4, we show the average completion time versus the number of files F . Fig. 4 considers different sizes of frames. The simulated D2D system composed of 20 UDs and file size of 1 Mbits. For the same reason as mentioned for Fig. 3, our proposed scheme outperforms other schemes. It can be observed from the figure that increasing the frame size leads to an increased completion time of all schemes. This is because for few files, the opportunities of mixing files using IDNC in the proposed and other NC schemes are limited. As a result, all NC schemes have roughly similar performances. As the number of files increases, the increase in the completion time with our proposed scheme is low. This is due to the fact that our proposed scheme judiciously allows each transmitting UD to decide on a set of files to be XORed. As such, they are beneficial to a significant set of UDs that have relatively good channel qualities. Note that uncoded broadcast and RLNC schemes complete frame transmissions in fewer transmissions (F transmissions) than our developed scheme. However, each of their transmission durations is longer than a single transmission of the proposed schemes since they are adopting the transmission rates to the minimum of all achievable capacities. In Fig. 5, we plot the average completion time versus the file size B for a D2D system composed of 20 UDs and 15 files. Essentially, Fig. 5 shows how long it takes for the proposed solution to recover all missing files to all UDs with different sizes. Since the completion time linearly increases with the file size as explained in Corollary 1, the performances of all schemes increase linearly with B. It can be observed that the proposed scheme in all above figures outperforms all other schemes for different rate thresholds as shown with red lines. As the rate threshold increases, the completion time improvement increases. This is due to the fact that as the rate threshold increases, a certain number of UDs is scheduled and the transmission rate of the transmitting UDs becomes high. Thus, the completion time minimization of our proposed scheme becomes more noticeable.
In Fig. 6, we illustrate the impact of changing the demand ratio µ on the average completion time. This ratio represents the demand portion of the requested files of UDs. In this figure, we simulate the D2D system composed of 10 UDs and 8 files each with a size of 1 Mbits. We can observe that the completion time performance of our proposed scheme outperforms the performances of other schemes for the whole range of µ. It can be seen from the figure that increasing the demand ratio leads to an increased completion time of all schemes. This is because for high demand ratio, the number of transmissions for transmitting all the files to all the UDs of all schemes increases. As a result, the completion time performance of the considered schemes increases. In Fig. 7, we study the average completion time versus the initially available files ratio σ. We consider a D2D network composed of 20 UDs and 20 files, where each file has a size of 1 Mbits. From the figure, we can see that our proposed scheme outperforms all other schemes in terms of average completion time. It can clearly be seen that when σ ≤ 0.55 (few available files), the average completion time performances of all schemes are high. This is because a small portion of the requested files are available at the UDs, and consequently, more transmissions are needed to deliver the missed files. Thus, the completion time of all schemes is increased. However, as the initially available files increases (σ ≥ 0.75) where most of the UD' missed files are downloaded, the completion time performances of all schemes are decreased. This is becasue transmitting UDs have good opportunities to combine significant sets of files to target many UDs.
In Fig. 8, we plot the average completion time versus cell radius C. This figure considers different fully connected models, i.e., short-range D2D communications, moderaterange D2D communications, and high-range D2D communications. We consider a network composed of 20 UDs and 20 files, where each file has a size of 1 Mbits. From the figure, 15 This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and we can see that our proposed scheme has an improved performance compared to other considered schemes. It can clearly be seen that the completion time of considered schemes increases with the distance between UDs. This is because the completion time mainly depends on the transmission rate of the transmitting UDs, which is reduced as the distance between the UDs is increased. Note that the channel gains of UDs are mainly dominated by the distances between UDs within the service area. In Fig. 9, we illustrate the performance of our proposed scheme and optimum solution (obtained using exhaustive graph theoretical search over all possible MWISs) versus the number of UDs U for a small network of 15 files, and each file has a size of 1 Mbits. It is seen that the proposed scheme achieves near-optimum performance. This is because it greedily selects the updated MWIS in the network and performs an efficient optimization of UD scheduling and power allocation.
Finally, we provide some observations from our presented simulation results as follows. First, it is always beneficial from network-layer perspective to schedule many UDs with IDNC files as in the classical IDNC scheme. However, selecting the minimum transmission rate of all the scheduled UDs degrades the completion time performance of the classical scheme. Second, although the uncoded brodcast and RLNC schemes schedule almost all the UDs, they adopt the transmission rates to the minimum of all the scheduled UDs. Thus, its completion time performance is degraded, especially for large-scale network since selecting the the minimum transmission rate of an increasing set is always diminishing. Third, RA-IDNC scheme overcomes the limitations of the aforementioned schemes but suffers from selecting only one transmitting UD. This limitation further degrades the completion time performance of the RA-IDNC scheme in large network sizes. This is due to the fact that RA-IDNC scheme always selects one transmitter regardless of the size of the network. Conversely, our proposed transmission framework has a clear-cut advantage over the benchmark schemes as it considers different transmitting UDs and optimizes the employed rates using power control on each transmitting UD.

VII. CONCLUSION
In this paper, we have studied the joint optimization of CLNC and D2D communications for the file recovery phase with the goal of minimizing the completion time while guaranteeing UD's QoS, subject to the required minimum rate, power allocation, and NC constraints. The completion time minimization problem in interference-allowed setup is solved over a set of transmitting UDs, their power allocation, dynamic rate selection, and transmitted file combinations. By using a graph theory technique, we proposed a novel and efficient approach that uses cross-layer NC for power optimization and UDs coordinated scheduling in D2D networks. Specifically, our proposed solution judiciously iterates between finding the MWIS in the D2D-RA-IDNC graph and optimizing the power allocation, subject to the resultant interference of the newly added transmitting UDs. Simulation results show that the proposed interference-allowed solution considerably reduces the completion time compared to the interference-free solution as well as conventional network coding algorithms.