Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1010246 // web_makeTree - walk through web and make WebTree

JavaX fragment (include)

static WebTree web_makeTree(WebNode node) {
  if (node == null) null;
  WebTree tree = new(node);
  web_makeTree_impl(tree, new HashSet);
  ret tree;
}

static void web_makeTree_impl(WebTree tree, HashSet<WebNode> seen) {
  if (!seen.add(tree.node)) ret;
  for (WebNode n : web_forwardRelated(tree.node)) {
    WebTree tree2 = new(n);
    tree.children.add(pair(tree.node.web.getRelation(tree.node, n), tree2));
    web_makeTree_impl(tree2, seen);
  }
}

Author comment

Began life as a copy of #1010241

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1010246
Snippet name: web_makeTree - walk through web and make WebTree
Eternal ID of this version: #1010246/3
Text MD5: 9b678a4494961e65fb48c6a2731ba3e7
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-07 18:28:43
Source code size: 467 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 372 / 412
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)