# Three-Dimensional Resource Allocation in D2D-Based V2V Communication
## 3 Matching and Resource Block Allocation Scheme
### Optimal Power Allocation
For example, a CUE acts as an independent interferer to another CUE and thus forms an edge. If a CUE satisfies the equation in Table 4, it forms an edge with a V2V and V2I link. In order to find the independent and cumulative interferers, we first define the signal-to-interference ratio (SIR) to be under a threshold. Table 4 summarizes the equations used for the construction of a graph. The threshold SIR is selected in order to determine the severity of the interference at the eNB. The groups in hyper edges can be of varying size. In the example shown in Figure 4, a group of three vertices is considered in a hyper edge. The next step is to apply the coloring algorithm to the vertices. Since the problem is non-convex due to the presence of constraints in the optimization problem, it is an NP-hard problem. Using the greedy coloring algorithm, we can \begin{table}
\begin{tabular}{c c} \hline \hline
**Independent Interferers** & **Cumulative Interferers** \\ \hline \(\frac{p_{j}^{j}l}{p_{k}^{k}S_{ij}^{k}}\leq\eta\)J & \(\frac{p_{j}^{j}l}{p_{k}^{k}S_{ij}^{k}}\leq\eta\)J & \(\frac{p_{j}^{j}l}{p_{k}^{k}S_{ij}^{k}}\leq\eta\)J \\ \(\frac{p_{k}^{k}l_{k}^{k}}{p_{k}^{k}S_{ij}^{k}}\leq\eta\)K & \(\frac{p_{k}^{k}l_{k}^{k}}{p_{k}^{k}S_{ij}^{k}}\leq\eta\)K & \(\frac{p_{k}^{k}l_{k}^{k}}{p_{k}^{k}S_{ij}^{k}}\leq\eta\)K \\ \(\frac{p_{j}^{k}l_{k}^{k}}{p_{k}^{k}S_{ij}^{k}}\leq\eta\)L & \(\frac{p_{j}^{k}l_{k}^{k}}{p_{j}^{k}S_{ij}^{k}}\leq\eta\)L & \(\frac{p_{j}^{k}l_{k}^{k}}{p_{k}^{k}S_{ij}^{k}}\leq\eta\)L \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Independent and cumulative interferer thresholds. Figure 4: An example of hypergraph-based matching and channel allocation. #### 3.2.1 Matching Using Hypergraphs

In order to solve the matching problem, we need to know that it is a k-dimensional matching problem which is NP-hard. In [11], a local search-based 3D matching method was presented which solved the 3D matching problem using a hyper and conflict graph with a local search based on k-claw. In [15], a graph-based resource sharing mode in vehicular communication is presented. The author proposes 3-dimensional matching with the clustering of highly interfering V2V users. Furthermore, the authors considered slow-fading channel state information (CSI). A comparison between greedy, randomized, and baseline graph resource allocation had been drawn. However, this paper considers RB and two types of users for 3-dimensional matching. In our paper, we have used 3-dimensional matching among the three different types of users by first creating an adjacency matrix, which is a weighted 3-dimensional matrix that looks for resource block sharing among the three types of users, where each RB is not assigned twice to a user of the same type. Figure 5a is a visualization of the adjacency matrix; the black diagonal shows that the same types of users cannot occupy one RB simultaneously. We call this adjacency matrix the indictor matrix 'W'. This matrix is multiplied with the rate matrix 'R'. Unlike [11], we have already obtained the optimal power in the last section, and we used that to obtain the rate matrix 'R'. The multiplication of the rate matrix with the indicator matrix will result in all possible rates. #### 3.2.2 RB Allocation Using Graph Coloring

In this section, we have performed graph coloring based on the adjacency matrix. The adjacency matrix is a 3-dimensional matrix created by using Table 4. Figure 5 shows the adjacency matrix and the independent interferers. The all-black diagonal region shows that users of the same types act as independent interferers to each other (hence causing interference), and the white and black region shows that the user can either be an independent interferer to another type of user or it has no relation (no interference) to another user. Users who are independent interferers are connected to each other through an edge and assigned a different color, as shown in Figure 5b, along with the frequency of the colors used for the coloring. This ensures that the users never share the same color (same RB).