I am currently using igraph
to get the traid census of a given directed graph usingtriad_census(g)
. This returns the count of triads in each of the 16 classes.
e.g., 16 3 0 10 1 0 0 0 0 0 0 0 0 0 0 0
However, I would like to know more details of the triads than these summary statistics.
i.e. given that the network has 16 of 003
, what they are? given that the network has 3 012
, what they are?
Example: The 3 traids of 012
are (john -> emi, jenne)
, (cena -> ally, john)
, (emi -> peter, david)
Is there a way of doing this in r or python?
MWE
Graph data: http://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxkYWlzaGl6dWthfGd4OmFmZTI0NjhlMjQ0ZDQ5MQ
Code:
library(igraph)
#import the sample_dw_adj.csv file:
dat=read.csv(file.choose(),header=TRUE,row.names=1,check.names=FALSE) # read .csv file
m=as.matrix(dat)
net=graph.adjacency(m,mode="directed",weighted=TRUE,diag=FALSE)
plot.igraph(net,vertex.label=V(net)$name,layout=layout.fruchterman.reingold, vertex.label.color="black",edge.color="black",edge.width=E(net)$weight/3, edge.arrow.size=1.5)
So, my actual graph would look like as follows.
I am happy to provide more details if needed.