Triad census, subgraphs with three verticesSource:
This function counts the different induced subgraphs of three vertices in a graph.
The input graph, it should be directed. An undirected graph results a warning, and undefined results.
Triad census was defined by David and Leinhardt (see References below). Every triple of vertices (A, B, C) are classified into the 16 possible states:
A,B,C, the empty graph.
A->B, C, the graph with a single directed edge.
A<->B, C, the graph with a mutual connection between two vertices.
A<-B->C, the out-star.
A->B<-C, the in-star.
A->B->C, directed line.
A<->B<->C, A<->C, the complete graph.
This functions uses the RANDESU motif finder algorithm to find and count the
See also Davis, J.A. and Leinhardt, S. (1972). The Structure of Positive Interpersonal Relations in Small Groups. In J. Berger (Ed.), Sociological Theories in Progress, Volume 2, 218-251. Boston: Houghton Mifflin.
Gabor Csardi email@example.com
g <- sample_gnm(15, 45, directed = TRUE) triad_census(g) #>  107 177 33 23 22 36 20 15 11 2 1 3 1 4 0 0