Dijkstra algorithm and Floyd algorithm are the two most commonly used as well as effective methods to compute the shortest path. In this paper, on the basis of the compare and analysis of Dijkstra algorithm and Floyd algorithm, the differences between the two algorithms in many aspects are shown, besides, the key part of the program by Floyd algorithm is given respectively. Furthermore, an improved algorithm based on Dijkstra algorithm is introduced.