@SuppressWarnings("unchecked")
        @Override
        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof Edge)) {
                return false;
            }
            Edge<V, E> o = (Edge<V, E>) obj;
            return source.equals(o.source) && target.equals(o.target)
                    && (edge == null ? o.edge == null : edge.equals(o.edge));
        }