Triangle counting algorithm | ScratchStats