Abstract:A new method for generating the single line diagram of the regional power network is proposed based on the dynamic programming algorithm. According to the topological model of spatial data in power grid, the implementation of the breadth first algorithm can obtain the adjacency matrix and matrix traversal sequence of the connected graph, and the square range of the total equipment can be accommodated by the adjacency matrix. A dynamic programming optimal layout algorithm is proposed, which is used to solve the layout optimization problem. The application example shows that the optimal solution layout is beautiful and efficient.