igraph-help
[Top][All Lists]
Advanced

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

[igraph] error in density calculation?


From: Ju-Sung Lee
Subject: [igraph] error in density calculation?
Date: Wed, 27 Nov 2013 08:35:18 -0800 (PST)

After some examination, igraph's calculations for density of a graph with self-loops is counter to what I expected.  Here is what I expected (in R) assuming an undirected, unweighted graph G with adjacency matrix 'A' (of R class 'matrix'):

( sum(A[upper.tri(A)]) + sum(diag(A)) )/((n*(n-1)/2) + n)

However, igraph's graph.density(G,loops=T) calculates:

( sum(A[upper.tri(A)]) + sum(diag(A)) )/((n*(n-1)/2) + n/2)

Would someone point me to some literature that states the self-loop part of the divisor in an undirected graph should be halved?  Or is igraph's calculation incorrect?

Thanks.

Jay


reply via email to

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