[Solved] Determine whether there is a path from vertex u to w passing through v [closed]
Without any more constraints, there aren’t any available optimizations that aren’t kind of obvious. A path exists iff u, v, and w are in the same connected component. That can be easily determined by running a BFS or DFS from any one to see if it finds the other two. For some graphs there is … Read more