code: public double weight() {
          double result = 0;
          Iterator edgeIterator = edgeSet().iterator();
          while (edgeIterator.hasNext()) {
              result += ((Edge) edgeIterator.next()).getWeight();
          }
          return result;
      }
docs: Returns the sum of the weights of all edges in this cycle.
  
  @return the sum of the weights of all edges in this cycle