/// <inheritdoc /> public virtual bool AddVertex(TVertex vertex) { if (ContainsVertex(vertex)) { return(false); } if (EdgeCapacity > 0) { _vertexEdges.Add(vertex, new EdgeList <TVertex, TEdge>(EdgeCapacity)); } else { _vertexEdges.Add(vertex, new EdgeList <TVertex, TEdge>()); } OnVertexAdded(vertex); return(true); }
/// <inheritdoc /> public virtual bool AddVertex(TVertex vertex) { if (ContainsVertex(vertex)) return false; if (EdgeCapacity > 0) { _vertexOutEdges.Add(vertex, new EdgeList<TVertex, TEdge>(EdgeCapacity)); _vertexInEdges.Add(vertex, new EdgeList<TVertex, TEdge>(EdgeCapacity)); } else { _vertexOutEdges.Add(vertex, new EdgeList<TVertex, TEdge>()); _vertexInEdges.Add(vertex, new EdgeList<TVertex, TEdge>()); } OnVertexAdded(vertex); return true; }
public virtual bool AddVertex(TVertex v) { if (ContainsVertex(v)) { return(false); } if (EdgeCapacity > 0) { vertexOutEdges.Add(v, new EdgeList <TVertex, TEdge>(EdgeCapacity)); vertexInEdges.Add(v, new EdgeList <TVertex, TEdge>(EdgeCapacity)); } else { vertexOutEdges.Add(v, new EdgeList <TVertex, TEdge>()); vertexInEdges.Add(v, new EdgeList <TVertex, TEdge>()); } OnVertexAdded(v); return(true); }
/// <inheritdoc /> public bool AddVertex(TVertex vertex) { if (ContainsVertex(vertex)) { return(false); } var edges = EdgeCapacity < 0 ? new EdgeList <TVertex, TEdge>() : new EdgeList <TVertex, TEdge>(EdgeCapacity); _adjacentEdges.Add(vertex, edges); OnVertexAdded(vertex); return(true); }