Skip to main content

detectCommunities

@forge/monorepo


@forge/monorepo / backend/src / detectCommunities

Function: detectCommunities()

detectCommunities(input): readonly Community[]

Defined in: backend/src/knowledge/communities.ts:188

Cluster a graph into a hierarchy of communities.

Pure and deterministic: the same entities and relationships always produce the same result, which every test of incremental rebuild depends on.

Singletons are kept rather than dropped. An entity nothing links to is a real part of the corpus and a graph-global answer that silently omitted every unconnected concept would be quietly wrong about what the corpus contains.

Parameters

input

chunksOf

(entityId) => readonly string[]

entityIds

readonly string[]

levels?

number

relationships

readonly KnowledgeRelationship[]

Returns

readonly Community[]