Re: [R] vertex labels in igraph from adjacency matrix

From: Mark W Kimpel <mwkimpel_at_gmail.com>
Date: Wed, 05 Mar 2008 10:00:50 -0500

Looks like I turned an "off my one error" into an "off by two error" by adding rather than subtracting. Clearly a logic error on my part.

Also, which.max is clearly superior as it results in half as many function calls.

Thanks guys!

As an aside, although igraph may use the C indexing convention, R users and their code, is much more in tune with indexing beginning at 1. Adjusting this in the R interface to igraph may solve many headaches down the road.

Mark

Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry Indiana University School of Medicine

15032 Hunter Court, Westfield, IN 46074

(317) 490-5129 Work, & Mobile & VoiceMail (317) 204-4202 Home (no voice mail please)

mwkimpel<at>gmail<dot>com


Gabor Csardi wrote:
> On Wed, Mar 05, 2008 at 02:27:21AM -0500, Charilaos Skiadas wrote:
> [...]
>> Btw, you will likely want to take the betweenness call out, and call
>> it once and store the result, instead of calling it twice (well,
>> assuming the graph is largish). Or even better, use which.max:
>>
>> which.max(betweenness(graph = my.graph, v=V(my.graph), directed =
>> FALSE))
>
> This is almost good, but there is a catch, in igraph vertices are
> numbered from zero. So if you want an igraph vertex id, then you
> need to subtract one from this, i.e.:
>
> maxb <- which.max(betweennness(my.graph, directed=FALSE))-1
>
> You can double check it:
>
> betweenness(my.graph, maxb, directed=FALSE)
>
> Gabor
>
> PS. there is also an igraph mailing list, see the igraph homepage
> at igraph.sf.net
>
>> Haris Skiadas
>> Department of Mathematics and Computer Science
>> Hanover College
>>
> [...]
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 05 Mar 2008 - 15:03:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 05 Mar 2008 - 15:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive