Showing 3 of 5 files from the diff.

@@ -15,7 +15,11 @@
Loading
15 15
  if(!"sign"%in%igraph::edge_attr_names(g)){
16 16
    stop("network does not have a sign edge attribute")
17 17
  }
18 -
  igraph::as_adj(g,type = "both",attr = "sign", sparse = sparse)
18 +
  A <- igraph::as_adj(g,type = "both",attr = "sign", sparse = TRUE)
19 +
  if(!sparse){
20 +
    A <- as.matrix(A)
21 +
  }
22 +
  A
19 23
}
20 24
21 25
#' Convert a signed two-mode network to a signed matrix

@@ -20,3 +20,35 @@
Loading
20 20
  }
21 21
  return triads;
22 22
}
23 +
24 +
// [[Rcpp::export]]
25 +
IntegerVector triadCensusSign1(NumericMatrix A, List adj, int n){
26 +
27 +
  int code=0;
28 +
  IntegerVector triads(729);
29 +
  for(int u=0;u<n;u++){
30 +
    IntegerVector Nu = as<IntegerVector>(adj[u]);
31 +
    int nu = Nu.length();
32 +
    for(int j=0;j<nu;j++){
33 +
      int v = Nu[j];
34 +
      if(u<v){
35 +
        IntegerVector Nv = as<IntegerVector>(adj[v]);
36 +
        IntegerVector S = union_(Nu,Nv);
37 +
        IntegerVector uv = {u,v};
38 +
        S = setdiff(S,uv);
39 +
        code = (A(u,v) + 1)+3+9*(A(v,u) + 1)+27+81+243;
40 +
        triads[code] = triads[code] + n-S.length()-2;
41 +
        for(int k=0;k<S.length();k++){
42 +
          int w = S[k];
43 +
          if( (v<w) | ((u<w) & (w<v) & (A(u,w)==0) & (A(w,u)==0))){
44 +
            code = (A(u,v)+1)+3*(A(u,w)+1)+9*(A(v,u)+1)+27*(A(v,w)+1)+81*(A(w,u)+1)+243*(A(w,v)+1);
45 +
            triads[code] = triads[code] + 1;
46 +
          }
47 +
        }
48 +
      }
49 +
    }
50 +
  }
51 +
  return triads;
52 +
}
53 +
54 +

@@ -179,53 +179,6 @@
Loading
179 179
  if(!"sign"%in%igraph::edge_attr_names(g)){
180 180
    stop("g does not have a sign edge attribute")
181 181
  }
182 -
  triad <- c(63, 62, 63, 61, 60, 61, 63, 62, 63, 59, 58, 59, 57, 56, 57,
183 -
             59, 58, 59, 63, 62, 63, 61, 60, 61, 63, 62, 63, 55, 54, 55, 53,
184 -
             52, 53, 55, 54, 55, 51, 50, 51, 49, 48, 49, 51, 50, 51, 55, 54,
185 -
             55, 53, 52, 53, 55, 54, 55, 63, 62, 63, 61, 60, 61, 63, 62, 63,
186 -
             59, 58, 59, 57, 56, 57, 59, 58, 59, 63, 62, 63, 61, 60, 61, 63,
187 -
             62, 63, 47, 46, 47, 45, 44, 45, 47, 46, 47, 43, 42, 43, 41, 40,
188 -
             41, 43, 42, 43, 47, 46, 47, 45, 44, 45, 47, 46, 47, 39, 38, 39,
189 -
             37, 36, 37, 39, 38, 39, 35, 34, 35, 33, 32, 33, 35, 34, 35, 39,
190 -
             38, 39, 37, 36, 37, 39, 38, 39, 47, 46, 47, 45, 44, 45, 47, 46,
191 -
             47, 43, 42, 43, 41, 40, 41, 43, 42, 43, 47, 46, 47, 45, 44, 45,
192 -
             47, 46, 47, 63, 62, 63, 61, 60, 61, 63, 62, 63, 59, 58, 59, 57,
193 -
             56, 57, 59, 58, 59, 63, 62, 63, 61, 60, 61, 63, 62, 63, 55, 54,
194 -
             55, 53, 52, 53, 55, 54, 55, 51, 50, 51, 49, 48, 49, 51, 50, 51,
195 -
             55, 54, 55, 53, 52, 53, 55, 54, 55, 63, 62, 63, 61, 60, 61, 63,
196 -
             62, 63, 59, 58, 59, 57, 56, 57, 59, 58, 59, 63, 62, 63, 61, 60,
197 -
             61, 63, 62, 63, 31, 30, 31, 29, 28, 29, 31, 30, 31, 27, 26, 27,
198 -
             25, 24, 25, 27, 26, 27, 31, 30, 31, 29, 28, 29, 31, 30, 31, 23,
199 -
             22, 23, 21, 20, 21, 23, 22, 23, 19, 18, 19, 17, 16, 17, 19, 18,
200 -
             19, 23, 22, 23, 21, 20, 21, 23, 22, 23, 31, 30, 31, 29, 28, 29,
201 -
             31, 30, 31, 27, 26, 27, 25, 24, 25, 27, 26, 27, 31, 30, 31, 29,
202 -
             28, 29, 31, 30, 31, 15, 14, 15, 13, 12, 13, 15, 14, 15, 11, 10,
203 -
             11, 9, 8, 9, 11, 10, 11, 15, 14, 15, 13, 12, 13, 15, 14, 15,
204 -
             7, 6, 7, 5, 4, 5, 7, 6, 7, 3, 2, 3, 1, 0, 1, 3, 2, 3, 7, 6, 7,
205 -
             5, 4, 5, 7, 6, 7, 15, 14, 15, 13, 12, 13, 15, 14, 15, 11, 10,
206 -
             11, 9, 8, 9, 11, 10, 11, 15, 14, 15, 13, 12, 13, 15, 14, 15,
207 -
             31, 30, 31, 29, 28, 29, 31, 30, 31, 27, 26, 27, 25, 24, 25, 27,
208 -
             26, 27, 31, 30, 31, 29, 28, 29, 31, 30, 31, 23, 22, 23, 21, 20,
209 -
             21, 23, 22, 23, 19, 18, 19, 17, 16, 17, 19, 18, 19, 23, 22, 23,
210 -
             21, 20, 21, 23, 22, 23, 31, 30, 31, 29, 28, 29, 31, 30, 31, 27,
211 -
             26, 27, 25, 24, 25, 27, 26, 27, 31, 30, 31, 29, 28, 29, 31, 30,
212 -
             31, 63, 62, 63, 61, 60, 61, 63, 62, 63, 59, 58, 59, 57, 56, 57,
213 -
             59, 58, 59, 63, 62, 63, 61, 60, 61, 63, 62, 63, 55, 54, 55, 53,
214 -
             52, 53, 55, 54, 55, 51, 50, 51, 49, 48, 49, 51, 50, 51, 55, 54,
215 -
             55, 53, 52, 53, 55, 54, 55, 63, 62, 63, 61, 60, 61, 63, 62, 63,
216 -
             59, 58, 59, 57, 56, 57, 59, 58, 59, 63, 62, 63, 61, 60, 61, 63,
217 -
             62, 63, 47, 46, 47, 45, 44, 45, 47, 46, 47, 43, 42, 43, 41, 40,
218 -
             41, 43, 42, 43, 47, 46, 47, 45, 44, 45, 47, 46, 47, 39, 38, 39,
219 -
             37, 36, 37, 39, 38, 39, 35, 34, 35, 33, 32, 33, 35, 34, 35, 39,
220 -
             38, 39, 37, 36, 37, 39, 38, 39, 47, 46, 47, 45, 44, 45, 47, 46,
221 -
             47, 43, 42, 43, 41, 40, 41, 43, 42, 43, 47, 46, 47, 45, 44, 45,
222 -
             47, 46, 47, 63, 62, 63, 61, 60, 61, 63, 62, 63, 59, 58, 59, 57,
223 -
             56, 57, 59, 58, 59, 63, 62, 63, 61, 60, 61, 63, 62, 63, 55, 54,
224 -
             55, 53, 52, 53, 55, 54, 55, 51, 50, 51, 49, 48, 49, 51, 50, 51,
225 -
             55, 54, 55, 53, 52, 53, 55, 54, 55, 63, 62, 63, 61, 60, 61, 63,
226 -
             62, 63, 59, 58, 59, 57, 56, 57, 59, 58, 59, 63, 62, 63, 61, 60,
227 -
             61, 63, 62, 63)
228 -
229 182
  tcode <- c("300", "210", "300", "210", "120U", "210", "300", "210", "300",
230 183
             "210", "201", "210", "120C", "111U", "120C", "210", "201", "210",
231 184
             "300", "210", "300", "210", "120U", "210", "300", "210", "300",
@@ -314,128 +267,6 @@
Loading
314 267
             "210", "300", "210", "300", "210", "120U", "210", "300", "210",
315 268
             "300")
316 269
317 -
  orbits <- c("35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
318 -
              "34-33-32", "35-35-35", "34-32-33", "35-35-35", "32-34-33", "19-19-20",
319 -
              "32-34-33", "29-31-30", "13-15-14", "29-31-30", "32-34-33", "19-19-20",
320 -
              "32-34-33", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
321 -
              "34-33-32", "35-35-35", "34-32-33", "35-35-35", "33-34-32", "31-29-30",
322 -
              "33-34-32", "28-28-27", "22-24-23", "28-28-27", "33-34-32", "31-29-30",
323 -
              "33-34-32", "26-25-26", "15-13-14", "26-25-26", "24-22-23", "12-12-11",
324 -
              "24-22-23", "26-25-26", "15-13-14", "26-25-26", "33-34-32", "31-29-30",
325 -
              "33-34-32", "28-28-27", "22-24-23", "28-28-27", "33-34-32", "31-29-30",
326 -
              "33-34-32", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
327 -
              "34-33-32", "35-35-35", "34-32-33", "35-35-35", "32-34-33", "19-19-20",
328 -
              "32-34-33", "29-31-30", "13-15-14", "29-31-30", "32-34-33", "19-19-20",
329 -
              "32-34-33", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
330 -
              "34-33-32", "35-35-35", "34-32-33", "35-35-35", "32-33-34", "29-30-31",
331 -
              "32-33-34", "19-20-19", "13-14-15", "19-20-19", "32-33-34", "29-30-31",
332 -
              "32-33-34", "27-28-28", "16-18-17", "27-28-28", "16-17-18", "4-5-5",
333 -
              "16-17-18", "27-28-28", "16-18-17", "27-28-28", "32-33-34", "29-30-31",
334 -
              "32-33-34", "19-20-19", "13-14-15", "19-20-19", "32-33-34", "29-30-31",
335 -
              "32-33-34", "30-31-29", "21-21-21", "30-31-29", "18-17-16", "8-6-7",
336 -
              "18-17-16", "30-31-29", "21-21-21", "30-31-29", "23-22-24", "7-8-6",
337 -
              "23-22-24", "10-9-10", "1-3-2", "10-9-10", "23-22-24", "7-8-6",
338 -
              "23-22-24", "30-31-29", "21-21-21", "30-31-29", "18-17-16", "8-6-7",
339 -
              "18-17-16", "30-31-29", "21-21-21", "30-31-29", "32-33-34", "29-30-31",
340 -
              "32-33-34", "19-20-19", "13-14-15", "19-20-19", "32-33-34", "29-30-31",
341 -
              "32-33-34", "27-28-28", "16-18-17", "27-28-28", "16-17-18", "4-5-5",
342 -
              "16-17-18", "27-28-28", "16-18-17", "27-28-28", "32-33-34", "29-30-31",
343 -
              "32-33-34", "19-20-19", "13-14-15", "19-20-19", "32-33-34", "29-30-31",
344 -
              "32-33-34", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
345 -
              "34-33-32", "35-35-35", "34-32-33", "35-35-35", "32-34-33", "19-19-20",
346 -
              "32-34-33", "29-31-30", "13-15-14", "29-31-30", "32-34-33", "19-19-20",
347 -
              "32-34-33", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
348 -
              "34-33-32", "35-35-35", "34-32-33", "35-35-35", "33-34-32", "31-29-30",
349 -
              "33-34-32", "28-28-27", "22-24-23", "28-28-27", "33-34-32", "31-29-30",
350 -
              "33-34-32", "26-25-26", "15-13-14", "26-25-26", "24-22-23", "12-12-11",
351 -
              "24-22-23", "26-25-26", "15-13-14", "26-25-26", "33-34-32", "31-29-30",
352 -
              "33-34-32", "28-28-27", "22-24-23", "28-28-27", "33-34-32", "31-29-30",
353 -
              "33-34-32", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
354 -
              "34-33-32", "35-35-35", "34-32-33", "35-35-35", "32-34-33", "19-19-20",
355 -
              "32-34-33", "29-31-30", "13-15-14", "29-31-30", "32-34-33", "19-19-20",
356 -
              "32-34-33", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
357 -
              "34-33-32", "35-35-35", "34-32-33", "35-35-35", "33-32-34", "28-27-28",
358 -
              "33-32-34", "31-30-29", "22-23-24", "31-30-29", "33-32-34", "28-27-28",
359 -
              "33-32-34", "30-29-31", "18-16-17", "30-29-31", "21-21-21", "8-7-6",
360 -
              "21-21-21", "30-29-31", "18-16-17", "30-29-31", "33-32-34", "28-27-28",
361 -
              "33-32-34", "31-30-29", "22-23-24", "31-30-29", "33-32-34", "28-27-28",
362 -
              "33-32-34", "20-19-19", "17-16-18", "20-19-19", "17-18-16", "9-10-10",
363 -
              "17-18-16", "20-19-19", "17-16-18", "20-19-19", "14-13-15", "5-4-5",
364 -
              "14-13-15", "6-8-7", "3-1-2", "6-8-7", "14-13-15", "5-4-5", "14-13-15",
365 -
              "20-19-19", "17-16-18", "20-19-19", "17-18-16", "9-10-10", "17-18-16",
366 -
              "20-19-19", "17-16-18", "20-19-19", "33-32-34", "28-27-28", "33-32-34",
367 -
              "31-30-29", "22-23-24", "31-30-29", "33-32-34", "28-27-28", "33-32-34",
368 -
              "30-29-31", "18-16-17", "30-29-31", "21-21-21", "8-7-6", "21-21-21",
369 -
              "30-29-31", "18-16-17", "30-29-31", "33-32-34", "28-27-28", "33-32-34",
370 -
              "31-30-29", "22-23-24", "31-30-29", "33-32-34", "28-27-28", "33-32-34",
371 -
              "26-26-25", "24-23-22", "26-26-25", "15-14-13", "12-11-12", "15-14-13",
372 -
              "26-26-25", "24-23-22", "26-26-25", "23-24-22", "10-10-9", "23-24-22",
373 -
              "7-6-8", "1-2-3", "7-6-8", "23-24-22", "10-10-9", "23-24-22",
374 -
              "26-26-25", "24-23-22", "26-26-25", "15-14-13", "12-11-12", "15-14-13",
375 -
              "26-26-25", "24-23-22", "26-26-25", "14-15-13", "6-7-8", "14-15-13",
376 -
              "5-5-4", "3-2-1", "5-5-4", "14-15-13", "6-7-8", "14-15-13", "11-12-12",
377 -
              "2-1-3", "11-12-12", "2-3-1", "0-0-0", "2-3-1", "11-12-12", "2-1-3",
378 -
              "11-12-12", "14-15-13", "6-7-8", "14-15-13", "5-5-4", "3-2-1",
379 -
              "5-5-4", "14-15-13", "6-7-8", "14-15-13", "26-26-25", "24-23-22",
380 -
              "26-26-25", "15-14-13", "12-11-12", "15-14-13", "26-26-25", "24-23-22",
381 -
              "26-26-25", "23-24-22", "10-10-9", "23-24-22", "7-6-8", "1-2-3",
382 -
              "7-6-8", "23-24-22", "10-10-9", "23-24-22", "26-26-25", "24-23-22",
383 -
              "26-26-25", "15-14-13", "12-11-12", "15-14-13", "26-26-25", "24-23-22",
384 -
              "26-26-25", "33-32-34", "28-27-28", "33-32-34", "31-30-29", "22-23-24",
385 -
              "31-30-29", "33-32-34", "28-27-28", "33-32-34", "30-29-31", "18-16-17",
386 -
              "30-29-31", "21-21-21", "8-7-6", "21-21-21", "30-29-31", "18-16-17",
387 -
              "30-29-31", "33-32-34", "28-27-28", "33-32-34", "31-30-29", "22-23-24",
388 -
              "31-30-29", "33-32-34", "28-27-28", "33-32-34", "20-19-19", "17-16-18",
389 -
              "20-19-19", "17-18-16", "9-10-10", "17-18-16", "20-19-19", "17-16-18",
390 -
              "20-19-19", "14-13-15", "5-4-5", "14-13-15", "6-8-7", "3-1-2",
391 -
              "6-8-7", "14-13-15", "5-4-5", "14-13-15", "20-19-19", "17-16-18",
392 -
              "20-19-19", "17-18-16", "9-10-10", "17-18-16", "20-19-19", "17-16-18",
393 -
              "20-19-19", "33-32-34", "28-27-28", "33-32-34", "31-30-29", "22-23-24",
394 -
              "31-30-29", "33-32-34", "28-27-28", "33-32-34", "30-29-31", "18-16-17",
395 -
              "30-29-31", "21-21-21", "8-7-6", "21-21-21", "30-29-31", "18-16-17",
396 -
              "30-29-31", "33-32-34", "28-27-28", "33-32-34", "31-30-29", "22-23-24",
397 -
              "31-30-29", "33-32-34", "28-27-28", "33-32-34", "35-35-35", "34-32-33",
398 -
              "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
399 -
              "35-35-35", "32-34-33", "19-19-20", "32-34-33", "29-31-30", "13-15-14",
400 -
              "29-31-30", "32-34-33", "19-19-20", "32-34-33", "35-35-35", "34-32-33",
401 -
              "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
402 -
              "35-35-35", "33-34-32", "31-29-30", "33-34-32", "28-28-27", "22-24-23",
403 -
              "28-28-27", "33-34-32", "31-29-30", "33-34-32", "26-25-26", "15-13-14",
404 -
              "26-25-26", "24-22-23", "12-12-11", "24-22-23", "26-25-26", "15-13-14",
405 -
              "26-25-26", "33-34-32", "31-29-30", "33-34-32", "28-28-27", "22-24-23",
406 -
              "28-28-27", "33-34-32", "31-29-30", "33-34-32", "35-35-35", "34-32-33",
407 -
              "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
408 -
              "35-35-35", "32-34-33", "19-19-20", "32-34-33", "29-31-30", "13-15-14",
409 -
              "29-31-30", "32-34-33", "19-19-20", "32-34-33", "35-35-35", "34-32-33",
410 -
              "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
411 -
              "35-35-35", "32-33-34", "29-30-31", "32-33-34", "19-20-19", "13-14-15",
412 -
              "19-20-19", "32-33-34", "29-30-31", "32-33-34", "27-28-28", "16-18-17",
413 -
              "27-28-28", "16-17-18", "4-5-5", "16-17-18", "27-28-28", "16-18-17",
414 -
              "27-28-28", "32-33-34", "29-30-31", "32-33-34", "19-20-19", "13-14-15",
415 -
              "19-20-19", "32-33-34", "29-30-31", "32-33-34", "30-31-29", "21-21-21",
416 -
              "30-31-29", "18-17-16", "8-6-7", "18-17-16", "30-31-29", "21-21-21",
417 -
              "30-31-29", "23-22-24", "7-8-6", "23-22-24", "10-9-10", "1-3-2",
418 -
              "10-9-10", "23-22-24", "7-8-6", "23-22-24", "30-31-29", "21-21-21",
419 -
              "30-31-29", "18-17-16", "8-6-7", "18-17-16", "30-31-29", "21-21-21",
420 -
              "30-31-29", "32-33-34", "29-30-31", "32-33-34", "19-20-19", "13-14-15",
421 -
              "19-20-19", "32-33-34", "29-30-31", "32-33-34", "27-28-28", "16-18-17",
422 -
              "27-28-28", "16-17-18", "4-5-5", "16-17-18", "27-28-28", "16-18-17",
423 -
              "27-28-28", "32-33-34", "29-30-31", "32-33-34", "19-20-19", "13-14-15",
424 -
              "19-20-19", "32-33-34", "29-30-31", "32-33-34", "35-35-35", "34-32-33",
425 -
              "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
426 -
              "35-35-35", "32-34-33", "19-19-20", "32-34-33", "29-31-30", "13-15-14",
427 -
              "29-31-30", "32-34-33", "19-19-20", "32-34-33", "35-35-35", "34-32-33",
428 -
              "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
429 -
              "35-35-35", "33-34-32", "31-29-30", "33-34-32", "28-28-27", "22-24-23",
430 -
              "28-28-27", "33-34-32", "31-29-30", "33-34-32", "26-25-26", "15-13-14",
431 -
              "26-25-26", "24-22-23", "12-12-11", "24-22-23", "26-25-26", "15-13-14",
432 -
              "26-25-26", "33-34-32", "31-29-30", "33-34-32", "28-28-27", "22-24-23",
433 -
              "28-28-27", "33-34-32", "31-29-30", "33-34-32", "35-35-35", "34-32-33",
434 -
              "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
435 -
              "35-35-35", "32-34-33", "19-19-20", "32-34-33", "29-31-30", "13-15-14",
436 -
              "29-31-30", "32-34-33", "19-19-20", "32-34-33", "35-35-35", "34-32-33",
437 -
              "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
438 -
              "35-35-35")
439 270
440 271
  signsign <- c("NNNNNN", "NNN0NN", "NNNNNP", "NNN0NN", "0N0NNN", "NNN0NP",
441 272
                "NNNNNP", "NNN0NP", "NNNPNP", "NNN0NN", "00NNNN", "NNP0NN", "0NN0NN",
@@ -542,14 +373,6 @@
Loading
542 373
                "NPP0PP", "0PN0PP", "0P00PP", "0PP0PP", "PPN0PP", "00PPPP", "PPP0PP",
543 374
                "NPNPPP", "PPP0PN", "NPPPPP", "PPP0PN", "0P0PPP", "PPP0PP", "NPPPPP",
544 375
                "PPP0PP", "PPPPPP")
545 -
546 -
  A <- as_adj_signed(g,sparse = FALSE) + 1
547 -
  n <- nrow(A)
548 -
  triads <- triadCensusSign(A,n)
549 -
  names(triads) <- paste0(tcode,"-",signsign)
550 -
  df <- stats::aggregate(formula = count~type,data = data.frame(type=names(triads),count=triads),FUN = sum)
551 -
  census <- df[["count"]]
552 -
  names(census) <- df[["type"]]
553 376
  triple_order <- c(
554 377
    "003-000000", "012-0000P0", "012-0000N0", "102-0000PP", "102-0000NP",
555 378
    "102-0000NN", "021C-0PP000", "021C-0NP000", "021C-0PN000", "021C-0NN000",
@@ -579,5 +402,189 @@
Loading
579 402
    "300-NPNPPP", "300-PNNPPP", "300-PPNPNP", "300-NNNPPP", "300-NNPNPP",
580 403
    "300-NPNPNP", "300-PNNPPN", "300-NNNNPP", "300-NNNPNP",
581 404
    "300-NNNPPN", "300-NPNPNN", "300-NNNNNP", "300-NNNNNN")
582 -
  census[match(names(census),triple_order)]
405 +
406 +
  A <- as_adj_signed(g,sparse = FALSE)#
407 +
  n <- nrow(A)
408 +
  adj <- igraph::as_adj_list(igraph::as.undirected(g),"all")
409 +
  adj <- lapply(adj,function(x) x-1)
410 +
  triads <- triadCensusSign1(A,adj,n)
411 +
  names(triads) <- paste0(tcode,"-",signsign)
412 +
  df <- stats::aggregate(formula = count~type,data = data.frame(type=names(triads),count=triads),FUN = sum)
413 +
  census <- df[["count"]]
414 +
  names(census) <- df[["type"]]
415 +
  census <- census[match(names(census),triple_order)]
416 +
  census[1] <- choose(n,3)-sum(census)
417 +
  census
583 418
}
419 +
420 +
421 +
422 +
# orbits <- c("35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
423 +
#             "34-33-32", "35-35-35", "34-32-33", "35-35-35", "32-34-33", "19-19-20",
424 +
#             "32-34-33", "29-31-30", "13-15-14", "29-31-30", "32-34-33", "19-19-20",
425 +
#             "32-34-33", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
426 +
#             "34-33-32", "35-35-35", "34-32-33", "35-35-35", "33-34-32", "31-29-30",
427 +
#             "33-34-32", "28-28-27", "22-24-23", "28-28-27", "33-34-32", "31-29-30",
428 +
#             "33-34-32", "26-25-26", "15-13-14", "26-25-26", "24-22-23", "12-12-11",
429 +
#             "24-22-23", "26-25-26", "15-13-14", "26-25-26", "33-34-32", "31-29-30",
430 +
#             "33-34-32", "28-28-27", "22-24-23", "28-28-27", "33-34-32", "31-29-30",
431 +
#             "33-34-32", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
432 +
#             "34-33-32", "35-35-35", "34-32-33", "35-35-35", "32-34-33", "19-19-20",
433 +
#             "32-34-33", "29-31-30", "13-15-14", "29-31-30", "32-34-33", "19-19-20",
434 +
#             "32-34-33", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
435 +
#             "34-33-32", "35-35-35", "34-32-33", "35-35-35", "32-33-34", "29-30-31",
436 +
#             "32-33-34", "19-20-19", "13-14-15", "19-20-19", "32-33-34", "29-30-31",
437 +
#             "32-33-34", "27-28-28", "16-18-17", "27-28-28", "16-17-18", "4-5-5",
438 +
#             "16-17-18", "27-28-28", "16-18-17", "27-28-28", "32-33-34", "29-30-31",
439 +
#             "32-33-34", "19-20-19", "13-14-15", "19-20-19", "32-33-34", "29-30-31",
440 +
#             "32-33-34", "30-31-29", "21-21-21", "30-31-29", "18-17-16", "8-6-7",
441 +
#             "18-17-16", "30-31-29", "21-21-21", "30-31-29", "23-22-24", "7-8-6",
442 +
#             "23-22-24", "10-9-10", "1-3-2", "10-9-10", "23-22-24", "7-8-6",
443 +
#             "23-22-24", "30-31-29", "21-21-21", "30-31-29", "18-17-16", "8-6-7",
444 +
#             "18-17-16", "30-31-29", "21-21-21", "30-31-29", "32-33-34", "29-30-31",
445 +
#             "32-33-34", "19-20-19", "13-14-15", "19-20-19", "32-33-34", "29-30-31",
446 +
#             "32-33-34", "27-28-28", "16-18-17", "27-28-28", "16-17-18", "4-5-5",
447 +
#             "16-17-18", "27-28-28", "16-18-17", "27-28-28", "32-33-34", "29-30-31",
448 +
#             "32-33-34", "19-20-19", "13-14-15", "19-20-19", "32-33-34", "29-30-31",
449 +
#             "32-33-34", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
450 +
#             "34-33-32", "35-35-35", "34-32-33", "35-35-35", "32-34-33", "19-19-20",
451 +
#             "32-34-33", "29-31-30", "13-15-14", "29-31-30", "32-34-33", "19-19-20",
452 +
#             "32-34-33", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
453 +
#             "34-33-32", "35-35-35", "34-32-33", "35-35-35", "33-34-32", "31-29-30",
454 +
#             "33-34-32", "28-28-27", "22-24-23", "28-28-27", "33-34-32", "31-29-30",
455 +
#             "33-34-32", "26-25-26", "15-13-14", "26-25-26", "24-22-23", "12-12-11",
456 +
#             "24-22-23", "26-25-26", "15-13-14", "26-25-26", "33-34-32", "31-29-30",
457 +
#             "33-34-32", "28-28-27", "22-24-23", "28-28-27", "33-34-32", "31-29-30",
458 +
#             "33-34-32", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
459 +
#             "34-33-32", "35-35-35", "34-32-33", "35-35-35", "32-34-33", "19-19-20",
460 +
#             "32-34-33", "29-31-30", "13-15-14", "29-31-30", "32-34-33", "19-19-20",
461 +
#             "32-34-33", "35-35-35", "34-32-33", "35-35-35", "34-33-32", "25-26-26",
462 +
#             "34-33-32", "35-35-35", "34-32-33", "35-35-35", "33-32-34", "28-27-28",
463 +
#             "33-32-34", "31-30-29", "22-23-24", "31-30-29", "33-32-34", "28-27-28",
464 +
#             "33-32-34", "30-29-31", "18-16-17", "30-29-31", "21-21-21", "8-7-6",
465 +
#             "21-21-21", "30-29-31", "18-16-17", "30-29-31", "33-32-34", "28-27-28",
466 +
#             "33-32-34", "31-30-29", "22-23-24", "31-30-29", "33-32-34", "28-27-28",
467 +
#             "33-32-34", "20-19-19", "17-16-18", "20-19-19", "17-18-16", "9-10-10",
468 +
#             "17-18-16", "20-19-19", "17-16-18", "20-19-19", "14-13-15", "5-4-5",
469 +
#             "14-13-15", "6-8-7", "3-1-2", "6-8-7", "14-13-15", "5-4-5", "14-13-15",
470 +
#             "20-19-19", "17-16-18", "20-19-19", "17-18-16", "9-10-10", "17-18-16",
471 +
#             "20-19-19", "17-16-18", "20-19-19", "33-32-34", "28-27-28", "33-32-34",
472 +
#             "31-30-29", "22-23-24", "31-30-29", "33-32-34", "28-27-28", "33-32-34",
473 +
#             "30-29-31", "18-16-17", "30-29-31", "21-21-21", "8-7-6", "21-21-21",
474 +
#             "30-29-31", "18-16-17", "30-29-31", "33-32-34", "28-27-28", "33-32-34",
475 +
#             "31-30-29", "22-23-24", "31-30-29", "33-32-34", "28-27-28", "33-32-34",
476 +
#             "26-26-25", "24-23-22", "26-26-25", "15-14-13", "12-11-12", "15-14-13",
477 +
#             "26-26-25", "24-23-22", "26-26-25", "23-24-22", "10-10-9", "23-24-22",
478 +
#             "7-6-8", "1-2-3", "7-6-8", "23-24-22", "10-10-9", "23-24-22",
479 +
#             "26-26-25", "24-23-22", "26-26-25", "15-14-13", "12-11-12", "15-14-13",
480 +
#             "26-26-25", "24-23-22", "26-26-25", "14-15-13", "6-7-8", "14-15-13",
481 +
#             "5-5-4", "3-2-1", "5-5-4", "14-15-13", "6-7-8", "14-15-13", "11-12-12",
482 +
#             "2-1-3", "11-12-12", "2-3-1", "0-0-0", "2-3-1", "11-12-12", "2-1-3",
483 +
#             "11-12-12", "14-15-13", "6-7-8", "14-15-13", "5-5-4", "3-2-1",
484 +
#             "5-5-4", "14-15-13", "6-7-8", "14-15-13", "26-26-25", "24-23-22",
485 +
#             "26-26-25", "15-14-13", "12-11-12", "15-14-13", "26-26-25", "24-23-22",
486 +
#             "26-26-25", "23-24-22", "10-10-9", "23-24-22", "7-6-8", "1-2-3",
487 +
#             "7-6-8", "23-24-22", "10-10-9", "23-24-22", "26-26-25", "24-23-22",
488 +
#             "26-26-25", "15-14-13", "12-11-12", "15-14-13", "26-26-25", "24-23-22",
489 +
#             "26-26-25", "33-32-34", "28-27-28", "33-32-34", "31-30-29", "22-23-24",
490 +
#             "31-30-29", "33-32-34", "28-27-28", "33-32-34", "30-29-31", "18-16-17",
491 +
#             "30-29-31", "21-21-21", "8-7-6", "21-21-21", "30-29-31", "18-16-17",
492 +
#             "30-29-31", "33-32-34", "28-27-28", "33-32-34", "31-30-29", "22-23-24",
493 +
#             "31-30-29", "33-32-34", "28-27-28", "33-32-34", "20-19-19", "17-16-18",
494 +
#             "20-19-19", "17-18-16", "9-10-10", "17-18-16", "20-19-19", "17-16-18",
495 +
#             "20-19-19", "14-13-15", "5-4-5", "14-13-15", "6-8-7", "3-1-2",
496 +
#             "6-8-7", "14-13-15", "5-4-5", "14-13-15", "20-19-19", "17-16-18",
497 +
#             "20-19-19", "17-18-16", "9-10-10", "17-18-16", "20-19-19", "17-16-18",
498 +
#             "20-19-19", "33-32-34", "28-27-28", "33-32-34", "31-30-29", "22-23-24",
499 +
#             "31-30-29", "33-32-34", "28-27-28", "33-32-34", "30-29-31", "18-16-17",
500 +
#             "30-29-31", "21-21-21", "8-7-6", "21-21-21", "30-29-31", "18-16-17",
501 +
#             "30-29-31", "33-32-34", "28-27-28", "33-32-34", "31-30-29", "22-23-24",
502 +
#             "31-30-29", "33-32-34", "28-27-28", "33-32-34", "35-35-35", "34-32-33",
503 +
#             "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
504 +
#             "35-35-35", "32-34-33", "19-19-20", "32-34-33", "29-31-30", "13-15-14",
505 +
#             "29-31-30", "32-34-33", "19-19-20", "32-34-33", "35-35-35", "34-32-33",
506 +
#             "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
507 +
#             "35-35-35", "33-34-32", "31-29-30", "33-34-32", "28-28-27", "22-24-23",
508 +
#             "28-28-27", "33-34-32", "31-29-30", "33-34-32", "26-25-26", "15-13-14",
509 +
#             "26-25-26", "24-22-23", "12-12-11", "24-22-23", "26-25-26", "15-13-14",
510 +
#             "26-25-26", "33-34-32", "31-29-30", "33-34-32", "28-28-27", "22-24-23",
511 +
#             "28-28-27", "33-34-32", "31-29-30", "33-34-32", "35-35-35", "34-32-33",
512 +
#             "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
513 +
#             "35-35-35", "32-34-33", "19-19-20", "32-34-33", "29-31-30", "13-15-14",
514 +
#             "29-31-30", "32-34-33", "19-19-20", "32-34-33", "35-35-35", "34-32-33",
515 +
#             "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
516 +
#             "35-35-35", "32-33-34", "29-30-31", "32-33-34", "19-20-19", "13-14-15",
517 +
#             "19-20-19", "32-33-34", "29-30-31", "32-33-34", "27-28-28", "16-18-17",
518 +
#             "27-28-28", "16-17-18", "4-5-5", "16-17-18", "27-28-28", "16-18-17",
519 +
#             "27-28-28", "32-33-34", "29-30-31", "32-33-34", "19-20-19", "13-14-15",
520 +
#             "19-20-19", "32-33-34", "29-30-31", "32-33-34", "30-31-29", "21-21-21",
521 +
#             "30-31-29", "18-17-16", "8-6-7", "18-17-16", "30-31-29", "21-21-21",
522 +
#             "30-31-29", "23-22-24", "7-8-6", "23-22-24", "10-9-10", "1-3-2",
523 +
#             "10-9-10", "23-22-24", "7-8-6", "23-22-24", "30-31-29", "21-21-21",
524 +
#             "30-31-29", "18-17-16", "8-6-7", "18-17-16", "30-31-29", "21-21-21",
525 +
#             "30-31-29", "32-33-34", "29-30-31", "32-33-34", "19-20-19", "13-14-15",
526 +
#             "19-20-19", "32-33-34", "29-30-31", "32-33-34", "27-28-28", "16-18-17",
527 +
#             "27-28-28", "16-17-18", "4-5-5", "16-17-18", "27-28-28", "16-18-17",
528 +
#             "27-28-28", "32-33-34", "29-30-31", "32-33-34", "19-20-19", "13-14-15",
529 +
#             "19-20-19", "32-33-34", "29-30-31", "32-33-34", "35-35-35", "34-32-33",
530 +
#             "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
531 +
#             "35-35-35", "32-34-33", "19-19-20", "32-34-33", "29-31-30", "13-15-14",
532 +
#             "29-31-30", "32-34-33", "19-19-20", "32-34-33", "35-35-35", "34-32-33",
533 +
#             "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
534 +
#             "35-35-35", "33-34-32", "31-29-30", "33-34-32", "28-28-27", "22-24-23",
535 +
#             "28-28-27", "33-34-32", "31-29-30", "33-34-32", "26-25-26", "15-13-14",
536 +
#             "26-25-26", "24-22-23", "12-12-11", "24-22-23", "26-25-26", "15-13-14",
537 +
#             "26-25-26", "33-34-32", "31-29-30", "33-34-32", "28-28-27", "22-24-23",
538 +
#             "28-28-27", "33-34-32", "31-29-30", "33-34-32", "35-35-35", "34-32-33",
539 +
#             "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
540 +
#             "35-35-35", "32-34-33", "19-19-20", "32-34-33", "29-31-30", "13-15-14",
541 +
#             "29-31-30", "32-34-33", "19-19-20", "32-34-33", "35-35-35", "34-32-33",
542 +
#             "35-35-35", "34-33-32", "25-26-26", "34-33-32", "35-35-35", "34-32-33",
543 +
#             "35-35-35")
544 +
#
545 +
# triad <- c(63, 62, 63, 61, 60, 61, 63, 62, 63, 59, 58, 59, 57, 56, 57,
546 +
#            59, 58, 59, 63, 62, 63, 61, 60, 61, 63, 62, 63, 55, 54, 55, 53,
547 +
#            52, 53, 55, 54, 55, 51, 50, 51, 49, 48, 49, 51, 50, 51, 55, 54,
548 +
#            55, 53, 52, 53, 55, 54, 55, 63, 62, 63, 61, 60, 61, 63, 62, 63,
549 +
#            59, 58, 59, 57, 56, 57, 59, 58, 59, 63, 62, 63, 61, 60, 61, 63,
550 +
#            62, 63, 47, 46, 47, 45, 44, 45, 47, 46, 47, 43, 42, 43, 41, 40,
551 +
#            41, 43, 42, 43, 47, 46, 47, 45, 44, 45, 47, 46, 47, 39, 38, 39,
552 +
#            37, 36, 37, 39, 38, 39, 35, 34, 35, 33, 32, 33, 35, 34, 35, 39,
553 +
#            38, 39, 37, 36, 37, 39, 38, 39, 47, 46, 47, 45, 44, 45, 47, 46,
554 +
#            47, 43, 42, 43, 41, 40, 41, 43, 42, 43, 47, 46, 47, 45, 44, 45,
555 +
#            47, 46, 47, 63, 62, 63, 61, 60, 61, 63, 62, 63, 59, 58, 59, 57,
556 +
#            56, 57, 59, 58, 59, 63, 62, 63, 61, 60, 61, 63, 62, 63, 55, 54,
557 +
#            55, 53, 52, 53, 55, 54, 55, 51, 50, 51, 49, 48, 49, 51, 50, 51,
558 +
#            55, 54, 55, 53, 52, 53, 55, 54, 55, 63, 62, 63, 61, 60, 61, 63,
559 +
#            62, 63, 59, 58, 59, 57, 56, 57, 59, 58, 59, 63, 62, 63, 61, 60,
560 +
#            61, 63, 62, 63, 31, 30, 31, 29, 28, 29, 31, 30, 31, 27, 26, 27,
561 +
#            25, 24, 25, 27, 26, 27, 31, 30, 31, 29, 28, 29, 31, 30, 31, 23,
562 +
#            22, 23, 21, 20, 21, 23, 22, 23, 19, 18, 19, 17, 16, 17, 19, 18,
563 +
#            19, 23, 22, 23, 21, 20, 21, 23, 22, 23, 31, 30, 31, 29, 28, 29,
564 +
#            31, 30, 31, 27, 26, 27, 25, 24, 25, 27, 26, 27, 31, 30, 31, 29,
565 +
#            28, 29, 31, 30, 31, 15, 14, 15, 13, 12, 13, 15, 14, 15, 11, 10,
566 +
#            11, 9, 8, 9, 11, 10, 11, 15, 14, 15, 13, 12, 13, 15, 14, 15,
567 +
#            7, 6, 7, 5, 4, 5, 7, 6, 7, 3, 2, 3, 1, 0, 1, 3, 2, 3, 7, 6, 7,
568 +
#            5, 4, 5, 7, 6, 7, 15, 14, 15, 13, 12, 13, 15, 14, 15, 11, 10,
569 +
#            11, 9, 8, 9, 11, 10, 11, 15, 14, 15, 13, 12, 13, 15, 14, 15,
570 +
#            31, 30, 31, 29, 28, 29, 31, 30, 31, 27, 26, 27, 25, 24, 25, 27,
571 +
#            26, 27, 31, 30, 31, 29, 28, 29, 31, 30, 31, 23, 22, 23, 21, 20,
572 +
#            21, 23, 22, 23, 19, 18, 19, 17, 16, 17, 19, 18, 19, 23, 22, 23,
573 +
#            21, 20, 21, 23, 22, 23, 31, 30, 31, 29, 28, 29, 31, 30, 31, 27,
574 +
#            26, 27, 25, 24, 25, 27, 26, 27, 31, 30, 31, 29, 28, 29, 31, 30,
575 +
#            31, 63, 62, 63, 61, 60, 61, 63, 62, 63, 59, 58, 59, 57, 56, 57,
576 +
#            59, 58, 59, 63, 62, 63, 61, 60, 61, 63, 62, 63, 55, 54, 55, 53,
577 +
#            52, 53, 55, 54, 55, 51, 50, 51, 49, 48, 49, 51, 50, 51, 55, 54,
578 +
#            55, 53, 52, 53, 55, 54, 55, 63, 62, 63, 61, 60, 61, 63, 62, 63,
579 +
#            59, 58, 59, 57, 56, 57, 59, 58, 59, 63, 62, 63, 61, 60, 61, 63,
580 +
#            62, 63, 47, 46, 47, 45, 44, 45, 47, 46, 47, 43, 42, 43, 41, 40,
581 +
#            41, 43, 42, 43, 47, 46, 47, 45, 44, 45, 47, 46, 47, 39, 38, 39,
582 +
#            37, 36, 37, 39, 38, 39, 35, 34, 35, 33, 32, 33, 35, 34, 35, 39,
583 +
#            38, 39, 37, 36, 37, 39, 38, 39, 47, 46, 47, 45, 44, 45, 47, 46,
584 +
#            47, 43, 42, 43, 41, 40, 41, 43, 42, 43, 47, 46, 47, 45, 44, 45,
585 +
#            47, 46, 47, 63, 62, 63, 61, 60, 61, 63, 62, 63, 59, 58, 59, 57,
586 +
#            56, 57, 59, 58, 59, 63, 62, 63, 61, 60, 61, 63, 62, 63, 55, 54,
587 +
#            55, 53, 52, 53, 55, 54, 55, 51, 50, 51, 49, 48, 49, 51, 50, 51,
588 +
#            55, 54, 55, 53, 52, 53, 55, 54, 55, 63, 62, 63, 61, 60, 61, 63,
589 +
#            62, 63, 59, 58, 59, 57, 56, 57, 59, 58, 59, 63, 62, 63, 61, 60,
590 +
#            61, 63, 62, 63)
Files Coverage
R 55.85%
src 83.58%
Project Totals (13 files) 61.92%
1
comment: false
2

3
coverage:
4
  status:
5
    project:
6
      default:
7
        target: auto
8
        threshold: 1%
9
    patch:
10
      default:
11
        target: auto
12
        threshold: 1%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading