Skip to content

Commit

Permalink
Merge pull request #408 from RohitPaul0007/patch-51
Browse files Browse the repository at this point in the history
Update barycenter.js
  • Loading branch information
rustedgrail authored Sep 11, 2023
2 parents f7d87ce + 109c8c6 commit 102dfba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/order/barycenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module.exports = barycenter;

function barycenter(g, movable = []) {
return movable.map(v => {
var inV = g.inEdges(v);
let inV = g.inEdges(v);
if (!inV.length) {
return { v: v };
} else {
var result = inV.reduce((acc, e) => {
var edge = g.edge(e),
let result = inV.reduce((acc, e) => {
let edge = g.edge(e),
nodeU = g.node(e.v);
return {
sum: acc.sum + (edge.weight * nodeU.order),
Expand Down

0 comments on commit 102dfba

Please sign in to comment.