Implement BFS and DFS for Graphs