graphragzen.query.get_context.extra_outside_edges

graphragzen.query.get_context.extra_outside_edges(graph, entities, k, only_new_edges=True)[source]

Return top edges by weight where only one node is in the specified entities.

Parameters:
  • graph (nx.Graph) – The graph containing nodes and edges.

  • entities (List[dict]) – List of entities who’s nodes to check for connected edges.

  • k (int) – Maximum number of edges to return.

  • only_new_edges (bool, optional) – If True, returns only edges not yet in the entities, this output length might be less than k. Defaults to True.

Returns:

A list of dictionaries containing ‘entity_type’, ‘entity_name’.

Return type:

List[dict]