-
Notifications
You must be signed in to change notification settings - Fork 2
/
rundag.js
executable file
·35 lines (29 loc) · 1 KB
/
rundag.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
include(Dag.js)
var mydag = new Dag( { root: { type:"sheet" },
doc1: { type:"doc" },
doc2: { type:"doc" },
doc3: { type:"doc" },
doc4: { type:"doc" },
alice: { type:"party" },
bob: { type:"party" },
charlie: { type:"party" },
demon: { type:"party" },
},
{ doc3: { doc2: {},
doc1: {},
alice: { signed: false },
bob: { signed: false },
charlie: { signed: false } },
doc2: { doc1: {},
alice: { signed: true },
bob: { signed: true } },
doc1: { alice: { signed: false } },
doc4: { demon: { signed: false } },
root: { doc3: {} },
},
"root",
console.log );
var descNs = mydag.descendantNames();
console.log("descendant names are: " + descNs);
console.log("descendants are: " + JSON.stringify(mydag.descendants()));
console.log("as a dfs: " + JSON.stringify(mydag.dfs(undefined,function(p){return (mydag.nodes[p].type != "party")})));