/// <summary> /// Add a new vertex to the graph and returns it. /// /// Complexity: 1 insertion. /// </summary> /// <returns>Create vertex</returns> public virtual void AddVertex(IVertex v) { if (v == null) { throw new ArgumentNullException("vertex"); } if (VertexOutEdges.Contains(v)) { throw new ArgumentException("vertex already in graph"); } VertexProvider.UpdateVertex(v); VertexOutEdges.Add(v, new EdgeCollection()); }
/// <summary> /// Tests if a vertex is part of the graph /// </summary> /// <param name="v">Vertex to test</param> /// <returns>true if is part of the graph, false otherwize</returns> public bool ContainsVertex(IVertex v) { return(VertexOutEdges.Contains(v)); }