igraph-help
[Top][All Lists]

## Re: [igraph] about triangle transitivity

 From: gunce orman Subject: Re: [igraph] about triangle transitivity Date: Fri, 13 Jan 2012 14:18:12 +0100

Ok thank you, Is this code correct for square transitivity counting?

# plot all motifs for 4 nodes (undirected)
for(i in 0:10)
{ cat("printing motif #",i,"\n")
pdf(file=paste("c:/",i,".pdf",sep=""),bg="white")
plot(graph.isocreate(size=4,number=i,directed=FALSE))
dev.off()
}

square.transitivity <- function(g)
{ motifs.counts <- graph.motifs(graph=g,size=4)
# 6: incomplete square (when index starts from 0)
incomplete.squares <- motifs.counts[7]
# 8: complete square (when index starts from 0)
complete.squares <- motifs.counts[9]
# process 'square'-transitivity
result <- complete.squares / (complete.squares + incomplete.squares)
return(result)
}

# examples
g <- graph(edges=c(0,1,1,2,2,3,3,0,0,4),directed=FALSE)
plot(g)
square.transitivity(g) # supposed to be 1/3 (2 incomplete and 1 complete squares)
g <- barabasi.game(n=100,m=3,directed=FALSE)
square.transitivity(g)

On Thu, Jan 12, 2012 at 3:28 PM, Moses Boudourides wrote:
Right.

--M

On Thu, Jan 12, 2012 at 4:26 PM, Gábor Csárdi <address@hidden> wrote:
> Yes, although matrix multiplications are expensive. The initial matrix
> is probably sparse, so that is fine, but then it gets denser (quickly
> if the network is small-world). So this would work only for small
> graphs.
>
> G.
>
> On Thu, Jan 12, 2012 at 9:23 AM, Moses Boudourides
>> Well, another option would be to use the formulas for the powers of
>> the adjacency matrix, although it might involve some work to derive
>> the corresponding expressions for 5-cycles and higher. I'm not sure,
>> this might have been already done in graph theory. If I was attempting
>> to do it, I would start from counting redundancies as in the
>> fundamental paper of Harary & Ross (Psychometrica, 1952).
>>
>> --Moses
>>
>> On Thu, Jan 12, 2012 at 4:00 PM, Gábor Csárdi <address@hidden> wrote:
>>> Hi,
>>>
>>> graph.motifs() (in R) supports motifs of size 3 and 4 currently. There
>>> is not much more code needed to support larger motifs, but these are
>>> not implemented yet.
>>>
>>> If you are looking for a specific motif, then you can also use the
>>> graph.count.subisomorphisms.vf2() function.
>>>
>>> G.
>>>
>>> On Thu, Jan 12, 2012 at 4:53 AM, gunce orman <address@hidden> wrote:
>>>> Hello,
>>>>
>>>> Transitivity only measures the number of triangles in a network.  But there
>>>> are other short cycles (e.g., 4-cycles) which are common in networks. Are we
>>>> able to calculate those types of 4- and more cycles as well as counting
>>>> triangles in igraph.
>>>>
>>>> Thank you
>>>>
>>>> _______________________________________________
>>>> igraph-help mailing list
>>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>>>
>>>
>>>
>>>
>>> --
>>> Gabor Csardi <address@hidden>     MTA KFKI RMKI
>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>> _______________________________________________
>> igraph-help mailing list
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
>
> --
> Gabor Csardi <address@hidden>     MTA KFKI RMKI
>
> _______________________________________________
> igraph-help mailing list