code: function brandes(graph, source) {
    source = '' + source;
  
    var S = [],
        P = {},
        sigma = {};
  
    var nodes = graph.nodes(),
        Dv,
        sigmav,
        neighbors,
        v,
        w,
        i,
        j,
        l,
        m;
  
    for (i = 0, l = nodes.length; i < l; i++) {
      v = nodes[i];
      P[v] = [];
      sigma[v] = 0;
    }
  
    var D = {};
  
    sigma[source] = 1;
    D[source] = 0;
  
    var queue = Queue.of(source);
  
    while (queue.size) {
      v = queue.dequeue();
      S.push(v);
  
      Dv = D[v];
      sigmav = sigma[v];
  
      neighbors = graph
        .undirectedNeighbors(v)
        .concat(graph.outNeighbors(v));
  
      for (j = 0, m = neighbors.length; j < m; j++) {
        w = neighbors[j];
  
        if (!(w in D)) {
          queue.enqueue(w);
          D[w] = Dv + 1;
        }
  
        if (D[w] === Dv + 1) {
          sigma[w] += sigmav;
          P[w].push(v);
        }
      }
    }
  
    return [S, P, sigma];
  }
docs: Function using Ulrik Brandes' method to map single source shortest paths
  from selected node.
  
  [Reference]:
  Ulrik Brandes: A Faster Algorithm for Betweenness Centrality.
  Journal of Mathematical Sociology 25(2):163-177, 2001.
  
  @param  {Graph}  graph      - Target graph.
  @param  {any}    source     - Source node.
  @return {array}             - [Stack, Paths, Sigma]