numberOfConnectedComponents = graph => {
    assert(!graph.directed);
    const seen = {};
    const coverComponent = origin => {
      depthFirstSearch(graph, origin, {
        enterVertex: function(vertex) {
          seen[vertex] = true;
        }
      });
    };

    let count = 0;
    graph.vertices.forEach(vertex => {
      if (!seen[vertex]) {
        coverComponent(vertex);
        count++;
      }
    });
    return count;
  }
@param {Graph} graph - Undirected graph.
@return {number}