igraph-help
[Top][All Lists]

## Re: [igraph] Re: Centralization in igraph?

 From: Gabor Csardi Subject: Re: [igraph] Re: Centralization in igraph? Date: Fri, 20 Jun 2008 01:59:46 -0500 User-agent: Mutt/1.5.17+20080114 (2008-01-14)

```Hi Uri,

On Thu, Jun 19, 2008 at 05:29:04PM -0400, Uri Shwed wrote:
> Hi Gabor,
> Thanks for the quick reply!
> 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
> }
>
> ??

hmmm, not really, the most centralized graph is different for
different centrality scores.

> 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
> imported as directed edgelist - my other set of undirected valued graphs
> is fine.

Without an example I can only guess that this is the 0/1 problem.
In igraph vertices are numbered from zero. Subtract one from the
edge list.

G.

> 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
>>>
>>
>>
>
>
>
> _______________________________________________
> igraph-help mailing list