How to solve graph problems with BFS and DFS using JavaScript