This function counts the different subgraphs of three vertices in a graph.
triad_census(graph)A numeric vector, the subgraph counts, in the order given in the above description.
The input graph, it should be directed. An undirected graph results a warning, and undefined results.
Gabor Csardi csardi.gabor@gmail.com
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<->B->C.
A->B<-C, A->C.
A<-B<-C, A->C.
A<->B<->C.
A<-B->C, A<->C.
A->B<-C, A<->C.
A->B->C, A<->C.
A->B<->C, A<->C.
A<->B<->C, A<->C, the complete graph.
This functions uses the RANDESU motif finder algorithm to find and count the
subgraphs, see motifs.
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.
dyad_census for classifying binary relationships,
motifs for the underlying implementation.
g <- sample_gnm(15, 45, directed = TRUE)
triad_census(g)
Run the code above in your browser using DataLab