
From:  Chris Watson 
Subject:  Re: [igraph] triad census 
Date:  Tue, 26 May 2015 12:04:06 0400 
Further to my previous email, this is how I found the number of triangles:conn < array (dim = c(vcount(el.13), vcount(el.13), vcount(el.13)))for (i in 1:length(Successor)){for (j in 1:length(Successor[[i]])) {for (k in (j+1):(length(Successor[[i]]))){conn[i,j,(k1)] < ifelse(length(Successor[[i]]) < 2, NA,ifelse(k > length(Successor[[i]]), NA,ifelse(V(el.13)[Successor[[i]][j]]==V(el.13)[Successor[[i]][k]],NA,are.connected(el.13, V(el.13)[Successor[[i]][j]], V(el.13)[Successor[[i]][k]]))))}}}So transitivity, as defined previously would be:trans < sum(conn, na.rm = T)/tripletsCould someone more experienced tell me if this is ok and the reason of the differences with triad.census in the number of triplets of the form B < A > C ???Thanks!On Tue, May 26, 2015 at 10:41 AM, Tadaishi YatabeRodriguez <address@hidden> wrote: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 DavisTadaishi YatabeDVM, MPVM, PhD (C)Center for Animal Disease Modeling and Surveillance (CADMS)Department of Medicine and EpidemiologySchool of Veterinary MedicineUniversity of California Davis
_______________________________________________
igraphhelp mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraphhelp
[Prev in Thread]  Current Thread  [Next in Thread] 