CS 1501 Depth-First Search (DFS) and Breadth First Search (BFS) of an unweighted graph

 

Original Graph:


 

 


DFS Spanning Tree: (nodes are marked with order that they are selected into the tree; edges selected are bold).  When given a choice, lower alphabetical neighbor of the current node is chosen first.


 

 

 


BFS Spanning Tree: (nodes are marked with order that they are selected into the tree; edges selected are bold).  When given a choice, lower alphabetical neighbor of the current node is chosen first.