2021-05-11 06:26:18 -04:00
|
|
|
|
2021-05-29 11:20:11 -04:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
<script src="N.js"></script>
|
|
|
|
<script src="Pivot.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<script>
|
2021-05-29 11:58:03 -04:00
|
|
|
var count = 0;
|
2021-05-29 11:33:14 -04:00
|
|
|
let root = N.Create("root");
|
|
|
|
let recurse = (node, depth) =>
|
|
|
|
{
|
|
|
|
// create a set of new nodes off of the input node
|
|
|
|
let c1 = N.Create(node.Meta+"-1");
|
|
|
|
let c2 = N.Create(node.Meta+"-2");
|
|
|
|
N.Connect(node, c1, "parent");
|
|
|
|
N.Connect(node, c2, "parent");
|
|
|
|
|
|
|
|
var iterator;
|
2021-05-29 11:58:03 -04:00
|
|
|
if(depth < 2)
|
2021-05-29 11:33:14 -04:00
|
|
|
{
|
|
|
|
// loop over the new nodes and keep recursing
|
|
|
|
|
|
|
|
iterator = (child) =>
|
|
|
|
{
|
|
|
|
recurse(child, depth+1);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// walk up
|
2021-05-29 11:58:03 -04:00
|
|
|
iterator = (child) =>
|
2021-05-29 11:33:14 -04:00
|
|
|
{
|
2021-05-29 11:58:03 -04:00
|
|
|
/*
|
|
|
|
issue: why does incrementing walk id cause an infinite loop
|
|
|
|
*/
|
|
|
|
N.ID.Walk++;
|
|
|
|
count++;
|
|
|
|
if(count > 100)
|
|
|
|
{
|
|
|
|
console.log("big problems");
|
|
|
|
throw new Error("holy crap");
|
|
|
|
}
|
2021-05-29 11:33:14 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-05-29 11:58:03 -04:00
|
|
|
|
|
|
|
N.Walk(iterator, node, "parent");
|
2021-05-29 11:33:14 -04:00
|
|
|
}
|
2021-05-29 11:58:03 -04:00
|
|
|
N.ID.Walk++;
|
2021-05-29 11:33:14 -04:00
|
|
|
recurse(root, 0);
|
|
|
|
|
2021-05-29 11:20:11 -04:00
|
|
|
</script>
|
2021-05-29 11:33:14 -04:00
|
|
|
|
2021-05-29 11:20:11 -04:00
|
|
|
</body>
|
2021-05-28 19:11:15 -04:00
|
|
|
|
2021-05-29 11:20:11 -04:00
|
|
|
</html>
|