add javadocs comments and finalize dfs and bfs