## Transforms

[source]

spektral.transforms.adj_to_sp_tensor.AdjToSpTensor()


Converts the adjacency matrix to a SparseTensor.

[source]

#### ClusteringCoeff

spektral.transforms.clustering_coefficient.ClusteringCoeff()


Concatenates to each node attribute the clustering coefficient of the corresponding node.

[source]

#### Constant

spektral.transforms.constant.Constant(value)


Concatenates a constant value to the node attributes.

Arguments

• value: the value to concatenate to the node attributes.

[source]

#### Delaunay

spektral.transforms.delaunay.Delaunay()


Computes the Delaunay triangulation of the node features.

The adjacency matrix is obtained from the edges of the triangulation and replaces the previous adjacency matrix. Duplicate edges are ignored and the adjacency matrix is binary.

Node features must be 2-dimensional.

[source]

#### Degree

spektral.transforms.degree.Degree(max_degree)


Concatenates to each node attribute the one-hot degree of the corresponding node.

The adjacency matrix is expected to have integer entries and the degree is cast to integer before one-hot encoding.

Arguments

• max_degree: the maximum degree of the nodes, i.e., the size of the one-hot vectors.

[source]

#### GCNFilter

spektral.transforms.gcn_filter.GCNFilter(symmetric=True)


Normalizes the adjacency matrix as described by Kipf & Welling (2017):

where $\hat\D_{ii} = 1 + \sum\limits_{j = 1}^{N} \A_{ij}$.

Arguments

• symmetric: If False, then it computes $\hat\D^{-1} (\A + \I)$ instead.

[source]

#### LayerPreprocess

spektral.transforms.layer_preprocess.LayerPreprocess(layer_class)


Applies the preprocess function of a convolutional Layer to the adjacency matrix.

Arguments

• layer_class: the class of a layer from spektral.layers.convolutional, or any Layer that implements a preprocess(adj) method.

[source]

spektral.transforms.normalize_adj.NormalizeAdj(symmetric=True)


Arguments

• symmetric: If False, then it computes $\D^{-1}\A$ instead.

[source]

#### NormalizeOne

spektral.transforms.normalize_one.NormalizeOne()


Normalizes the node attributes by dividing each row by its sum, so that it sums to 1:

[source]

#### NormalizeSphere

spektral.transforms.normalize_sphere.NormalizeSphere()


Normalizes the node attributes so that they are centered at the origin and contained within a sphere of radius 1:

where $\bar\X$ is the centroid of the node features.

[source]

#### OneHotLabels

spektral.transforms.one_hot.OneHotLabels(depth=None, labels=None)


One-hot encodes the graph labels along the innermost dimension (also if they are simple scalars).

Either depth or labels must be passed as argument.

Arguments

• depth: int, the size of the one-hot vector (labels are intended as indices for a vector of size depth);
• labels: list or tuple, the possible values that the labels can take (labels are one-hot encoded according to where they are found inlabels).