Source of 30.18.java


  1: // @author Frank M. Carrano, Timothy M. Henry
  2: // @version 5.0
  3: public boolean addEdge(T begin, T end, double edgeWeight)
  4: {
  5:    boolean result = false;
  6:    VertexInterface<T> beginVertex = vertices.getValue(begin);
  7:    VertexInterface<T> endVertex = vertices.getValue(end);
  8:    if ( (beginVertex != null) && (endVertex != null) )
  9:       result = beginVertex.connect(endVertex, edgeWeight);
 10:    if (result)
 11:       edgeCount++;
 12:    return result;
 13: } // end addEdge

 15: public boolean addEdge(T begin, T end)
 16: {
 17:    return addEdge(begin, end, 0);
 18: } // end addEdge