/// <summary> /// Add an edge to the graph. The added edges requires a recommended identifier, a tail vertex, an head vertex, and a label. /// Like adding a vertex, the provided object identifier is can be ignored by the implementation. /// </summary> /// <param name="outVertex">The vertex on the tail of the edge.</param> /// <param name="inVertex">The vertex on the head of the edge.</param> /// <param name="id">The recommended object identifier.</param> /// <param name="label">The label associated with the edge.</param> /// <param name="edgeInitializer">A delegate to initialize the new edge.</param> /// <returns> /// The newly created edge /// </returns> public IHaymanEdge AddEdge(IHaymanVertex outVertex, IHaymanVertex inVertex, EdgeId id, string label, Action<HaymanEdgeData> edgeInitializer) { var data = new HaymanEdgeData(); if (edgeInitializer != null) { edgeInitializer(data); } var edge = new HaymanEdge(outVertex, inVertex, id) { EdgeData = data }; outVertex.AddInEdge(edge); inVertex.AddOutEdge(edge); _edges.Add(id, edge); return edge; }
public bool Equals(HaymanEdge other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other._id, _id); }