code: public boolean contains(Object o) {
          if (o instanceof WeightedEdge) {
              WeightedEdge e = (WeightedEdge)o;
              int toFind = 0;
              if (e.to() == rootVertex) 
                  toFind = e.from();
              else if (e.from() == rootVertex)
                  toFind = e.to();
              else return false;
              
              return edges.get(toFind) == e.weight();
          }
          return false;
      }
docs: {@inheritDoc}