## 3 D2D-Based Resource Allocation Algorithms
### Delay Minimization Conflict Graph
This approach ensures an efficient allocation of resources while maintaining fairness among all users. The delay minimization conflict graph (DMCG) algorithm [27] is a resource allocation method that leverages D2D communication in wireless networks. The algorithm optimizesthe estimated delay as a utility function to allocate idle resources of the CUEs to the DUEs while respecting mutual interference constraints. The DMCG algorithm, illustrated in Algorithm 1, aims to minimize the estimated delay limit for each user while considering mutual interference constraints. The method starts by randomly allocating idle resource blocks to each D2D pair. The algorithm then decides whether to reuse the resource blocks of the CUEs. Unmarked peer groups are created and follow the same process as in GTM+ (described in Section 3.1), removing pairs of DUEs that cannot coexist due to high mutual interference and keeping D2D pairs that minimize system delay. The approach entails the selection of candidates through the identification of the maximum independent weight set within the conflict graph \(G_{m^{\prime}}\). This method effectively eliminates D2D pairs that cannot coexist due to substantial mutual interference, retaining those pairs that contribute to minimizing system delay. A notable divergence between the DMCG and GTM+ algorithms lies in the fact that the former employs the estimated delay function as a utility function rather than network throughput. ```
\(M\) CUEs, \(N\) DUEs, \(K\) Idle Resource Blocks; /* \(U\) is the set of unmarked groups */ \(U\leftarrow\{1,2,...,M\}\); /* \(\Gamma\) is the set of DUEs that join the group \(m\)*/ \(\Gamma_{1},\Gamma_{2},...,\Gamma_{M}\gets 0\); */ for\(n\in\{1,2,...,N\}-\{\delta_{1},\delta_{2},...,\delta_{K}\}\)do /* Run Algorithm 2*/ \(m^{*}\gets OptimizeDelay(n,U)\); /* \(D_{n}\) join the group \(m^{*}\)*/ \(\Gamma_{m^{*}}\leftarrow\Gamma_{m^{*}}\cup\{n\}\);  end for while\(U\
eq 0\)do  Forms the conflict graph \(G_{m^{*}}\) for the largest group \(\Gamma_{m^{\prime}}\) in \(U\) \(\Delta_{m^{\prime}}\leftarrow\) set maximum weight independent of \(G_{m^{\prime}}\) for\(n^{\prime}\in\Delta_{m^{\prime}}\)do /* Checks if the DUE pair \(n^{\prime}\) meets the SINR requirement */ if\(P_{m^{\prime}}G_{m^{\prime}n^{\prime}}+\Sigma_{n\in\Delta_{m^{\prime}}-\{n^{ \prime}\}}P_{n}G_{m^{\prime}}\geqslant I_{n^{\prime}}\)then  Removes \(n^{\prime}\) from \(\Delta_{m^{\prime}}\)  end if  end for /*In descending order, sort the DUEs in \(\Delta_{m^{\prime}}\) by their interference in \(C_{m^{\prime}}\)*/ /* Removes one DUE from \(\Delta_{m^{\prime}}\) until the maximum tolerable interference constraint \(I_{m^{\prime}}\) is met */ while\(\Sigma_{n\in\Delta_{m^{\prime}}}P_{n}G_{n\geqslant I_{m^{\prime}}}\)do  Removes the first element from \(\Delta_{m^{\prime}}\)  end for for\(n\in\Gamma_{m^{\prime}}-\Delta_{m^{\prime}}\)do /* Run Algorithm 2*/ \(m^{*}\gets OptimizeDelay(n,U-\{m^{\prime}\})\); /* \(D_{n}\) join the group \(m^{*}\)*/ \(\Gamma_{m^{*}}\leftarrow\Gamma_{m^{*}}\cup\{n\}\);  end for /* Group \(m^{\prime}\) is marked */ \(U\gets U-\{m^{\prime}\}\);  end for
```  
**Algorithm 1**DMCG