code: public boolean contains(Object o) {
          if (!(o instanceof WeightedDirectedTypedEdge))
              return false;
  
          @SuppressWarnings("unchecked")
          WeightedDirectedTypedEdge<T> e = (WeightedDirectedTypedEdge<T>)o;
  
          if (e.from() == rootVertex) {
              Set<WeightedDirectedTypedEdge<T>> edges = outEdges.get(e.to());
              return edges.contains(e);
          }
  
          else if (e.to() == rootVertex) {
              Set<WeightedDirectedTypedEdge<T>> edges = inEdges.get(e.from());
              return edges.contains(e);
          }
          return false;
          
      }
docs: {@inheritDoc}