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)

1  
static LinkedHashSet<S> makeHull_optimized(MultiMap<S, S> map, S e) {
2  
  new LinkedHashSet<S> l;
3  
  makeHull_optimized_impl(map, e, l);
4  
  ret l;
5  
}
6  
7  
static void makeHull_optimized_impl(MultiMap<S, S> map, S e, LinkedHashSet<S> dest) {
8  
  if (dest.contains(e))
9  
    ret;
10  
  dest.add(e);
11  
  for (S f : map.get(e))
12  
    makeHull_optimized_impl(map, f, dest);
13  
}

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: 438 / 485
Referenced in: [show references]