topobench.transforms.liftings.graph2cell package#

Graph2Cell liftings with automated exports.

class CellCycleLifting(max_cell_length=None, **kwargs)#

Bases: Graph2CellLifting

Lift graphs to cell complexes.

The algorithm creates 2-cells by identifying the cycles and considering them as 2-cells.

Parameters:
max_cell_lengthint, optional

The maximum length of the cycles to be lifted. Default is None.

**kwargsoptional

Additional arguments for the class.

__init__(max_cell_length=None, **kwargs)#
lift_topology(data)#

Find the cycles of a graph and lifts them to 2-cells.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
dict

The lifted topology.

class DiscreteConfigurationComplexLifting(k, preserve_edge_attr=True, feature_aggregation='concat', **kwargs)#

Bases: Graph2CellLifting

Lift graphs to cell complexes.

Lift graphs to cell complexes by generating the k-th discrete configuration complex D_k(G) of the graph. This is a cube complex, which is similar to a simplicial complex except each n-dimensional cell is homeomorphic to a n-dimensional cube rather than an n-dimensional simplex.

The discrete configuration complex of order k consists of all sets of k unique edges or vertices of G, with the additional constraint that if an edge e is in a cell, then neither of the endpoints of e are in the cell. For examples of different graphs and their configuration complexes, see the tutorial.

Note that since TopoNetx only supports cell complexes of dimension 2, if you generate a configuration complex of order k > 2 this will only produce the 2-skeleton.

Parameters:
kint

The order of the configuration complex, i.e. the number of ‘agents’ in a single configuration.

preserve_edge_attrbool, optional

Whether to preserve edge attributes. Default is True.

feature_aggregationstr, optional

For a k-agent configuration, the method by which the features are aggregated. Can be “mean”, “sum”, or “concat”. Default is “concat”.

**kwargsdict, optional

Additional arguments for the class.

Notes

The discrete configuration complex provides a way to model higher-order interactions in graphs, particularly useful for scenarios involving multiple agents or particles moving on a graph structure.

__init__(k, preserve_edge_attr=True, feature_aggregation='concat', **kwargs)#
forward(data)#

Apply the full lifting (topology + features) to the input data.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
torch_geometric.data.Data

The lifted data.

lift_topology(data)#

Generate the cubical complex of discrete graph configurations.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
dict

The lifted topology.

class Graph2CellLifting(complex_dim=2, **kwargs)#

Bases: GraphLifting

Abstract class for lifting graphs to cell complexes.

Parameters:
complex_dimint, optional

The dimension of the cell complex to be generated. Default is 2.

**kwargsoptional

Additional arguments for the class.

__init__(complex_dim=2, **kwargs)#

Submodules#