Class VertexStack

All Implemented Interfaces:
Iterable<Integer>

public class VertexStack extends VertexCollection
A stack of vertices in a graph.
Author:
Cristian Frăsinaru
  • Constructor Details

    • VertexStack

      public VertexStack(Graph graph)
    • VertexStack

      public VertexStack(Graph graph, int initialCapacity)
  • Method Details

    • push

      public void push(int v)
      Parameters:
      v - a vertex number.
    • peek

      public int peek()
      Returns:
      the last element added to the stack.
    • pop

      public int pop()
      Returns and removes the last element added to the stack.
      Returns:
      the last element added to the stack.