write dfs method
write code for breadth first search