Hi Anupam,
I needed other forms of normalisation and centralisation today, and I
thought you too might find these R functions useful. The following
functions are implementations of Freeman's normalisation forumale. I
have checked them against Pajek's output for some test networks and
they produce the same results.
Cheers,
Matthew
degree.norm <- function(graph, ...) {
deg <- degree(g, ...)
n <- vcount(graph)
deg/(n-1)
}
betweenness.norm <- function(graph, ...) {
bet <- betweenness(graph, ...)
n <- vcount(graph)
(2 * bet) / (n*n - 3*n + 2)
}
degree.centralisation <- function(graph, ...) {
deg <- degree(g, ...)
n <- vcount(graph)
(max(deg)*n - sum(deg)) / (n*n - 3*n +2)
}
betweenness.centralisation <- function(graph, ...) {
bet <- betweenness(graph, ...)
n <- vcount(graph)
2 * (max(bet)*n - sum(bet)) / (n*n*n - 4*n*n + 5*n - 2)
}
closeness.centralisation <- function(graph, ...) {
if (!is.connected(graph)) warning("This graph is disconnected; calculation\
of closeness centrality on a disconnected graph is only possible because\
igraph assumes a non-infinite distance (that is equal to the number of\
vertices in the network) between two disconnected vertices.")
clo <- closeness(g, ...)
n <- vcount(graph)
(max(clo)*n - sum(clo))*(2*n - 3) / (n*n - 3*n + 2)
}
anupam sinha wrote:
Hi Matthew ,
Thanks a million for your help.
Regards,
Anupam
On Wed, Nov 18, 2009 at 1:25 AM, Matthew
Walker <address@hidden>
wrote:
Hi Anupam,
I dont really use iGraph under R (I use the C-language version), so you
are better to pose this question to the list. However, from what I
know, the line should just about work in R as it is:
You could try:
library(igraph)
g <- random.graph.game(10, 3/10) # This produces a random graph
g <- graph( c(0,4, 1,4, 2,4, 3,4), directed=FALSE ) # This produces a star network that contains extreme values for betweenness
bet <- betweenness(g)
n <- vcount(g)
(2 * bet) / (n*n - 3*n + 2)
Cheers,
Matthew
anupam sinha wrote:
Hi Matthew,
Thanks a lot for your suggestion. Can you please tell
me how to apply it using R ? Thanks in advance.
Regards,
Anupam
On Tue, Nov 17, 2009 at 7:11 PM, Matthew
Walker <address@hidden>
wrote:
Hi
Anupam,
Freeman's paper [1] gives information on how betweenness values can be
normalised. You would be specifically interested in the formula on
page 224:
(2 * igraph_betweenness()) / (n*n - 3*n + 2)
where n is the number of nodes in the graph (igraph_vcount()).
I hope that helps,
[1] Linton C. Freeman. 1979. "Centrality in Social Networks
Conceptual Clarification" in Social Networks 1 (1978/79). Pages
215--239.
Matthew
anupam sinha wrote:
Hi
all,
The betweenness centrality value generated for a specific
network is not normalized (i.e. it depends on network size) if one is
using the "betweenness" function of igraph. My query is how does one
normalize the betweenness values for all the nodes of a directed
network . Thanks in advance for any help.
Regards,
Anupam
_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help
_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help
|