-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathssb-scenario.js
58 lines (57 loc) · 3.53 KB
/
ssb-scenario.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const { TrustNet } = require("../")
let distrusted = ["mallory", "spammer"]
let trustAssignments = []
trustAssignments.push({ src: 'mix', dst: 'alanna', weight: 0.75 })
trustAssignments.push({ src: 'mix', dst: 'andre', weight: 0.75 })
trustAssignments.push({ src: 'mix', dst: 'jacob', weight: 0.25 })
trustAssignments.push({ src: 'mix', dst: 'dominic', weight: 0.75 })
trustAssignments.push({ src: 'mix', dst: 'angelica', weight: 0.75 })
trustAssignments.push({ src: 'mix', dst: 'zach!', weight: 0.75 })
trustAssignments.push({ src: 'mix', dst: 'zenna', weight: 0.50 })
trustAssignments.push({ src: 'mix', dst: 'keks', weight: 0.50 })
trustAssignments.push({ src: 'mix', dst: 'dan', weight: 0.25 })
trustAssignments.push({ src: 'mix', dst: 'cryptix', weight: 0.50 })
trustAssignments.push({ src: 'andre', dst: 'mix', weight: 0.75 })
trustAssignments.push({ src: 'andre', dst: 'dominic', weight: 0.75 })
trustAssignments.push({ src: 'andre', dst: 'cryptix', weight: 0.75 })
trustAssignments.push({ src: 'andre', dst: 'keks', weight: 0.75 })
trustAssignments.push({ src: 'andre', dst: 'eve', weight: 0 })
trustAssignments.push({ src: 'zenna', dst: 'andre', weight: 0.75 })
trustAssignments.push({ src: 'zenna', dst: 'dominic', weight: 0.75 })
trustAssignments.push({ src: 'zenna', dst: 'cryptix', weight: 0.75 })
trustAssignments.push({ src: 'zenna', dst: 'keks', weight: 0.75 })
trustAssignments.push({ src: 'zenna', dst: 'jacob', weight: 0.75 })
trustAssignments.push({ src: 'zenna', dst: 'mix', weight: 0.50 })
trustAssignments.push({ src: 'zenna', dst: 'erick', weight: 0.50 })
trustAssignments.push({ src: 'erick', dst: 'dominic', weight: 0.75 })
trustAssignments.push({ src: 'erick', dst: 'eve', weight: 0 })
trustAssignments.push({ src: 'keks', dst: 'cryptix', weight: 0.75 })
trustAssignments.push({ src: 'keks', dst: 'andre', weight: 0.75 })
trustAssignments.push({ src: 'keks', dst: 'dominic', weight: 0.75 })
trustAssignments.push({ src: 'cryptix', dst: 'keks', weight: 0.75 })
trustAssignments.push({ src: 'dominic', dst: 'angelica', weight: 0.75 })
trustAssignments.push({ src: 'dominic', dst: 'zach!', weight: 0.75 })
trustAssignments.push({ src: 'dominic', dst: 'mix', weight: 0.50 })
trustAssignments.push({ src: 'dominic', dst: 'erick', weight: 0.25 })
trustAssignments.push({ src: 'alanna', dst: 'mix', weight: 0.75 })
trustAssignments.push({ src: 'alanna', dst: 'dominic', weight: 0.75 })
trustAssignments.push({ src: 'alanna', dst: 'dan', weight: 0.75 })
trustAssignments.push({ src: 'alanna', dst: 'angelica', weight: 0.75 })
trustAssignments.push({ src: 'alanna', dst: 'zach!', weight: 0.75 })
trustAssignments.push({ src: 'jacob', dst: 'dominic', weight: 0.75 })
trustAssignments.push({ src: 'jacob', dst: 'cryptix', weight: 0.75 })
trustAssignments.push({ src: 'jacob', dst: 'zach!', weight: 0.75 })
trustAssignments.push({ src: 'jacob', dst: 'zenna', weight: 0.1 })
trustAssignments.push({ src: 'zach!', dst: 'angelica', weight: 0.75 })
trustAssignments.push({ src: 'zach!', dst: 'dominic', weight: 0.50 })
trustAssignments.push({ src: 'angelica', dst: 'dominic', weight: 0.75 })
trustAssignments.push({ src: 'angelica', dst: 'zach!', weight: 0.75 })
trustAssignments.push({ src: 'dominic', dst: 'mallory', weight: 0.25 })
trustAssignments.push({ src: 'mallory', dst: 'spammer', weight: 0.25 })
let trust = new TrustNet()
let root = process.argv.length > 2 ? process.argv[2] : "andre"
trust.load(root, trustAssignments, distrusted).then(() => {
let mostTrusted = trust.getMostTrusted()
console.log(`${root}'s most trusted:`, mostTrusted)
console.log(trust.getAllTrusted())
})