Move (copy, so far) all the digraph code in Graph

This commit is contained in:
Ian Gulliver
2019-07-03 03:19:23 +00:00
parent 0daf666fee
commit df432eeeba
3 changed files with 329 additions and 1 deletions

View File

@@ -6,3 +6,21 @@ function randStr32() {
function randStr64() {
return randStr32() + randStr32();
}
function getOrSet(container, key, newValue) {
let val = container.get(key);
if (!val) {
val = newValue;
container.set(key, val);
}
return val;
}
function intersects(set1, set2) {
for (let item of set1) {
if (set2.has(item)) {
return true;
}
}
return false;
}