Due to the quality of service issues that wireless communications for data transmission need to ensure, we use the SOM neural network for QoS pattern space convergence, and apply cluster results to the shortest path algorithm in sensor networks. First, we measures the packet loss rate in different communication distance and the noise power density in underground straight laneway. From these we obtain the SOM network input samples. After network training, the convergent vector matrix and the corresponding quality of service function are obtained. Then, we apply the quality of service to the shortest path tree structure, and evaluate the performance of pattern recognition in the shortest path tree structure by NS2 software. At last, the simulation based on the QoS routing algorithm by NS2 software verifies the superiority of this method.