Re: [igraph] Sorting vertices by degree with igraph C library

2018-03-24 Thread Szabolcs Horvát
I do not know.  I believe that the documented ones in igraph are not stable.

Personally, I would just use std::stable_sort() from the C++ standard
library. Is there any reason why you don't want to use that, and want
something from igraph instead?

On 24 March 2018 at 15:48, Vincent Beugnet  wrote:

> Thank you very much !
>
> Last question: is there a stable sort already implemented in igraph ?
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] Sorting vertices by degree with igraph C library

2018-03-24 Thread Szabolcs Horvát
To give a concrete example, you could sort an igraph vector 'vec' using

std::stable_sort(vec.stor_begin, vec.stor_end);

To stick to the documented API (might be a good idea), you can use

std::stable_sort(VECTOR(vec), VECTOR(vec) + igraph_vector_size(&vec));

http://en.cppreference.com/w/cpp/algorithm/stable_sort

You don't need to use any other C++ features in your program if you don't
like C++. You can keep it as C.  Compiling as C++ will only impose minor
restrictions.

On 24 March 2018 at 17:20, Szabolcs Horvát  wrote:

> I do not know.  I believe that the documented ones in igraph are not
> stable.
>
> Personally, I would just use std::stable_sort() from the C++ standard
> library. Is there any reason why you don't want to use that, and want
> something from igraph instead?
>
> On 24 March 2018 at 15:48, Vincent Beugnet 
> wrote:
>
>> Thank you very much !
>>
>> Last question: is there a stable sort already implemented in igraph ?
>>
>> ___
>> igraph-help mailing list
>> igraph-help@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>
___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] Sorting vertices by degree with igraph C library

2018-03-24 Thread Vincent Beugnet
Thank you very much ! 

Last question: is there a stable sort already implemented in igraph ? 
___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help