Count the number of different types of triangles (fully connected node triplets) in the graph.

For more details see:

T. Roughgarden, Reading in Algorithms Counting Triangles, Stanford University (2014)