simulation in swing of the algorithm BFS and DFS