Based on the conflict graph model which is formulated as a binary integer optimization problem, a resource allocation method to support device-to-device (D2D) communications in ceUular networks is proposed. First, a frequency resource assignment algorithm is presented which assigns each D2D link one frequency resource block. For this algorithm, frequency resource blocks are assigned so that the frequency resource spatial reuse opportunities in the cellular networks can be fully exploited. Then a slot scheduling algorithm is presented which schedules time slots among D2D links assigned the same frequency resource block. For this algorithm, time slot resources are scheduled so that the proportional fairness among D2D links which are assigned the same frequency resource block can be achieved. The performance of the proposed method is evaluated via computer simulations. The simulation results show that the proposed method can well support D2D communications in cellular networks.