## 3 D2D-Based Resource Allocation Algorithms
### Delay Minimization Conflict Graph  
This algorithm aims to optimize resource allocation by considering the channel transmission quality, the maximum delay criterion, and the delay estimate, with the goal of reducing the average delay of the system. To estimate the delay, the algorithm uses concepts from deterministic network calculation, service curve, and envelope process multi-fractal bounded arrival process (MFBAP) [22; 23]. Deterministic network calculation is used to estimate resources and provide a good quality of service for networks. The envelope process for packet arrival traffic is an upper bound for the actual accumulated packet traffic process. In the case of the deterministic envelope process, the limiting function \(\hat{A}(t)\) that corresponds to the maximum value of a flow \(A(t)\) In the time interval \([s,s+t]\), can be expressed as shown in Equation (2). \[\hat{A}(t)=\underset{s\geq 0}{\sup}A[s,s+t] \tag{2}\]  
Employing MFBAP as a deterministic alternative [24], Equation (3) is derived, where \(H(t)\) represents the Holder exponent, \(t\) denotes the time instant, \(\bar{a}\) and \(\sigma\) stand for the mean and standard deviation of the incoming traffic, \(k\) is the constant associated with the probability of violation (for \(\varepsilon=10^{-6}\)) of the envelope process, and \(B\) indicates the buffer size. \[\hat{A}_{MFBAP}(t)=\bar{a}t+k\sigma t^{H(t)}+B \tag{3}\]  
Therefore, the estimated upper delay limit \(\hat{d}\) is calculated according to Equation (4), where \(A^{*}\) is the MFBAP envelope process, and \(S\) is the system's service curve. \[\hat{d}=\inf\{d\geq 0|\forall t\geq 0:A^{*}(t-d)\leq S(t)\} \tag{4}\]  
The service curve \(S_{n}(t)\)[25] can be written as in Equation (5), where \(c\) is the mean service rate in the system's server, and \(N\) is the number of time intervals \(T\) per complete cycle \(P\), where \(P=\frac{t}{NT}\). \[S_{n}(t)=cTP+cT\text{min}\bigg{\{}\frac{\text{max}[t-PNT-(n-1)T;0]}{T};1\bigg{\}} \tag{5}\]  
To optimize the resource allocation and minimize delay in wireless networks, this study utilizes the scheduling algorithm presented in [26]. The algorithm consists of three phases. In the first phase, it estimates the required number of scheduling blocks (SB) for each user and prioritizes them based on the average channel gain. Next, it allocates SBs to the users, following the prioritization and ensuring compliance with the estimated delay limit and maximum delay criterion. Finally, any remaining SBs are allocated to users according to their estimated delay priority. The resource allocation follows a priority scheme, with users ranked in increasing order based on their average channel gain. The average channel gain \(G_{k}\) for user \(k\) is calculated using Equation (6), where \(g_{k,n}\) is the average channel gain for the user in the \(n\)th SB, and \(N\) is the total number of available SBs. \[G_{k}=\frac{1}{N}\sum_{n=1}^{N}g_{k,n} \tag{6}\]  
The amount \(N_{k}\) of SBs required for each user \(k\) is calculated according to Equation (7). \[N_{k}=round\bigg{(}\bigg{(}\frac{G_{k}}{G_{1}+G_{2}+\cdots+G_{k}}\bigg{)}*N \bigg{)} \tag{7}\]  
The algorithm presented in [26] allocates the scheduling blocks (SBs) based on the channel quality and delay requirements of each user. The allocation priority is determined by estimating the number of SBs required for each user, based on the average channel gain, as shown in Equation (7). The SBs with the highest signal quality indicator are then allocated to the users based on their estimated number of required SBs. In addition to the quality-of-service requirements, the method also considers the delay limit for each user. The algorithm estimates and checks the delay limit for each allocation, ensuring that it satisfies the stopping criterion. The allocation process continues until the stopping criterion is met, guaranteeing the fair allocation of resources based on the channel quality and delay requirements of each user.