code: function degreeCentrality(options) {
      options = defaults$1(options);
      var cy = this.cy();
      var callingEles = this;
      var _options = options,
          root = _options.root,
          weight = _options.weight,
          directed = _options.directed,
          alpha = _options.alpha;
      root = cy.collection(root)[0];
  
      if (!directed) {
        var connEdges = root.connectedEdges().intersection(callingEles);
        var k = connEdges.length;
        var s = 0; // Now, sum edge weights
  
        for (var i = 0; i < connEdges.length; i++) {
          s += weight(connEdges[i]);
        }
  
        return {
          degree: Math.pow(k, 1 - alpha) * Math.pow(s, alpha)
        };
      } else {
        var edges = root.connectedEdges();
        var incoming = edges.filter(function (edge) {
          return edge.target().same(root) && callingEles.has(edge);
        });
        var outgoing = edges.filter(function (edge) {
          return edge.source().same(root) && callingEles.has(edge);
        });
        var k_in = incoming.length;
        var k_out = outgoing.length;
        var s_in = 0;
        var s_out = 0; // Now, sum incoming edge weights
  
        for (var _i2 = 0; _i2 < incoming.length; _i2++) {
          s_in += weight(incoming[_i2]);
        } // Now, sum outgoing edge weights
  
  
        for (var _i3 = 0; _i3 < outgoing.length; _i3++) {
          s_out += weight(outgoing[_i3]);
        }
  
        return {
          indegree: Math.pow(k_in, 1 - alpha) * Math.pow(s_in, alpha),
          outdegree: Math.pow(k_out, 1 - alpha) * Math.pow(s_out, alpha)
        };
      }
    }
docs: degreeCentralityNormalized Implemented from the algorithm in Opsahl's paper "Node centrality in weighted networks: Generalizing degree and shortest paths" check the heading 2 "Degree"