kg_topology_toolbox.utils.node_degrees_and_rels
- kg_topology_toolbox.utils.node_degrees_and_rels(df, column, n_entity, return_relation_list)[source]
Aggregate edges by head/tail node and compute associated statistics.
- Parameters:
- Return type:
DataFrame
- Returns:
The result DataFrame, indexed on the IDs of the graph entities, with columns:
degree (int): Number of triples in the aggregation.
- unique_rel (int): Number of distinct relation types
in the set of aggregated edges.
- rel_list (Optional[list]): List of unique relation types
in the set of aggregated edges. Only returned if return_relation_list = True.