def connect_endpoint(collection, edge)
      if collection.any? { |o| ! edge.equal?(o) && edge.similar?(o) }
        raise DuplicateEdgeError.new(self, edge)
      end

      collection.add(edge)
    end
def connect_endpoint(collection, edge)
      if collection.any? { |o| ! edge.equal?(o) && edge.similar?(o) }
        raise DuplicateEdgeError.new(self, edge)
      end

      collection.add(edge)
    end
Internal: Given an edge, and a Node's in_edges or out_edges, adds the
 edge only if there is not a similar edge already present.

 collection - The collection to which the edge is to be added.
 edge       - The edge.

 Returns nothing.