Data Manipulations#

A transform that calculates the simplicial curvature of the input graph.

class topobenchmarkx.transforms.data_manipulations.calculate_simplicial_curvature.CalculateSimplicialCurvature(**kwargs)[source]#

A transform that calculates the simplicial curvature of the input graph.

Parameters:
**kwargsoptional

Parameters for the transform.

forward(data: Data)[source]#

Apply the transform to the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

The transformed data.

one_cell_curvature(data: Data) Data[source]#

Calculate the one cell curvature of the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

Data with the one cell curvature.

two_cell_curvature(data: Data) Data[source]#

Calculate the two cell curvature of the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

Data with the two cell curvature.

zero_cell_curvature(data: Data) Data[source]#

Calculate the zero cell curvature of the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

Data with the zero cell curvature.

This module contains a transform that generates equal Gaussian features for all nodes in the input graph.

class topobenchmarkx.transforms.data_manipulations.equal_gaus_features.EqualGausFeatures(**kwargs)[source]#

A transform that generates equal Gaussian features for all nodes.

Parameters:
**kwargsoptional

Additional arguments for the class. It should contain the following keys: - mean (float): The mean of the Gaussian distribution. - std (float): The standard deviation of the Gaussian distribution. - num_features (int): The number of features to generate.

forward(data: Data)[source]#

Apply the transform to the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

The transformed data.

Identity transform that does nothing to the input data.

class topobenchmarkx.transforms.data_manipulations.identity_transform.IdentityTransform(**kwargs)[source]#

An identity transform that does nothing to the input data.

Parameters:
**kwargsoptional

Parameters for the base transform.

forward(data: Data)[source]#

Apply the transform to the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

The same data.

InfereKNNConnectivity class definition.

class topobenchmarkx.transforms.data_manipulations.infere_knn_connectivity.InfereKNNConnectivity(**kwargs)[source]#

Transform to infer point cloud connectivity.

The transform generates the k-nearest neighbor connectivity of the input point cloud.

Parameters:
**kwargsoptional

Parameters for the base transform.

forward(data: Data)[source]#

Apply the transform to the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

The transformed data.

InfereRadiusConnectivity class definition.

class topobenchmarkx.transforms.data_manipulations.infere_radius_connectivity.InfereRadiusConnectivity(**kwargs)[source]#

Class to infer point cloud connectivity.

The transform generates the radius connectivity of the input point cloud.

Parameters:
**kwargsoptional

Parameters for the base transform.

forward(data: Data)[source]#

Apply the transform to the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

The transformed data.

KeepOnlyConnectedComponent class definition.

class topobenchmarkx.transforms.data_manipulations.keep_only_connected_component.KeepOnlyConnectedComponent(**kwargs)[source]#

Class to keep only the largest connected components of the input graph.

Parameters:
**kwargsoptional

Parameters for the base transform.

forward(data: Data)[source]#

Apply the transform to the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

The transformed data.

A transform that keeps only the selected fields of the input data.

class topobenchmarkx.transforms.data_manipulations.keep_selected_data_fields.KeepSelectedDataFields(**kwargs)[source]#

A transform that keeps only the selected fields of the input data.

Parameters:
**kwargsoptional

Parameters for the base transform.

forward(data: Data)[source]#

Apply the transform to the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

The transformed data.

Node degrees transform.

class topobenchmarkx.transforms.data_manipulations.node_degrees.NodeDegrees(**kwargs)[source]#

A transform that calculates the node degrees of the input graph.

Parameters:
**kwargsoptional

Parameters for the base transform.

calculate_node_degrees(data: Data, field: str) Data[source]#

Calculate the node degrees of the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

fieldstr

The field to calculate the node degrees.

Returns:
torch_geometric.data.Data

The transformed data.

forward(data: Data)[source]#

Apply the transform to the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

The transformed data.

A transform that converts the node features of the input graph to float.

class topobenchmarkx.transforms.data_manipulations.node_features_to_float.NodeFeaturesToFloat(**kwargs)[source]#

A transform that converts the node features of the input graph to float.

Parameters:
**kwargsoptional

Parameters for the base transform.

forward(data: Data)[source]#

Apply the transform to the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

The transformed data.

One hot degree features transform.

class topobenchmarkx.transforms.data_manipulations.one_hot_degree_features.OneHotDegreeFeatures(max_degree: int, degrees_fields: str, features_fields: str, cat: bool = False, **kwargs)[source]#

Class for one hot degree features transform.

A transform that adds the node degree as one hot encodings to the node features.

Parameters:
max_degreeint

The maximum degree of the graph.

degrees_fieldsstr

The field containing the node degrees.

features_fieldsstr

The field containing the node features.

catbool, optional

If set to True, the one hot encodings are concatenated to the node features (default: False).

**kwargsoptional

Additional arguments for the class.

forward(data: Data)[source]#

Apply the transform to the input data.

Parameters:
datatorch_geometric.data.Data

The input data.

Returns:
torch_geometric.data.Data

The transformed data.