INNER CODE UNIT · JavaScript
stack
lh3/pangene · pangene.js:610
let stack = [[v, 0, -1]];
while (stack.length > 0) {
const [w, i, b] = stack.pop(); // b: the index of the bubble that leads to w
const n = this.idx[w].n, off = this.idx[w].o;
if (i == n) continue;
stack.push([w, i + 1, b]); // repush to the stack
let a = this.arc[off + i];
if (a.dfs_type == 3) continue; // blocked edge
const u = a.w;
let b2 = b;
if (a.cec >= 0) {
let par = b;
if (cec_entry[a.cec] != -1) // if there is a start, close it
sese[cec_entry[a.cec]].en = off + i, par = sese[cec_entry[a.cec]].par;
sese.push({ cec:a.cec, st:off+i, en:-1, par:par, unflt:-1, i:-1 }); // create a new entry with the same parrent
b2 = cec_entry[a.cec] = sese.length - 1;
}
if (visited[u] != 0) continue;