INNER CODE UNIT · JavaScript
super_node
lh3/pangene · pangene.js:534
const super_node = this.n_node++;
let seg_id = g.seg.length;
for (const v of tip) {
this.arc.push({ v:super_node, w:this.end_cat[v], seg:seg_id, ori:1, pair:-1, cec:-1, dfs_type:0 });
this.arc.push({ v:this.end_cat[v], w:super_node, seg:seg_id, ori:-1, pair:-1, cec:-1, dfs_type:0 });
++seg_id;
}
}
}
// index arc[]
for (let i = 0; i < this.n_node; ++i)
this.idx[i] = { n:0, o:0 };
this.arc.sort(function(x, y) { return x.v - y.v });
for (let i = 1, i0 = 0; i <= this.arc.length; ++i)
if (i == this.arc.length || this.arc[i0].v != this.arc[i].v)
this.idx[this.arc[i0].v] = { o:i0, n:i-i0 }, i0 = i;
// populate arc[].pair
let vtx2arc = [];