mlx_graphs.utils.transformations.get_unique_edge_indices

mlx_graphs.utils.transformations.get_unique_edge_indices#

mlx_graphs.utils.transformations.get_unique_edge_indices(edge_index_1: mlx.core.array, edge_index_2: mlx.core.array) mlx.core.array[source]#

Computes the indices of the edges in edge_index_1 that are NOT present in edge_index_2

Parameters:
  • edge_index_1 (array) – The first edge index array.

  • edge_index_2 (array) – The second edge index array.

Return type:

array

Returns:

The indices of the edges in edge_index_1 that are not present in edge_index_2

Example:

edge_index_1 = mx.array(
    [
        [0, 1, 1, 2],
        [1, 0, 2, 1],
    ]
)
edge_index_2 = mx.array(
    [
        [1, 2, 2],
        [2, 1, 2],
    ]
)
x = get_unique_edge_indices(edge_index_1, edge_index_2)
# [0, 1]