From 29b03982478ea2d0678fa51b8783cc9cd5016beb Mon Sep 17 00:00:00 2001 From: Rohit Paul <113459757+RohitPaul0007@users.noreply.github.com> Date: Sun, 10 Sep 2023 22:07:23 +0530 Subject: [PATCH] Update build-layer-graph.js --- lib/order/build-layer-graph.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/order/build-layer-graph.js b/lib/order/build-layer-graph.js index 8c9df8e8..b55a099c 100644 --- a/lib/order/build-layer-graph.js +++ b/lib/order/build-layer-graph.js @@ -1,5 +1,5 @@ -var Graph = require("@dagrejs/graphlib").Graph; -var util = require("../util"); +let Graph = require("@dagrejs/graphlib").Graph; +let util = require("../util"); module.exports = buildLayerGraph; @@ -34,12 +34,12 @@ module.exports = buildLayerGraph; * graph is not a multi-graph. */ function buildLayerGraph(g, rank, relationship) { - var root = createRootNode(g), + let root = createRootNode(g), result = new Graph({ compound: true }).setGraph({ root: root }) .setDefaultNodeLabel(v => g.node(v)); g.nodes().forEach(v => { - var node = g.node(v), + let node = g.node(v), parent = g.parent(v); if (node.rank === rank || node.minRank <= rank && rank <= node.maxRank) { @@ -48,7 +48,7 @@ function buildLayerGraph(g, rank, relationship) { // This assumes we have only short edges! g[relationship](v).forEach(e => { - var u = e.v === v ? e.w : e.v, + let u = e.v === v ? e.w : e.v, edge = result.edge(u, v), weight = edge !== undefined ? edge.weight : 0; result.setEdge(u, v, { weight: g.edge(e).weight + weight });