Write a function
bool path Exists (Node *n1, Node *n2);
that returns true if there is a path in the graph between the nodes n1 and n2. Implement this function by using depth-first search to traverse the graph from n1; if you encounter n2 along the way, then a path exists. Reimplement your function so that it uses breadth-first search instead. In a large graph, which implementation is likely to be more efficient?
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here