Source of 29.19.java


  1: public boolean hasEdge(T begin, T end)
  2: {
  3:    boolean found = false;
  4:    VertexInterface<T> beginVertex = vertices.getValue(begin);
  5:    VertexInterface<T> endVertex = vertices.getValue(end);
  6:    if ( (beginVertex != null) && (endVertex != null) )
  7:    {
  8:       Iterator<VertexInterface<T>> neighbors = beginVertex.getNeighborIterator();
  9:       while (!found && neighbors.hasNext())
 10:       {
 11:          VertexInterface<T> nextNeighbor = neighbors.next();
 12:          if (endVertex.equals(nextNeighbor))
 13:             found = true;
 14:       } // end while
 15:    } // end if
 16:    return found;
 17: } // end hasEdge
 18: // Version 4.0