Hello Vincent, Normally you would have to program this yourself. E.g. you can generate a vector of increasing integers (vertex indices), write a custom comparison function that compares v1 and v2 through degrees[v1] and degrees[v2], then use this to sort the indices (e.g. through the qsort() C standard library function, or much more easily with std::sort() in C++)
Luckily, this is already done in igraph, though not documented. The function is igraph_vector_qsort_ind() You'll find its description in the vector.pmt file. On 22 March 2018 at 20:56, Vincent Beugnet <beugnet.vinc...@free.fr> wrote: > Hello, > I'd like to sort all vertices from a graph (undirected) by decreasing > degree and print their ids with this order. But as the vector in > igraph_degree is not related with the graph, > The degree vector is related with the graph in that the degree of the nth vertex is the nth entry in the vector. > I don't know how to get the ordered ids. Can someone help me ? > > Thanks > > P.S: I'm using the C library > > _______________________________________________ > 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