Find the shortest Path between two nodes (vertices)
问题 I have a list of interconnected edges ( E ), how can I find the shortest path connecting from one vertex to another? I am thinking about using lowest common ancestors, but the edges don't have a clearly defined root, so I don't think the solution works. Shortest path is defined by the minimum number of vertexes traversed. Note: There could be a multi-path connecting two vertices, so obviously breadth first search won't work 回答1: I'm not sure if you need a path between every pair of nodes or