appleseed-metric
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "appleseed-metric", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "local trust metric algorithm", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,2 +16,3 @@ const test = require("tape") | ||
t.assert(rankings["d"], "node d exists in rankings") | ||
t.false("a" in rankings, "source should not be in rankings") | ||
t.false("x" in rankings, "node x should not be in rankings") | ||
@@ -22,1 +23,54 @@ t.false("y" in rankings, "node y should not be in rankings") | ||
}) | ||
test("simple one hop, same weights", (t) => { | ||
const trust = [] | ||
const source = "a" | ||
trust.push({ src: 'a', dst: 'b', weight: 0.80 }) | ||
trust.push({ src: 'b', dst: 'c', weight: 0.80 }) | ||
trust.push({ src: 'b', dst: 'd', weight: 0.80 }) | ||
appleseed(source, trust, 200, 0.85, 0.01).then((result) => { | ||
const rankings = result.rankings | ||
const rankB = rankings.b | ||
t.assert(rankB, "node b exists in rankings") | ||
t.assert(rankB > rankings.c, "node b is higher than c") | ||
t.assert(rankB > rankings.d, "node b is higher than d") | ||
t.end() | ||
}) | ||
}) | ||
test("simple one hop, lower weight", (t) => { | ||
const trust = [] | ||
const source = 'a' | ||
trust.push({ src: 'a', dst: 'b', weight: 0.80 }) | ||
trust.push({ src: 'b', dst: 'c', weight: 0.80 }) | ||
trust.push({ src: 'b', dst: 'd', weight: 0.40 }) // lower | ||
appleseed(source, trust, 200, 0.85, 0.01).then((result) => { | ||
const rankings = result.rankings | ||
const rankB = rankings.b | ||
t.assert(rankB, "node b exists in rankings") | ||
t.assert(rankB > rankings.c, "node b has more energy than c") | ||
t.assert(rankB > rankings.d, "node b has more energy than d") | ||
t.assert(rankings.c > rankings.d, "node c has more energy than d") | ||
t.end() | ||
}) | ||
}) | ||
test("two trustees", (t) => { | ||
const trust = [] | ||
const source = 'a' | ||
// a trusts b and c | ||
trust.push({ src: 'a', dst: 'b', weight: 0.80 }) | ||
trust.push({ src: 'a', dst: 'c', weight: 0.80 }) | ||
// b trusts d and e | ||
trust.push({ src: 'b', dst: 'd', weight: 0.80 }) | ||
trust.push({ src: 'b', dst: 'e', weight: 0.80 }) | ||
// c also trusts d | ||
trust.push({ src: 'c', dst: 'd', weight: 0.80 }) | ||
appleseed(source, trust, 200, 0.85, 0.01).then((result) => { | ||
const rankings = result.rankings | ||
t.assert(rankings.d > rankings.e, "node d has more energy than e") | ||
t.end() | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
47920
0
3
204