Off by 1 index error when making community assignments to NumericVector res. Node index values passed to fastPG should be 1 to N. But res is a normal C++ array indexed from 0 to N-1. Thus, when preparing the res NumericVector, we should remember that node index value $i should be stored in res at $i-1. That way, back in R, users can see the community assignment for $i by looking at $res[$i].
Off by 1 index error when making community assignments to NumericVector res. Node index values passed to fastPG should be 1 to N. But res is a normal C++ array indexed from 0 to N-1. Thus, when preparing the res NumericVector, we should remember that node index value $i should be stored in res at $i-1. That way, back in R, users can see the community assignment for $i by looking at $res[$i].