igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] find highest degrees


From: John Lapeyre
Subject: Re: [igraph] find highest degrees
Date: Sat, 20 Feb 2010 20:23:25 +0100
User-agent: KMail/1.12.4 (Linux/2.6.31.9; KDE/4.3.4; x86_64; ; )

> VECTOR(v) gives you the underlying C array of a VECTOR.
  Yes I forgot that.

> There is a function called igraph_vector_copy_to(), that does almost
> the same, the only difference is that it copies the whole vector.

  That one is perfect. I missed it.

> Btw. I think it is simpler to sort the two vectors and then merge
> them. This involves copying them, of course, but the heap approach
> copies as well, and I guess that the C library quicksort will be
> faster than the heap-sort. Even if it is not faster, it is surely
> easier to implement, you just need to
> 
> 1. copy the two vectors
> 2. sort them
> 3. merge them (this needs a vector_union_sorted function), but this is
> trivial to write.

You are talking about the union, I think ? I haven't
needed it yet. But I'll probably use your approach when I do
need it. So far, I only needed the cardinality of the
union. For that, I did no copying, sorting of one vector and binary
searching in the sorted vector.





reply via email to

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