import java.util.*; public class App{ public static void dfs(byte [][] a,int vertices,int source){ //passing adjacency matrix and no of vertices byte []b=new byte[vertices]; //flag container containing status of each vertices Arrays.fill(b,(byte)-1); //status initialization /* code status -1 = ready 0 = waiting 1 = processed */ Stack st=new Stack<>(); //operational stack st.push(source); //assigning source while(!st.isEmpty()){ b[st.peek()]=(byte)0; //assigning waiting status System.out.println(st.peek()); int pop=st.pop(); b[pop]=(byte)1; //assigning processed status for(int i=0;i