import m from "../../../../../../lodash-es@4.17.22/node_modules/lodash-es/map.js";
import w from "../../../../../../lodash-es@4.17.22/node_modules/lodash-es/reduce.js";
function a(e, u) {
  return m(u, function(r) {
    var n = e.inEdges(r);
    if (n.length) {
      var t = w(
        n,
        function(i, o) {
          var g = e.edge(o), h = e.node(o.v);
          return {
            sum: i.sum + g.weight * h.order,
            weight: i.weight + g.weight
          };
        },
        { sum: 0, weight: 0 }
      );
      return {
        v: r,
        barycenter: t.sum / t.weight,
        weight: t.weight
      };
    } else
      return { v: r };
  });
}
export {
  a as barycenter
};
