Source of 29.14.java


  1: public boolean hasNeighbor()
  2: {
  3:    return !edgeList.isEmpty();
  4: } // end hasNeighbor
  5: 
  6: public VertexInterface<T> getUnvisitedNeighbor()
  7: {
  8:    VertexInterface<T> result = null;
  9: 
 10:    Iterator<VertexInterface<T>> neighbors = getNeighborIterator();
 11:    while (neighbors.hasNext() && (result == null) )
 12:    {
 13:       VertexInterface<T> nextNeighbor = neighbors.next();
 14:       if (!nextNeighbor.isVisited())
 15:          result = nextNeighbor;
 16:    } // end while
 17: 
 18:    return result;
 19: } // end getUnvisitedNeighbor
 20: // Version 4.0