Bool edge selector

Is it possible to select edges from a vector of 1's and 0's?

For example I have a graph G (with igraph_ecount = E) and a vector of length E with 1s for the edge IDs I want in the edge selector (igraph_es_vector) and 0s for the rest (to leave out). I can make a loop to collect the IDs, but I was wondering if there is another option.

I am not terribly experienced with edge selectors, but I do not think that there is any built-in functionality for this. I would write a function to find the positions of the 1s in the bool vector, store the positions in a vector, then use igraph_es_vector on that.

2 Likes

I believe you are right @szhorvat, there doesn’t seem to be such a function.

It might be useful to have a functionality igraph_vector_which_equals similar to the igraph_vector_which_max function which returns a vector of elements that equals the indicated value. That way, it would be a bit easier to get the required vector.