Write program to implement the DFS and BFS algorithm for a graph.