
From:  Tadaishi YatabeRodriguez 
Subject:  Re: [igraph] triad census 
Date:  Thu, 28 May 2015 09:46:27 +0100 
Hi,
> 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?
You have calculated the number of (A,B,C) triplets where the following
conditions hold:
 there is an edge from A to B
 there is an edge from A to C
Note that we do not know whether there is an edge from B to A, C to A, B to
C or C to B. However, when you look at the number of outstar (i.e. B < A >
C) triads in the triad census, this would give you the number of those triads,
where there is an edge from A to B and A to C but there is _no_ edge from B to
A, B to C, C to A or C to B. So that's why the two numbers are different.
(Footnote: you can simply do this  it should be equivalent to what you do
now:
degs < degree(g, mode="out")
sum(degs*(degs1)/2)
)
As for calculating the transitivity you need, basically you need the ratio of
the number of triplets that fit the (B < A > C, B > C) pattern, divided by the
number of triplets that fit the (B < A > C) pattern. The numerator and the
denominator will be a sum of certain components of the triad census (see
?triad.census for the exact meaning of each component), you only need to figure
out which of the triads fit the two patterns.
T.
_______________________________________________
igraphhelp mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraphhelp
[Prev in Thread]  Current Thread  [Next in Thread] 