import java.util.*; import java.io.*; public class DepthTraverse { int[][] arr; public DepthTraverse(String fn){ populate(fn); } private void populate(String str) { try{ //assuming the str is the name of the file Scanner s = new Scanner( new File(str) ); int n = s.nextInt(); int m = s.nextInt(); arr = new int[n][n]; while(s.hasNext()){ int f = s.nextInt() - 1; int t = s.nextInt() -1 ; arr[f][t] = 1; arr[t][f] = 1; } }catch(Exception ex){} } public void printPath(){ int src = 0; System.out.print(1); for(int i=0;i