lib/unweighted-adjacency-list.js
/**
   * Creates a larger copy of the graph with a space
   * for a specified amount of additional vertices and edges.
   *
   * @param {number} [vertices=0] the amount of additional vertices
   * @param {number} [edges=1] the amount of additional edges
   * @returns {UnweightedAdjacencyList}
   */
Creates a larger copy of the graph with a space
for a specified amount of additional vertices and edges.

@param {number} [vertices=0] the amount of additional vertices
@param {number} [edges=1] the amount of additional edges
@returns {UnweightedAdjacencyList}
Creates a larger copy of the graph with a space for a specified amount of additional vertices and edges . @param { number } [ vertices = 0 ] the amount of additional vertices @param { number } [ edges = 1 ] the amount of additional edges @returns { UnweightedAdjacencyList }
grow(vertices = 0, edges = 1) {
    const copy = new this.constructor({
      vertices: this.vertices + vertices,
      edges: this.edges + edges,
    });
    if (!vertices) {
      copy.set(this);
    } else {
      const offset = this[this.vertices];
      const newSize = this.vertices + vertices;
      const newOffset = offset + vertices;
      for (let i = 0; i <= newSize; i++) {
        copy[i] = i < this.vertices ? this[i] + vertices : newOffset;
      }
      copy.set(this.subarray(this.vertices + 1), newSize + 1);
    }
    return copy;
  }
grow ( vertices = 0 , edges = 1 ) { const copy = new this . constructor ( { vertices : this . vertices + vertices , edges : this . edges + edges , } ) ; if ( ! vertices ) { copy . set ( this ) ; } else { const offset = this [ this . vertices ] ; const newSize = this . vertices + vertices ; const newOffset = offset + vertices ; for ( let i = 0 ; i <= newSize ; i ++ ) { copy [ i ] = i < this . vertices ? this [ i ] + vertices : newOffset ; } copy . set ( this . subarray ( this . vertices + 1 ) , newSize + 1 ) ; } return copy ; }
Creates a larger copy of the graph with a space
 for a specified amount of additional vertices and edges.
Creates a larger copy of the graph with a space for a specified amount of additional vertices and edges .