mlx_graphs.utils.transformations.has_self_loops

Contents

mlx_graphs.utils.transformations.has_self_loops#

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

Function to check for self loops.

Parameters:

edge_index (array) – Edge index on which to check for self loops.

Return type:

bool

Returns:

A boolean of whether the graph has self loops.

Example:

edge_index = mx.array([[0, 2, 0], [2, 0, 0]])
has_self_loops(edge_index)
>>> True