To tackle the interference caused by sharing train to ground communication resources in train to train communication, we analyze the characteristics of the wireless environment of the tunnel, and adopt a method of improved weight bipartite graph matching and optimized power control to maximize the total throughput. The simulation results show that compared with macro cell base station under the ground environment, train to train communication quality under tunnel environment is better due to uniform signal strength coverage. This algorithm can still allocate channel and power more reasonably, which not only maximizes the total throughput but also greatly reduces the transmission power of train to train communication and train to ground communication.