Here the All-pairs shortest path problem on weighted undirected sparse graphs is being considered.For the problem considered, we propose "disassembly and assembly of a graph" algorithm which uses a solution of the problem on a small-dimensional graph to obtain the solution for the given graph.The proposed algorithm has been compared to one of the fastest classic algorithms on data from an open public source.