[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Change order of vertices in an igraph object
From: |
Hermann Norpois |
Subject: |
Re: [igraph] Change order of vertices in an igraph object |
Date: |
Thu, 21 Nov 2013 10:54:30 +0100 |
Hello,
thanks for your suggestions, but it did not work. Maybe I did not understand how pertmute.vertices work. Maybe I was not clear enough concerning my needs.
This was my approach:
I expected that the new order in my igraph object is the order of my index vector idx after permute.vertices (g, idx).
But this is not the case. For instance:
> gnames <- V (g)$name
> which (gnames=="rs4822754")
[1] 1858
> idx <- order (V (g)$x) # index vector
> idx[1:20]
[1] 1 2 3 4 5 6 7 8 9 1854 10 11 12 1857 1855
[16] 13 1856 1858 14 15 #according to idx the 1858th element of g is on the 18th position
> gg <- permute.vertices (g, idx) # using the index vector
> ggnames <- V(gg)$name
> which (ggnames=="rs4822754")
[1] 1462 # I expected 18
Could you please comment on this.
Thanks
Hermann