igraph-help
[Top][All Lists]

## [igraph] Re: Centralization in igraph?

 From: Uri Shwed Subject: [igraph] Re: Centralization in igraph? Date: Thu, 19 Jun 2008 17:29:04 -0400 User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

```Hi Gabor,
```
in evcent the tmaxdev value for directed graphs is simply the number of nodes -1, right? So a general centralization function for directed graphs could be:
```
centralize <- function(scores, normalize=TRUE) {
cent <- sum(max(scores)-scores)
tmax<-length(scores)-1
if (normalize) {
cent <- cent/tmax
}
cent
}

??

```
In addition, I've just noticed that all my graphs, created by "graph.edgelist(x)", have one more node than their corresponding networks, created by "as.network(x, matrix.type="edgelist")". Any idea why, or what I should do about this? I only have this problem with data imported as directed edgelist - my other set of undirected valued graphs is fine.
```Thanks,
Uri

Gabor Csardi wrote:
```
Uri, thanks, that's kind of you, but actually it is not included in igraph. But it very simple to do it:
```
centralize <- function(scores, tmax, normalize=TRUE) {
cent <- sum(max(scores)-scores)
if (normalize) {
cent <- cent/tmax
}
cent
}

```
It is a bit different than sna, you have to give the 'tmax' argument 'by hand', as igraph centrality functions do not support returning the theoretical maximum. Here is how to use it:
```
library(igraph)
g <- simplify(ba.game(1000, m=2))
centralize(degree(g), tmax=997002, normalize=TRUE)

g2 <- erdos.renyi.game(1000, 4/999)
centralize(degree(g2), tmax=997002, normalize=TRUE)

Unfortunately, you'll need to calculate the theoretical
```
maximum for the hub scores..... You can see the evcent function of SNA (tmaxdev=TRUE) to get a hint....
```Please tell me if you could find it out.

Gabor

```
ps. please consider writing to the igraph-help mailing list next time. Thanks.
```
On Thu, Jun 19, 2008 at 02:49:57PM -0400, Uri Shwed wrote:
```
```Dear Gabor,
```
Does igraph supports a general centralization calculation, like sna? I need a GLI for Klienberg hub and authority scores. Knowing igraph's style, I'm sure its there somewhere....
```Thanks,
Uri
```
```
```
```

```