Skip to main content
Glama

leiden

Detect communities in network data using the Leiden clustering algorithm. Adjust resolution, weights, and iterations for precise clustering. Supports directed/undirected graphs and customizable parameters for accurate analysis.

Instructions

Leiden clustering algorithm for community detection

Input Schema

NameRequiredDescriptionDefault
clustering_argsNoAny further arguments to pass to the clustering algorithm.
directedNoWhether to treat the graph as directed or undirected.
flavorNoWhich package's implementation to use.igraph
key_addedNo`adata.obs` key under which to add the cluster labels.leiden
n_iterationsNoHow many iterations of the Leiden clustering algorithm to perform. -1 runs until optimal clustering.
neighbors_keyNoUse neighbors connectivities as adjacency. If specified, leiden looks .obsp[.uns[neighbors_key]['connectivities_key']] for connectivities.
obspNoUse .obsp[obsp] as adjacency. You can't specify both `obsp` and `neighbors_key` at the same time.
random_stateNoChange the initialization of the optimization.
resolutionNoA parameter value controlling the coarseness of the clustering. Higher values lead to more clusters.
use_weightsNoIf `True`, edge weights from the graph are used in the computation (placing more emphasis on stronger edges).

Input Schema (JSON Schema)

{ "description": "Input schema for the Leiden clustering algorithm.", "properties": { "clustering_args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Any further arguments to pass to the clustering algorithm.", "title": "Clustering Args" }, "directed": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Whether to treat the graph as directed or undirected.", "title": "Directed" }, "flavor": { "default": "igraph", "description": "Which package's implementation to use.", "enum": [ "leidenalg", "igraph" ], "title": "Flavor", "type": "string" }, "key_added": { "default": "leiden", "description": "`adata.obs` key under which to add the cluster labels.", "title": "Key Added", "type": "string" }, "n_iterations": { "default": -1, "description": "How many iterations of the Leiden clustering algorithm to perform. -1 runs until optimal clustering.", "title": "N Iterations", "type": "integer" }, "neighbors_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Use neighbors connectivities as adjacency. If specified, leiden looks .obsp[.uns[neighbors_key]['connectivities_key']] for connectivities.", "title": "Neighbors Key" }, "obsp": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Use .obsp[obsp] as adjacency. You can't specify both `obsp` and `neighbors_key` at the same time.", "title": "Obsp" }, "random_state": { "default": 0, "description": "Change the initialization of the optimization.", "title": "Random State", "type": "integer" }, "resolution": { "default": 1, "description": "A parameter value controlling the coarseness of the clustering. Higher values lead to more clusters.", "title": "Resolution", "type": "number" }, "use_weights": { "default": true, "description": "If `True`, edge weights from the graph are used in the computation (placing more emphasis on stronger edges).", "title": "Use Weights", "type": "boolean" } }, "title": "LeidenModel", "type": "object" }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/huang-sh/scmcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server