Skip to content

is_directed

is_directed(edge_index: array, edge_features: Optional[array] = None) -> bool

Determines whether a graph is directed based on the given edge index and optional edge features.

Parameters:

Name Type Description Default
edge_index array

The edge index of the graph.

required
edge_features Optional[array]

Edge features associated with each edge. If provided, the function considers both edge indices and features for the check.

None

Returns:

Type Description
bool

True if the graph is directed, False otherwise.

Source code in mlx_graphs/utils/topology.py
@validate_edge_index_and_features
def is_directed(edge_index: mx.array, edge_features: Optional[mx.array] = None) -> bool:
    """
    Determines whether a graph is directed based on the given edge index
    and optional edge features.

    Args:
        edge_index: The edge index of the graph.
        edge_features: Edge features associated
            with each edge. If provided, the function considers both edge indices
            and features for the check.

    Returns:
        True if the graph is directed, False otherwise.
    """
    return not is_undirected(edge_index, edge_features)

from mlx_graphs.utils.topology import is_directed · mlx_graphs/utils/topology.py