I have been taking Artificial Intelligence course in College. I came upon this problem. Now here I have to find the order in which DFS algorithm inspects the nodes and what is the path from Start to Goal State. And wherever this contention between more than one nodes, left one is to be chosen.
So according to DFS algorithm, I would add {A,B,C} in stack. {D,E,B,C} -> {K,E,B,C} -> {M,E,B,C} -> {O,E,B,C} -> {F,G,E,B,C}. Now I cannot understand what to do further, should I go to B and then backtrack again with B already being in the stack or do something different. And the path would be S -> B -> G or else S -> A -> D -> K -> M -> O -> G.
How to decide what way to go?