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

14
LINES

< > BotCompany Repo | #1013510 // ai_relationSymmetryCount - returns Rat(symmetryCount, totalCount)

JavaX fragment (include)

1  
static Rat ai_relationSymmetryCount(S rel) {
2  
  L<TripleWeb> l = triplesWithB(rel);
3  
  new Set<Pair<S>> pairs;
4  
  int i = 0, n = 0;
5  
  for (TripleWeb w : l)
6  
    pairs.add(stdCasePair(w.a, w.b));
7  
  for (TripleWeb w : l) {
8  
    ++n;
9  
    if (pairs.contains(stdCasePair(w.b, w.a)))
10  
      ++i;
11  
  }
12  
  print("l(l)=" + l(l) + ", i=" + i +", n=" + n);
13  
  ret rat_noSimplify(i, n);
14  
}

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: #1013510
Snippet name: ai_relationSymmetryCount - returns Rat(symmetryCount, totalCount)
Eternal ID of this version: #1013510/4
Text MD5: a81773bd0aefdf3f051b728a27e1d614
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-08 01:57:54
Source code size: 380 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 377 / 397
Version history: 3 change(s)
Referenced in: [show references]