igraph-help
[Top][All Lists]

 From: Tadaishi Yatabe-Rodriguez Subject: [igraph] triad census Date: Tue, 26 May 2015 10:41:30 +0100

Hi all,

I'm trying to calculate transitivity of the form B <- A -> C, where also B->C in a directed graph. For this I counted all the neighbors looping over each vertex using the function neighbors(graph[i], mode='out'). Then I counted the number of neighbors using the function length. Finally I get the number of possible triplets for each vertex using combinatorial, i.e. choose(number.neihgbors, 2) and I got the number of triplets of the form  B <- A -> C for each vertex. When I added them all and then compare with the results from triad census for the same kind of triplets results didn't match. Any idea why? Here's the code

##Successors of A
Successor=list()
for (i in 1:vcount(el.13)){

Successor[[i]] <- neighbors(el.13, v=V(el.13)[i], mode = "out")

}
### Clustering of the form B <- A -> C, where also B->C

n.succ <- sapply(Successor, FUN=length)

trip <- choose(n.succ, 2)
triplets <- sum(trip)

Thanks!

--