Skip to content

Commit

Permalink
perf(adjacency): update subsets() to use canonical()
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Mar 14, 2019
1 parent 00f4ba0 commit 0918c5b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/adjacency/src/disjoint-set.ts
Expand Up @@ -85,10 +85,7 @@ export class DisjointSet {
const sets: Map<number, number[]> = new Map();
const roots = this.roots;
for (let i = roots.length; --i >= 0; ) {
let id = i;
while (id !== roots[id]) {
id = roots[roots[id]];
}
const id = this.canonical(i);
const s = sets.get(id);
if (s) {
s.push(i);
Expand Down

0 comments on commit 0918c5b

Please sign in to comment.