Skip to content

Commit 6d6111e

Browse files
committed
add: directed Leiden support and fix grid graph error
1 parent ed837d8 commit 6d6111e

File tree

3 files changed

+21
-222
lines changed

3 files changed

+21
-222
lines changed

doc/source/community_detection_guide/notebooks/community_detection_algorithms.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
"data": {
273273
"text/html": [
274274
"<!--| quarto-html-table-processing: none -->\n",
275-
"<table id=\"itables_d54d3050_4e9f_417d_a5f1_4308e602dc16\"><tbody><tr>\n",
275+
"<table id=\"itables_75c81ab6_ca9f_4959_8b2f_473b29b55ef3\"><tbody><tr>\n",
276276
" <td style=\"vertical-align:middle; text-align:left\">\n",
277277
" <a href=https://mwouts.github.io/itables/><svg class=\"main-svg\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n",
278278
"width=\"64\" viewBox=\"0 0 500 400\" style=\"font-family: 'Droid Sans', sans-serif;\">\n",
@@ -370,11 +370,11 @@
370370
"<script type=\"module\">\n",
371371
" const { ITable, jQuery: $ } = await import(window._datatables_src_for_itables_2_4_4);\n",
372372
"\n",
373-
" document.querySelectorAll(\"#itables_d54d3050_4e9f_417d_a5f1_4308e602dc16:not(.dataTable)\").forEach(table => {\n",
373+
" document.querySelectorAll(\"#itables_75c81ab6_ca9f_4959_8b2f_473b29b55ef3:not(.dataTable)\").forEach(table => {\n",
374374
" if (!(table instanceof HTMLTableElement))\n",
375375
" return;\n",
376376
"\n",
377-
" let dt_args = {\"scrollY\": \"300px\", \"scrollCollapse\": true, \"fixedColumns\": true, \"pageLength\": -1, \"layout\": {\"topStart\": \"pageLength\", \"topEnd\": \"search\", \"bottomStart\": \"info\", \"bottomEnd\": \"paging\"}, \"classes\": [\"display\", \"nowrap\"], \"style\": {\"table-layout\": \"auto\", \"width\": \"auto\", \"margin\": \"auto\", \"caption-side\": \"bottom\"}, \"order\": [], \"text_in_header_can_be_selected\": true, \"table_html\": \"<table><thead>\\n <tr style=\\\"text-align: right;\\\">\\n \\n <th>Method</th>\\n <th>Function in igraph (Python)</th>\\n <th>Directed Graph Support</th>\\n <th>Weighted Graph Support</th>\\n <th>Signed Graph Support</th>\\n <th>Sparse Graph Performance</th>\\n <th>Dense Graph Performance</th>\\n <th>Deterministic</th>\\n <th>Notes</th>\\n </tr>\\n </thead></table>\", \"data_json\": \"[[\\\"Edge Betweenness\\\", \\\"`Graph.community_edge_betweenness()`\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c (Slow for large)\\\", \\\"\\\\u2705\\\", \\\"Divisive hierarchical method. Good for small to medium graphs. Returns a dendrogram. Modularity-based partition can be extracted. The underlying modularity is typically for undirected graphs.\\\"], [\\\"Fast-Greedy\\\", \\\"`Graph.community_fastgreedy()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705 (Very efficient)\\\", \\\"\\\\u2705 (Can handle)\\\", \\\"\\\\u274c\\\", \\\"Agglomerative, modularity-maximization method. Returns a dendrogram. Efficient for large sparse graphs. Suffers from resolution limit. (Non-deterministic due to greedy choices / tie-breaking)\\\"], [\\\"Fluid Communities\\\", \\\"`Graph.community_fluid_communities()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u274c (weights ignored)\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"Propagation-based. Requires `k` (number of communities) as input. Stochastic. Very fast and scalable. Primarily for unweighted, undirected graphs. (Non-deterministic due to random seeds/updates)\\\"], [\\\"Infomap\\\", \\\"`Graph.community_infomap()`\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"Based on information theory (minimizing description length of random walks). Can handle directed and weighted graphs. (Non-deterministic due to random walks)\\\"], [\\\"Label Propagation\\\", \\\"`Graph.community_label_propagation()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"Fast, propagation-based. (Non-deterministic due to random initialization/tie-breaking). Uses `directed` parameter to respect edge direction.\\\"], [\\\"Leading Eigenvector\\\", \\\"`Graph.community_leading_eigenvector()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"Modularity-maximization (spectral method). Finds highest modularity partition. Can be slow for very large graphs. For undirected, weighted graphs.\\\"], [\\\"Leiden\\\", \\\"`Graph.community_leiden()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"Improvement over Louvain. Guarantees well-connected communities. Usually higher modularity and more stable than Louvain. Can use resolution parameter. Highly recommended for general use. (Non-deterministic due to local moves/tie-breaking)\\\"], [\\\"Louvain (Multilevel)\\\", \\\"`Graph.community_multilevel()`\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"Greedy, iterative modularity optimization. Fast and scalable. Returns hierarchical partition. Can suffer from resolution limit and potentially disconnected communities. (Non-deterministic due to local moves/tie-breaking)\\\"], [\\\"Spinglass\\\", \\\"`Graph.community_spinglass()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c (Slower)\\\", \\\"\\\\u274c\\\", \\\"Based on statistical mechanics (Ising model and simulated annealing). Can handle negative weights (as \\\\\\\"frustration\\\\\\\"). Can be computationally intensive, especially for dense or large graphs. Allows for fixed number of spins (`k`). (Stochastic by design)\\\"], [\\\"Walktrap\\\", \\\"`Graph.community_walktrap()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"Based on random walks. Merges communities that random walks tend to stay within. Hierarchical output (dendrogram). Efficient for sparse graphs.\\\"], [\\\"Optimal Modularity\\\", \\\"`Graph.community_optimal_modularity()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u274c (Small graphs only)\\\", \\\"\\\\u274c (Small graphs only)\\\", \\\"\\\\u2705\\\", \\\"Finds the **exact** highest modularity partition. Computationally very expensive. Only practical for very small graphs (dozens to ~100 nodes).\\\"], [\\\"Voronoi\\\", \\\"`Graph.community_voronoi()`\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"Partitions nodes into \\\\\\\"cells\\\\\\\" based on proximity (e.g., shortest path distance) to pre-defined \\\\\\\"seed\\\\\\\" nodes. Not a direct community *discovery* algorithm; it *assigns* based on input seeds. Used when node coordinates or influence regions are relevant.\\\"]]\"};\n",
377+
" let dt_args = {\"scrollY\": \"300px\", \"scrollCollapse\": true, \"fixedColumns\": true, \"pageLength\": -1, \"layout\": {\"topStart\": \"pageLength\", \"topEnd\": \"search\", \"bottomStart\": \"info\", \"bottomEnd\": \"paging\"}, \"classes\": [\"display\", \"nowrap\"], \"text_in_header_can_be_selected\": true, \"style\": {\"table-layout\": \"auto\", \"width\": \"auto\", \"margin\": \"auto\", \"caption-side\": \"bottom\"}, \"order\": [], \"table_html\": \"<table><thead>\\n <tr style=\\\"text-align: right;\\\">\\n \\n <th>Method</th>\\n <th>Function in igraph (Python)</th>\\n <th>Directed Graph Support</th>\\n <th>Weighted Graph Support</th>\\n <th>Signed Graph Support</th>\\n <th>Sparse Graph Performance</th>\\n <th>Dense Graph Performance</th>\\n <th>Deterministic</th>\\n </tr>\\n </thead></table>\", \"data_json\": \"[[\\\"Edge Betweenness\\\", \\\"`Graph.community_edge_betweenness()`\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c (Slow for large)\\\", \\\"\\\\u2705\\\"], [\\\"Fast-Greedy\\\", \\\"`Graph.community_fastgreedy()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705 (Very efficient)\\\", \\\"\\\\u2705 (Can handle)\\\", \\\"\\\\u274c\\\"], [\\\"Fluid Communities\\\", \\\"`Graph.community_fluid_communities()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u274c (weights ignored)\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\"], [\\\"Infomap\\\", \\\"`Graph.community_infomap()`\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\"], [\\\"Label Propagation\\\", \\\"`Graph.community_label_propagation()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\"], [\\\"Leading Eigenvector\\\", \\\"`Graph.community_leading_eigenvector()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\"], [\\\"Leiden\\\", \\\"`Graph.community_leiden()`\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\"], [\\\"Louvain (Multilevel)\\\", \\\"`Graph.community_multilevel()`\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\"], [\\\"Spinglass\\\", \\\"`Graph.community_spinglass()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c (Slower)\\\", \\\"\\\\u274c\\\"], [\\\"Walktrap\\\", \\\"`Graph.community_walktrap()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\"], [\\\"Optimal Modularity\\\", \\\"`Graph.community_optimal_modularity()`\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u274c (Small graphs only)\\\", \\\"\\\\u274c (Small graphs only)\\\", \\\"\\\\u2705\\\"], [\\\"Voronoi\\\", \\\"`Graph.community_voronoi()`\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u274c\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\", \\\"\\\\u2705\\\"]]\"};\n",
378378
" new ITable(table, dt_args);\n",
379379
" });\n",
380380
"</script>\n"

0 commit comments

Comments
 (0)