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...


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?

Nov 22, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here