I have been trying to count the number of loops using count_multiple function for a particular vertex. But, I seem to get an error. The adjacency matrix is correct, so n_loop for the edges (0,0) should be 3. But, I get the answer to be 1. See the code below. Not sure what is going on.
Would appreciate comments. Thx, Sid
OK, so it turns out that this comes from the C interface (not specific to Python as I assumed, sorry @tamas). As far as I’m concerned, it’s a bug in the handling in directed graphs. See what we get in R:
Thank you. While you are filing your PR, here is my temporary workaround for counting loops of a vertex v_id.:
n_loop=(g.degree(v_id,loops=True,mode=ALL)-g.degree(v_id,loops=False,mode=ALL))/2
Unfortunately you would need to recompile the entire R interface from scratch, from the codebase hosted on Github. Not sure if there is an easy way for that (@Gabor?). Alternatively, you should wait for the next release and use the workaround until then.
@tamas, Sid is using the Python interface. Could we maybe just update the submodule there and provide instructions for installing the development version?
Ah, sorry, I missed that. I have updated the python-igraph repo on GIthub. If the CI tests pass, then in theory one could install the patched version of python-igraph from Git as follows: