code: function closenessCentrality(options) {
      var _defaults2 = defaults$2(options),
          root = _defaults2.root,
          weight = _defaults2.weight,
          directed = _defaults2.directed,
          harmonic = _defaults2.harmonic;
  
      root = this.filter(root)[0]; // we need distance from this node to every other node
  
      var dijkstra = this.dijkstra({
        root: root,
        weight: weight,
        directed: directed
      });
      var totalDistance = 0;
      var nodes = this.nodes();
  
      for (var i = 0; i < nodes.length; i++) {
        var n = nodes[i];
  
        if (!n.same(root)) {
          var d = dijkstra.distanceTo(n);
  
          if (harmonic) {
            totalDistance += 1 / d;
          } else {
            totalDistance += d;
          }
        }
      }
  
      return harmonic ? totalDistance : 1 / totalDistance;
    }
docs: Implemented from pseudocode from wikipedia