Hello,
I would like to create a graph in order to see the clustering coeffcient C(k) depending on k.
I've the following formula:
C(i)=ei/(ki(ki-1)/2) and C(k)=(1/Nk) somme (i:ki=k) C(i)
I read that transitivity was the same as clustering coefficent.
I did
cluster=transitivit(G, type="local")
So I've got a vector containing value, and NA.
Q1: Does the value correspond to C(i) or C(k)?
Q2: Are the values ordered by degree (k) or by nodes in the vector?
Q3: If it's ordered by degree, I guess that the first degree in that is 1 since degree 0 has no neighbors?
If my values correspond to C(k) and are ordered by degree k, I though to do the following script to create my
plot:
cluster=cluster[!is.na(cluster) #to remove NA
deg=degree(G) #to obtain list of degree
deg=unique(deg)#to remove duplicate
deg=sort(deg) # to order k degree
deg=deg[!deg==0] to remove k degree 0
length(deg)
length(cluster) # to check that both vectors have the same length
data="">
plot(data, type="o", xlab="k", ylab="c(k)")
Q4: Does it look ok?
Q5: for the mean of cluster coeffcient, If I remove the NA, its change the length of my vector so the mean, what is the correct mean in that case?
Indeed, if I replace Na by zero, I've got a mean=0.222 (which match what I obtain in Gephi when I upload my file)
if I suppress Na, I've got a mean=0.451. If it's 0.222
the right value, I just have to sum the vector obtained after removing NA and divide it by the number of nodes of my network.
Thanks in advance for any answers,
Delph
- [igraph] Creation of a plot showing clustering coefficient depending on degree k,
Delphine Faugaret <=