public void breadthFirstTraversal(){
        LinkedQueueClass<Integer> queue =
                     new LinkedQueueClass<Integer>();

        boolean[] visited;
        visited = new boolean[gSize];

        for (int ind = 0; ind < gSize; ind++)
            visited[ind] = false;   //initialize the array
                                    //visited to false

        for (int index = 0; index < gSize; index++){
            if (!visited[index]){
               queue.addQueue(index);
               visited[index] = true;
               System.out.print(" " + index + " ");

               while (!queue.isEmptyQueue()){
                   int u = queue.front();

                   queue.deleteQueue();

                   UnorderedLinkedList<Integer>.
                        LinkedListIterator<Integer> graphIt
                                      = graph[u].iterator();

                    while (graphIt.hasNext()){
                        int w1 = graphIt.next();

                        if (!visited[w1]){
                            queue.addQueue(w1);
                            visited[w1] = true;
                            System.out.print(" " + w1 + " ");
                        }
                    }
                } 
            }
        }
    }