Transformations

Transformations#

to_edge_index(adjacency_matrix, *[, dtype])

Converts an adjacency matrix to an edge index representation.

to_sparse_adjacency_matrix(adjacency_matrix, *)

Converts an adjacency matrix to a sparse representation as a tuple of edge index and edge features.

to_adjacency_matrix(edge_index[, ...])

Converts an edge index representation to an adjacency matrix.

get_src_dst_features(edge_index, node_features)

Extracts source and destination node features based on the given edge indices.

get_unique_edge_indices(edge_index_1, ...)

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

add_self_loops(edge_index[, edge_features, ...])

Adds self-loops to the given graph represented by edge_index and edge_features.

remove_self_loops(edge_index[, edge_features])

Removes self-loops from the given graph represented by edge_index and edge_features.

to_undirected(edge_index[, edge_features])

Converts a graph given as edge_index and, optionally, edge_features to an undirected one.

remove_duplicate_directed_edges(edge_index)

Removes the duplicate directed edges in edge_index.

coalesce(edge_index)

Removes duplicate edges in edge_index and scatters the duplicate edges to the edge attributes following a given reduction operation (e.g. sum of duplicate edges).

get_isolated_nodes_mask(edge_index, num_nodes)

Returns a mask with isolated nodes set to False to filter them out if needed.

has_isolated_nodes(edge_index, num_nodes)

Function to check for isolated nodes.

has_self_loops(edge_index)

Function to check for self loops.