## 1 Introduction  
The number of devices connected is increasing exponentially [1], creating a bottleneck in cellular networks that is becoming unsustainable [2]. In this sense, 5G can provide support to overcome these problems. The 5G technology [3, 4] provides connections with higher rates and less latency when compared with 4G [5]. The world with 5G and beyond 5G technology will allow advances in several areas such as virtual reality, autonomous cars [6], remote medical services, internet of things (IoT) [7] as many others. However, the 5G uses millimeter waves with high frequency that have difficulty getting through obstacles being absorbed by trees and rain [8]. To enhance the efficiency and coverage of cellular networks, device-to-device (D2D) technology can be utilized. This approach enables users with higher power signals to assist nearby users with lower power signals. By establishing a direct communication link between devices, D2D communication can offload traffic from the base station and provide more reliable and efficient connections between users. This technique can also improve network coverage and reduce power consumption, leading to enhanced overall network performance. D2D technology is a promising technique [9] in terms of yielding efficiency, decreasing latency, improving data rate, and increasing capacity to cellular networks. This feature allows direct communication between users inside the mobile network coverage area with users outside this area without using an eNodeB as a bridge. There are some advantages of D2D communication, such as:  
* Better cell coverage extension;
* Decreased device energy consumption;* Better use of resources;
* Increased signal capillarity. Allocating power and resources in order to provide quality of service still represent a challenge in D2D communications [10]. Power and resource allocation in D2D communication pose several challenges, particularly in interference control and gains. The farther apart users are, the greater the interference and the lower the gain. Another significant challenge is energy conservation, exacerbated by the substantial volume of transmitted and shared data, which can rapidly deplete the battery life of mobile devices [11]. In this work, intending to maximize the total throughput of D2D users and cellular users, an algorithm is proposed that considers an optimal power allocation for multi-user D2D communication in cellular uplink channels seeking to minimize the total delay using conflict graphs. The proposed resource allocation method uses the estimated delay as a utility function seeking to allocate the idle resources of the cellular users (CUEs) to the device-to-device users (DUEs). The method starts by randomly allocating idle resource blocks to each D2D pair. After this process, it is decided on the reuse of resource blocks from the CUEs using conflict graphs. We argue that a power allocation algorithm in multi-user cellular networks with uplink channel reuse can be used to optimize the total throughput of D2D users and cellular users subject to quality-of-service (QoS) requirements in relation to signal-to-interference-plus-noise ratio. To this end, in this work, we consider the distances of all devices involved to calculate the channel gains and interference. Using a \(Z\)-matrix [12; 13], the vector containing the values of power of each user equipment is calculated. Through simulations, it is shown that the proposed optimal power allocation and delay minimization based on conflict graph (OP-DMCG) algorithm provides a higher throughput for D2D transmissions and to the overall network transmissions of a cellular network system than the other considered algorithms from the literature that also consider device-to-device communications. This paper is organized as follows: In Section 2, we discuss some related works. Section 3 presents the system model, the scenario under consideration and the algorithms that are used to compare the results obtained by the proposed algorithm.