Skip to main content
Version: latest

agrag.ingestion.community.fetch_relation_edges

fetch_relation_edges(graph_store:GraphStore | GraphStoreTransaction, *, schema:GraphSchema, page_size:int = 5000) -> list[WeightedEdge]

Return current-schema entity relations as weighted edge tuples.

Weight is len(source_chunk_ids) (attestation count). A relation with no attested chunks contributes weight 0.0, so an unsupported edge cannot inflate clustering or a community report importance. Two entities connected by more than one distinct relation type contribute one edge tuple per type. graspologic_native sums parallel-edge weights when it builds its own adjacency.

Only relations whose type is declared in the schema and whose endpoints both carry a declared entity label are read. Pages by keyset on (a.id, b.id, type(r), r.id).

Parameters:

  • graph_store (GraphStore | GraphStoreTransaction) – Where the relations are read from.
  • schema (GraphSchema) – The active entity and relation types for this graph.
  • page_size (int) – Rows fetched per page.

Returns:

  • list[WeightedEdge] – Edge tuples as (source_id_str, target_id_str, weight, rel_type).