import java.util.*; /** * Implementation of a Breadth First Search * * @author Unknown * */ public class BFS{ /** * The BFS implemented in code to use. * * @param a Structure to perform the search on a graph, adjacency matrix etc. * @param vertices The vertices to use * @param source The Source */ public static void bfsImplement(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(vertices); //operational stack st.push(source); //assigning source while(!st