|
From: | Tadaishi Yatabe-Rodriguez |
Subject: | Re: [igraph] triad census |
Date: | Tue, 26 May 2015 16:41:29 +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 ASuccessor=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->Cn.succ <- sapply(Successor, FUN=length)trip <- choose(n.succ, 2)triplets <- sum(trip)Thanks!--Tadaishi YatabeDVM, MPVM, PhD (C)Center for Animal Disease Modeling and Surveillance (CADMS)Department of Medicine and EpidemiologySchool of Veterinary MedicineUniversity of California Davis
[Prev in Thread] | Current Thread | [Next in Thread] |