Version: latest
agrag.ingestion.community.detect_communities
detect_communities(graph_store:GraphStore, *, embedder:Embedder, tracer:Tracer | None = None, apply:bool = False, max_cluster_size:int = 10, resolution:float = 1.0, seed:int | None = 3735928559) -> CommunityDetectionReport
Detect entity communities via hierarchical Leiden.
Reads every live domain relation across the whole graph, not only one
entity label, because community structure spans entity types. It builds a
weighted edge list and runs hierarchical Leiden off the event loop. With
apply=True the run is a full recompute: it deletes every earlier
Community node and MEMBER_OF edge before it stores the new ones.
Parameters:
- graph_store (
GraphStore) – Where relations and entities are read and communities are written. - embedder (
Embedder) – Embeds the community summaries. - tracer (
Tracer | None) – Opens the detection span. None opens no recorded span. - apply (
bool) – Write the communities. False returns a report only. - max_cluster_size (
int) – Forwarded tocompute_communities. - resolution (
float) – Forwarded tocompute_communities. - seed (
int | None) – Forwarded tocompute_communities.
Returns:
CommunityDetectionReport– A report of every community found, applied or not. A community reportCommunityDetectionReport– failure appears infailures.
Raises:
CommunityDetectionMissingExtraError– graspologic-native is not installed.