I’m recently switching the code from Python to C++, and now I encounter some problems on igraph_vector_t.
- In Python, if I want to randomly choose an element from a list, I just have to import a random package and type in
random.choice(list)
Now I want to randomly pick a neighbor from the neighbor list of a vertex, so my code is
igraph_vector_int_t neis; igraph_vector_int_init(neis, 0); igraph_neighbors(&graph, neis, 0, IGRAPH_OUT);
How to randomly pick a neighbor from neis?
- After picking an element, I want to remove it from the igraph_vector_int_t. I want to do the same thing as in Python list.remove(element), what function should I call?
And, if I want to append a new element in the igraph_vector_int_t, what function should I call?
Thank you for answering me.