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

13
LINES

< > BotCompany Repo | #1017369 // makeHull_optimized - construct transitive hull over a relation (MultiMap), including object itself

JavaX fragment (include)

static LinkedHashSet<S> makeHull_optimized(MultiMap<S, S> map, S e) {
  new LinkedHashSet<S> l;
  makeHull_optimized_impl(map, e, l);
  ret l;
}

static void makeHull_optimized_impl(MultiMap<S, S> map, S e, LinkedHashSet<S> dest) {
  if (dest.contains(e))
    ret;
  dest.add(e);
  for (S f : map.get(e))
    makeHull_optimized_impl(map, f, dest);
}

Author comment

Began life as a copy of #1001894

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017369
Snippet name: makeHull_optimized - construct transitive hull over a relation (MultiMap), including object itself
Eternal ID of this version: #1017369/1
Text MD5: 2185ad80c7df8b2cb593814fdfed7816
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-18 13:38:59
Source code size: 363 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 436 / 482
Referenced in: [show references]