diff --git a/lib/parent-dummy-chains.js b/lib/parent-dummy-chains.js index 59e95ab4..58a6a44a 100644 --- a/lib/parent-dummy-chains.js +++ b/lib/parent-dummy-chains.js @@ -1,17 +1,17 @@ module.exports = parentDummyChains; function parentDummyChains(g) { - var postorderNums = postorder(g); + let postorderNums = postorder(g); g.graph().dummyChains.forEach(v => { - var node = g.node(v); - var edgeObj = node.edgeObj; - var pathData = findPath(g, postorderNums, edgeObj.v, edgeObj.w); - var path = pathData.path; - var lca = pathData.lca; - var pathIdx = 0; - var pathV = path[pathIdx]; - var ascending = true; + let node = g.node(v); + let edgeObj = node.edgeObj; + let pathData = findPath(g, postorderNums, edgeObj.v, edgeObj.w); + let path = pathData.path; + let lca = pathData.lca; + let pathIdx = 0; + let pathV = path[pathIdx]; + let ascending = true; while (v !== edgeObj.w) { node = g.node(v); @@ -44,12 +44,12 @@ function parentDummyChains(g) { // Find a path from v to w through the lowest common ancestor (LCA). Return the // full path and the LCA. function findPath(g, postorderNums, v, w) { - var vPath = []; - var wPath = []; - var low = Math.min(postorderNums[v].low, postorderNums[w].low); - var lim = Math.max(postorderNums[v].lim, postorderNums[w].lim); - var parent; - var lca; + let vPath = []; + let wPath = []; + let low = Math.min(postorderNums[v].low, postorderNums[w].low); + let lim = Math.max(postorderNums[v].lim, postorderNums[w].lim); + let parent; + let lca; // Traverse up from v to find the LCA parent = v; @@ -70,11 +70,11 @@ function findPath(g, postorderNums, v, w) { } function postorder(g) { - var result = {}; - var lim = 0; + let result = {}; + let lim = 0; function dfs(v) { - var low = lim; + let low = lim; g.children(v).forEach(dfs); result[v] = { low: low, lim: lim++ }; }