Unformatted text preview: if (g1u.dfs(2, 5)) System.out.println("g1u.dfs(2, 5) is true"); else System.out.println("g1u.dfs(2, 5) is false"); // test dfs() for directed graph if (g1d.dfs(1, 7)) System.out.println("g1d.dfs(1, 7) is true"); else System.out.println("g1d.dfs(1, 7) is false"); if (g1d.dfs(2, 5)) System.out.println("g1d.dfs(2, 5) is true"); else System.out.println("g1d.dfs(2, 5) is false"); // test shortestPath() for directed graph System.out.println("a shortest path from 1 to 9 in g2d:"); g2d.shortestPath(1, 9); System.out.println("a shortest path from 4 to 1 in g2d:"); g2d.shortestPath(4, 1); // test EulerPath() for extra credit: // g3u.EulerPath(); // g4u.EulerPath();...
View
Full Document