Skip to content

remove_duplicate_directed_edges

remove_duplicate_directed_edges(edge_index: array) -> array

Removes the duplicate directed edges in edge_index.

Parameters:

Name Type Description Default
edge_index array

The edge_index on which remove duplicate edges.

required

Returns:

Type Description
array

An edge_index without duplicates, sorted by source then destination.

Source code in mlx_graphs/utils/transformations.py
@validate_edge_index
def remove_duplicate_directed_edges(edge_index: mx.array) -> mx.array:
    """
    Removes the duplicate directed edges in `edge_index`.

    Args:
        edge_index: The `edge_index` on which remove duplicate edges.

    Returns:
        An `edge_index` without duplicates, sorted by source then destination.
    """
    return coalesce(edge_index)

from mlx_graphs.utils.transformations import remove_duplicate_directed_edges · mlx_graphs/utils/transformations.py