Class VertexQueue

All Implemented Interfaces:
Iterable<Integer>

public class VertexQueue extends VertexCollection
A queue of vertices of a graph.
Author:
Cristian Frăsinaru
  • Constructor Details

    • VertexQueue

      public VertexQueue(Graph graph)
    • VertexQueue

      public VertexQueue(Graph graph, int initialCapacity)
    • VertexQueue

      public VertexQueue(Graph graph, int[] vertices)
  • Method Details

    • add

      public boolean add(int v)
      Adds a new element at the end of the queue.
      Overrides:
      add in class VertexCollection
      Parameters:
      v - a vertex number.
      Returns:
      true, if the collection changed as a result of this call
    • peek

      public int peek()
      Returns the first element in the queue, without removing it.
      Returns:
      the first element in the queue.
    • poll

      public int poll()
      Returns and removes the first element in the queue.
      Returns:
      the first element in the queue.