Let's say I have this graph and I want to use DFS from A to G, if I convert it into a tree search, will that make any change ? I tried and that is what I found, and please correct to me if I am wrong

Graph search : Frontier (LIFO):

B C E 
D F C E * 
C E 
G E 

G is the goal state

and for the Tree search things will be the same but only the graph could me more simple

  • I ignored A because it is already visited, we can find that in Explored list ** I expanded nodes in alphabetical order when there are more than one candidate for expansion.

so what is the difference between graph and tree in this case ? please help


I'm an amateur in this area too but I'll try and answer your query. As far as I understand it, trees by definition, do not contain cycles or loops. ref: http://freefeast.info/difference-between/difference-between-trees-and-graphs-trees-vs-graphs/
The link also lists the exact differences between graphs and trees. So, technically, using a tree for DFS in your example would be wrong as it contains a loop.

Your Answer

