theprogrammablemind
Advanced tools
Comparing version 7.12.8 to 8.0.0
@@ -18,2 +18,3 @@ const { Semantics, Semantic } = require('./src/semantics') | ||
where: client.where, | ||
stableId: client.stableId, | ||
w: client.w, | ||
@@ -20,0 +21,0 @@ Config, |
@@ -68,4 +68,4 @@ { | ||
}, | ||
"version": "7.12.8", | ||
"version": "8.0.0", | ||
"license": "UNLICENSED" | ||
} |
@@ -84,15 +84,27 @@ const toA = (edge) => { | ||
minima (nodes) { | ||
let minima = new Set(nodes) | ||
const ancestors = new Set([]) | ||
nodes.forEach((node) => { | ||
this.ancestors(node).forEach((n) => ancestors.add(n)) | ||
}) | ||
ancestors.forEach((n) => minima.delete(n)) | ||
if (minima.size === 0) { | ||
// all unrelated | ||
minima = new Set(nodes) | ||
nodes = new Set(nodes) | ||
const nodeToDescendants = {} | ||
for (const node of nodes) { | ||
nodeToDescendants[node] = this.descendants(node) | ||
} | ||
let minima = new Set() | ||
for (const node of nodes) { | ||
let okay = true | ||
for (const key of nodeToDescendants[node]) { | ||
if (nodes.has(key)) { | ||
if (key in nodeToDescendants && nodeToDescendants[key].has(node)) { | ||
continue | ||
} | ||
okay = false | ||
break | ||
} | ||
} | ||
if (okay) { | ||
minima.add(node) | ||
} | ||
} | ||
return minima | ||
} | ||
/* | ||
maxima (nodes) { | ||
@@ -107,2 +119,3 @@ const maxima = new Set(nodes) | ||
} | ||
*/ | ||
@@ -113,5 +126,11 @@ add (child, parent) { | ||
exists(child, parent) { | ||
return this._edges.findIndex((edge) => edge[0] == child && edge[1] == parent) != -1 | ||
} | ||
addList (l) { | ||
for (let i = 1; i < l.length; ++i) { | ||
this._edges.push([l[i - 1], l[i]]) | ||
if (!this.exists(l[i-1], l[i])) { | ||
this._edges.push([l[i - 1], l[i]]) | ||
} | ||
} | ||
@@ -118,0 +137,0 @@ } |
@@ -116,15 +116,27 @@ const toA = (edge) => { | ||
minima (nodes) { | ||
let minima = new Set(nodes) | ||
const ancestors = new Set([]) | ||
nodes.forEach((node) => { | ||
this.ancestors(node).forEach((n) => ancestors.add(n)) | ||
}) | ||
ancestors.forEach((n) => minima.delete(n)) | ||
if (minima.size === 0) { | ||
// all unrelated | ||
minima = new Set(nodes) | ||
nodes = new Set(nodes) | ||
const nodeToDescendants = {} | ||
for (const node of nodes) { | ||
nodeToDescendants[node] = this.descendants(node) | ||
} | ||
let minima = new Set() | ||
for (const node of nodes) { | ||
let okay = true | ||
for (const key of nodeToDescendants[node]) { | ||
if (nodes.has(key)) { | ||
if (key in nodeToDescendants && nodeToDescendants[key].has(node)) { | ||
continue | ||
} | ||
okay = false | ||
break | ||
} | ||
} | ||
if (okay) { | ||
minima.add(node) | ||
} | ||
} | ||
return minima | ||
} | ||
/* | ||
maxima (nodes) { | ||
@@ -139,2 +151,3 @@ const maxima = new Set(nodes) | ||
} | ||
*/ | ||
@@ -145,5 +158,11 @@ add (child, parent) { | ||
exists(child, parent) { | ||
return this._edges.find((edge) => edge[0] == child && edge[1] == parent) | ||
} | ||
addList (l) { | ||
for (let i = 1; i < l.length; ++i) { | ||
this._edges.push([l[i - 1], l[i]]) | ||
if (!this.exists(l[i-1], l[i])) { | ||
this._edges.push([l[i - 1], l[i]]) | ||
} | ||
} | ||
@@ -150,0 +169,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
239434
6773