public void DeleteEdge(Vertex vertex) { if (HasEdge(vertex) || vertex.HasEdge(this)) { Edgs.Remove(vertex); vertex.Edgs.Remove(this); } else { throw new Exception("Edge not found!"); } }
public void AddEdge(Vertex vertex) { if (!HasEdge(vertex) && !vertex.HasEdge(this)) { Edgs.Add(vertex); vertex.Edgs.Add(this); } else { throw new Exception("Edge already added!"); } }