mlx_graphs.utils.transformations.coalesce

Contents

mlx_graphs.utils.transformations.coalesce#

mlx_graphs.utils.transformations.coalesce(edge_index: mlx.core.array) mlx.core.array[source]#

Removes duplicate edges in edge_index and scatters the duplicate edges to the edge attributes following a given reduction operation (e.g. sum of duplicate edges).

Parameters:

edge_index (array) – Edges to coalesce.

Return type:

array

Returns:

The edges without duplicates, with source and destination nodes swapped.