graphragzen.query.get_context.cluster_summaries
- graphragzen.query.get_context.cluster_summaries(graph, cluster_report, entities, k)[source]
Find the top cluster summaries by occurence, followed by rank, related to the specified entities.
- Parameters:
graph (nx.Graph) – A networkx graph containing nodes with metadata about cluster associations
cluster_report (pd.DataFrame) – DataFrame containing the cluster information, including summaries and ratings.
entities (List[dict]) – A list of dictionaries representing entities, with each entity having ‘entity_type’: A string that is ‘node’. ‘entity_name’: A string representing the name of the entity.
k (int) – The number of top cluster summaries to return, based on frequency and rank.
- Returns:
A list of dictionaries, each containing the title and summary of a cluster.
- Return type:
List[str]