[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] triad census

From: Tadaishi Yatabe-Rodriguez
Subject: Re: [igraph] triad census
Date: Thu, 28 May 2015 09:46:27 +0100

Ok. Thanks Tamas.


On Wed, May 27, 2015 at 9:18 PM, Tamas Nepusz <address@hidden> wrote:

> 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 out-star (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

degs <- degree(g, mode="out")

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.


igraph-help mailing list

Tadaishi Yatabe
Center for Animal Disease Modeling and Surveillance (CADMS)
Department of Medicine and Epidemiology
School of Veterinary Medicine
University of California Davis

reply via email to

[Prev in Thread] Current Thread [Next in Thread]