CommunityIndex<T>
Models & Types · AiDotNet.RetrievalAugmentedGeneration.Graph.Communities
Index structure that maps hierarchy levels and community IDs to their summaries, enabling efficient community-based retrieval for GraphRAG.
For Beginners
The community index is like a table of contents for your knowledge graph. Instead of searching every node, you can search community summaries first to quickly find which part of the graph is relevant to your query.
Constructors
| Constructor | Summary |
|---|---|
CommunityIndex() |
Methods
| Method | Summary |
|---|---|
CommunitySummary GetSummary(int level, int communityId) |
Gets a community summary by level and community ID. |
IEnumerable<CommunitySummary> GetSummariesAtLevel(int level) |
Gets all community summaries at a given level. |
IEnumerable<CommunitySummary> SearchCommunities(string query, int level, int topK) |
Searches community summaries for those relevant to a query string. |
void Build(KnowledgeGraph<T> graph, LeidenResult leidenResult, int maxKeyEntities, int maxKeyRelations) |
Builds the index from a knowledge graph and Leiden result. |