Skip to content

Commit

Permalink
Merge pull request #379 from RohitPaul0007/patch-22
Browse files Browse the repository at this point in the history
Update parent-dummy-chains.js
  • Loading branch information
rustedgrail authored Sep 11, 2023
2 parents 1f5a587 + b192346 commit 7611943
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/parent-dummy-chains.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++ };
}
Expand Down

0 comments on commit 7611943

Please sign in to comment.