boolean backtrackDFS(v) {
If (SolutionFound(v)) return true;
Mark vertex v as reached.
for (each unreached vertex u adjacenct from v)
if (backtrakDFS(u)) return true;
Unmark vertex v;
return false;
}
Here why Unmark vertex v is needed?
and why is it safe to add such line as hence v becomes unreached again, would it result in revisit?
I don’t think it’s needed. It’s usually just good practice to undo what you do, and leave things as they were when you found them.
For example, including that line would allow you to search using the same function more than once without a separate operation to clear the marks.