topobench.transforms.liftings.graph2simplicial package#

Graph2SimplicialLifting module with automated exports.

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

Bases: GraphLifting

Abstract class for lifting graphs to simplicial complexes.

Parameters:
complex_dimint, optional

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

**kwargsoptional

Additional arguments for the class.

__init__(complex_dim=2, **kwargs)#
class LatentCliqueLifting(edge_prob_mean=0.9, edge_prob_var=0.05, it=20, init='edges', do_gibbs=False, **kwargs)#

Bases: Graph2SimplicialLifting

Lift graphs to cell complexes by identifying the cycles as 2-cells.

Parameters:
edge_prob_meanfloat = 0.9

Mean of the prior distribution of pie ~ Beta where edge_prob_mean must be in (0, 1). When edge_prob_mean is one, the value of edge_prob is fixed and not sampled.

edge_prob_varfloat = 0.05

Uncertainty of the prior distribution of pie ~ Beta(a, b) where edge_prob_var must be in [0, inf). When edge_prob_var is zero, the value of edge_prob is fixed and not sampled. It is require dthat edge_prob_var < edge_prob_mean * (1 - edge_prob_mean). When this is not the case the value of edge_prob_var is set to edge_prob_mean * (1 - edge_prob_mean) - 1e-6.

itint, optional

Number of iterations for sampling, by default None.

initstr, optional

Initialization method for the clique cover matrix, by default “edges”.

do_gibbsbool, optional

Whether to perform Gibbs sampling, by default False.

**kwargsoptional

Additional arguments for the class.

__init__(edge_prob_mean=0.9, edge_prob_var=0.05, it=20, init='edges', do_gibbs=False, **kwargs)#
lift_topology(data, verbose=True)#

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

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

verbosebool, optional

Whether to display verbose output, by default False.

Returns:
dict

The lifted topology.

class NeighborhoodComplexLifting(max_simplices=10, **kwargs)#

Bases: Graph2SimplicialLifting

Lifts graphs to a simplicial complex domain by identifying the neighborhood complex as k-simplices.

Parameters:
max_simplicesint, optional

The maximum number of simplices to be added to the simplicial complex for each node. Default is 50.

**kwargsoptional

Additional arguments for the class.

__init__(max_simplices=10, **kwargs)#
lift_topology(data)#

Lift the topology of a graph to a simplicial complex.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
dict

The lifted topology.

class SimplicialCliqueLifting(**kwargs)#

Bases: Graph2SimplicialLifting

Lift graphs to simplicial complex domain.

The algorithm creates simplices by identifying the cliques and considering them as simplices of the same dimension.

Parameters:
**kwargsoptional

Additional arguments for the class.

__init__(**kwargs)#
lift_topology(data)#

Lift the topology of a graph to a simplicial complex.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
dict

The lifted topology.

class SimplicialDnDLifting(**kwargs)#

Bases: Graph2SimplicialLifting

Lift graphs to simplicial complex domain using a Dungeons & Dragons inspired system.

Parameters:
**kwargsoptional

Additional arguments for the class.

__init__(**kwargs)#
lift_topology(data, max_simplices=10)#

Lift the topology of a graph to a simplicial complex using Dungeons & Dragons (D&D) inspired mechanics.

Parameters:
dataData

The input data to be lifted.

max_simplicesint

Maximum number of simplices to add for each node attribute.

Returns:
dict

The lifted topology.

class SimplicialEccentricityLifting(**kwargs)#

Bases: Graph2SimplicialLifting

Lift graphs to simplicial complex domain using eccentricity.

Parameters:
**kwargsoptional

Additional arguments for the class.

__init__(**kwargs)#
lift_topology(data)#

Lift the topology of a graph to a simplicial complex by identifying connected subgraphs as simplices.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
dict

The lifted topology.

class SimplicialGraphInducedLifting(**kwargs)#

Bases: Graph2SimplicialLifting

Lift graphs to simplicial complex domain by identifying connected subgraphs as simplices.

Parameters:
**kwargsoptional

Additional arguments for the class.

__init__(**kwargs)#
lift_topology(data)#

Lift the topology of a graph to a simplicial complex by identifying connected subgraphs as simplices.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
dict

The lifted topology.

class SimplicialKHopLifting(max_k_simplices=25, **kwargs)#

Bases: Graph2SimplicialLifting

Lift graphs to simplicial complex domain.

The function lifts a graph to a simplicial complex by considering k-hop neighborhoods. For each node its neighborhood is selected and then all the possible simplices, when considering the neighborhood as a clique, are added to the simplicial complex. For this reason this lifting does not conserve the initial graph topology.

Parameters:
max_k_simplicesint, optional

The maximum number of k-simplices to consider. Default is 25.

**kwargsoptional

Additional arguments for the class.

__init__(max_k_simplices=25, **kwargs)#
lift_topology(data)#

Lift the topology to simplicial complex domain.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
dict

The lifted topology.

class SimplicialLineLifting(max_simplices=25, **kwargs)#

Bases: Graph2SimplicialLifting

Lift graphs to a simplicial complex domain by considering line simplicial complex.

Line simplicial complex is a clique complex of the line graph. Line graph is a graph, in which the vertices are the edges in the initial graph, and two vertices are adjacent if the corresponding edges are adjacent in the initial graph.

Parameters:
max_simplicesint

Max simplices to add for each clique given a rank.

**kwargsoptional

Additional arguments for the class.

__init__(max_simplices=25, **kwargs)#
lift_topology(data)#

Lift topology of a graph to simplicial domain via line simplicial complex construction.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
dict

The lifted topology.

class SimplicialVietorisRipsLifting(distance_threshold=1.0, max_simplices=5, **kwargs)#

Bases: Graph2SimplicialLifting

Lift graphs to simplicial complex domain using the Vietoris-Rips complex based on pairwise distances.

Parameters:
distance_thresholdfloat

The maximum distance between vertices to form a simplex.

max_simplicesint

Max number of simplices to create for a given node and rank.

**kwargsoptional

Additional arguments for the class.

__init__(distance_threshold=1.0, max_simplices=5, **kwargs)#
lift_topology(data)#

Lift topology of a graph to a simplicial complex using the Vietoris-Rips complex.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
dict

The lifted topology.

Submodules#