[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [igraph] sort an edge sequence

**From**: |
Gábor Csárdi |

**Subject**: |
Re: [igraph] sort an edge sequence |

**Date**: |
Sun, 18 Jul 2010 08:12:37 +0200 |

Hi,
if 'eg' is your edge sequence, then I think
E(g)[ as.numeric(eg)[ order(get.edges(g, eg)[,2]) ] ]
does what you want, but be careful with the indexing if edge
sequences, it is quite nasty.
Best,
Gabor
On Sat, Jul 17, 2010 at 4:35 PM, Ana Sofia Morais
<address@hidden> wrote:
>* Hello,*
>
>
>
>* I have an edge sequence taken from a directed graph, such as:*
>
>
>
>* [55354] 1850 -> 618*
>
>* [55355] 1850 -> 750*
>
>* [55356] 1850 -> 1914*
>
>* [55357] 1850 -> 649*
>
>* [55358] 1850 -> 1160*
>
>* [55359] 1850 -> 605*
>
>* [55360] 1850 -> 2080*
>
>* [55361] 1850 -> 563*
>
>* [55362] 1850 -> 58*
>
>
>
>* The first number in each line is the edge id. The second number and third*
>* numbers are the ids of the vertices that send and receive the edge,*
>* respectively.*
>
>
>
>* The edge sequence is ordered by the edge ids. What I need to do is to sort*
>* the edge sequence by the id of the endpoint vertices, i.e., those that*
>* receive the edges. And I need to do so while preserving the edge ids.*
>
>
>
>* I would be very grateful if you could give me a suggestion to solve this*
>* problem.*
>
>
>
>* Best,*
>
>
>
>* Sofia*
>
>* _______________________________________________*
>* igraph-help mailing list*
>* address@hidden*
>* http://lists.nongnu.org/mailman/listinfo/igraph-help*
>
>
--
Gabor Csardi <address@hidden> UNIL DGM