igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## [igraph] find highest degrees

 From: John Lapeyre Subject: [igraph] find highest degrees Date: Thu, 18 Feb 2010 18:30:54 +0100 User-agent: KMail/1.12.4 (Linux/2.6.31.9; KDE/4.3.4; x86_64; ; )

```Hello All,

I would like to remove some of the vertices of highest
order from a graph using the igraph C library. Ie, if the
vertex-orders were sorted, take the n highest numbers and
remove the corresponding vertices. Is there some idiomatic
way of doing this?

There are a few subtasks that could be used to achieve
this task, such as obtaining a list of the vertex ids
in order of descending vertex-order. They might be of
general use.

Getting an igraph_vector vo of the vertex-orders indexed
by vertex id is easy enough. I played with the undocumented
igraph_vector_order1(), but it seems to work only for an
array of unique positive integers.

Currently, I am looking at doing a quicksort of vo while
effectively keeping track of the permutations of the
indices. There seem to be a few ways to do this. Perhaps
most computationally efficient is getting the source to a
quicksort implementation and then swapping elements in an
array of indices each time the vertex-orders are swapped.
But I thought it is a good idea to write to this list before
plunging in.

An unrelated task is taking the union of two igraph_vectors
of vertex ids considered as sets. That is, combine the lists,
but don't put in duplicates. This seems like it might be a
generally useful task. (or eg just return the number of vertices
in the union)  These were not so difficult to write, but
are worth mentioning.

Thanks,
John

```

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]