igraph icon indicating copy to clipboard operation
igraph copied to clipboard

Leiden algorithm: add iteration scheme to C core

Open szhorvat opened this issue 5 years ago • 7 comments

@vtraag I noticed that both the Python and R bindings you contributed support iterating the algorithm multiple times, potentially until nothing changes.

So far, the philosophy that igraph followed was to implement as much as possible in the C core. It would be useful to include the iteration scheme in the C core as well, even if that seems trivial. It would both reduce the burden for the implementors of high-level interfaces, and provide some guidance on how to use the Leiden function.

szhorvat avatar Jun 29 '20 06:06 szhorvat

Indeed, this would be a nice addition to the C core.

ntamas avatar Jun 29 '20 12:06 ntamas

I indeed considered that too trivial to implement in the C core. But if you feel it is better implemented in the C core, that would be fine as well. I will then also implement the use of modularity immediately, that is now also left to the higher-level interface.

vtraag avatar Jun 30 '20 07:06 vtraag

It would also ensure some consistency between different high-level interfaces.

szhorvat avatar Jun 30 '20 14:06 szhorvat

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 31 '20 10:08 stale[bot]

I'd love to see this implemented.

szhorvat avatar May 31 '21 11:05 szhorvat

It'd be really great to have this in 0.10 if you have time @vtraag. I'll add it to that milestone so it doesn't get forgotten, but if we don't have time, we'll just skip it.

szhorvat avatar Mar 03 '22 08:03 szhorvat

Ping on this. I don't want to re-implement this for the Mma interface, so I'd love to see this implemented in the C core. Targeting to 0.10.x.

szhorvat avatar Jul 22 '22 12:07 szhorvat

I'll try to get this implemented before 0.10. I was just thinking to extend the main function as

igraph_error_t igraph_community_leiden(const igraph_t *graph,
                            const igraph_vector_t *edge_weights, const igraph_vector_t *node_weights,
                            const igraph_real_t resolution_parameter, const igraph_real_t beta, const igraph_bool_t start,
+                            const igraph_integer_t iterations,
                            igraph_vector_int_t *membership, igraph_integer_t *nb_clusters, igraph_real_t *quality) {

Is this what you had in mind @szhorvat ? Or would you expect something else here still?

vtraag avatar Aug 30 '22 12:08 vtraag

Yes, that sounds good to me.

szhorvat avatar Aug 30 '22 13:08 szhorvat