mlx_graphs.utils.transformations.has_isolated_nodes

mlx_graphs.utils.transformations.has_isolated_nodes#

mlx_graphs.utils.transformations.has_isolated_nodes(edge_index: mlx.core.array, num_nodes: int) bool[source]#

Function to check for isolated nodes. (i.e. nodes that don’t have a link to any other nodes )

Parameters:

edge_index (array) – Edge index on which to check for isolated nodes.

Return type:

bool

Returns:

A boolean of whether the graph has isolated nodes.

Example:

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