ash_model.multiego.delta_similarity

ash_model.multiego.delta_similarity(multiego1, multiego2)[source]

Compute the delta similarity between two Multi-Ego Networks.

This is a weighted Jaccard similarity that considers the best matching between hyperedges based on their node overlap. For each hyperedge in the smaller Multi-Ego Network, it finds the best match in the larger one based on Jaccard similarity at the node level.

Parameters:
  • multiego1 (List[Set[int]]) – first Multi-Ego Network (list of hyperedges as sets of node IDs)

  • multiego2 (List[Set[int]]) – second Multi-Ego Network (list of hyperedges as sets of node IDs)

Returns:

delta similarity score in [0, 1]. Returns 0.0 if either Multi-Ego Network is empty.

Return type:

float

Examples

>>> multiego1 = [{1, 2, 3}, {2, 3, 4}]
>>> multiego2 = [{1, 2}, {3, 4, 5}]
>>> sim = delta_similarity(multiego1, multiego2)
>>> print(f"Delta similarity: {sim:.3f}")