R & C++ code for fitting SBMs