corybrunson/bitriad

triad census in C++

corybrunson opened this issue · 2 comments

Re-implement the triad census function in C++ (via Rcpp) as triadcensus_an, to replace the current function triad_census_an (after benchmarking).

A rough implementation triad_census_batagelj_mrvar() based on the algorithm of Batagelj and Mrvar (2001) agrees with the original (now triad_census_original()) on women_clique and on women_group. It remains to be vetted on the remaining example datasets and on some larger example graphs not included in the package.

An important limitation is that the function takes as inputs a vector of the actor node IDs and the maximum number of events attended by both of two actors, which expedite the calculation but must currently be calculated in R. The function should instead be self-contained for the eventual release.

triad_census_batagelj_mrvar() is self-contained and about 1 order of magnitude faster than triad_census_batagelj_mrvar_alt() (previous implementation). An issue with scotland1920s revealed that the dataset was not properly formatted as an affiliation network (nodes were not sorted with actors first); this has been corrected.