--- id: leidenalg version: "0.12.0" license: GPL-3.0-or-later license_treatment: copyleft maintenance: active --- # leidenalg — Leiden is a general algorithm for methods of community detection in large networks. License: copyleft · Maintenance: active · Downloads: 771.8K/mo ## What it is and what it does leidenalg is a Python interface to a C++ implementation of the Leiden algorithm, a community detection method for partitioning large networks into cohesive groups. It extends the Louvain algorithm with improvements to guarantee well-connected communities and supports multiple optimization objectives: modularity, Reichardt-Bornholdt models, Constant Potts Model (CPM), Significance, and Surprise. The package can handle graphs with millions of nodes (memory-permitting) and includes support for multiplex networks (e.g., temporal or multi-layer graphs) and bipartite graphs, with the option to fix some community assignments during optimization. The package depends on igraph for graph representation and manipulation. It is designed for research and scientific computing, where flexibility in community detection methods is valued. Prebuilt wheels are available for Python 3.9+ on Windows, macOS, and Linux, though source builds require C++ compilation tools and igraph's C core library. Use it for: - Detect communities in social networks or collaboration graphs to identify groups of closely connected entities. - Analyze temporal networks by applying Leiden to multiple time slices to track community evolution. - Optimize modularity or other quality metrics on large graphs to find the best partition into communities. - Perform community detection on multiplex networks with positive and negative links or multiple relationship types. - Identify clusters in bipartite graphs such as author-paper or user-item networks. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Implements the Leiden community detection algorithm for graphs, exposing a C++ implementation to Python via igraph for partitioning networks into communities using multiple optimization methods. Yes, if you need flexible community detection on large graphs and can accept GPL-3.0-or-later licensing. The active maintenance, prebuilt wheels for modern Python, and lack of known vulnerabilities make it reliable. Medium install friction is manageable via wheels on major platforms. Not suitable for proprietary closed-source applications without license negotiation. ## Install pip install leidenalg uv add leidenalg poetry add leidenalg ## Installing leidenalg Before you install: Medium install friction due to compiled C++ dependencies. Prebuilt wheels are available for modern Python versions (3.9+) on major platforms, reducing friction significantly. Maintenance is active with a recent release. License in practice: GPL-3.0-or-later copyleft license means any derivative work or linked application must also be open-source under compatible terms. Suitable for research and open-source projects; commercial use requires careful licensing review. Quickstart: pip install leidenalg import leidenalg import igraph as ig G = ig.Graph.Erdos_Renyi(100, 0.1) part = leidenalg.find_partition(G, leidenalg.ModularityVertexPartition) Requires igraph as a runtime dependency. On Windows, binary wheels are recommended; on Unix-like systems, C++ compilation tools and igraph C core (version >= 1.0.0) may be needed if building from source. Verify before relying: - Whether the package supports directed graphs or only undirected (description mentions igraph's internal implementation is undirected-only, but leidenalg's flexibility is unclear). - Performance characteristics and scalability limits for graphs with millions of nodes on typical hardware. ## Package facts - License: GPL-3.0-or-later (copyleft) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 771.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags community detection algorithm, graph clustering leiden, network partition optimization, modularity optimization, graph community structure, network analysis clustering, leiden algorithm python, graph-algorithms, network-analysis, community-detection [View on SkillFed](https://skillfed.io/packages/leidenalg) · [View on PyPI](https://pypi.org/project/leidenalg/)