topobench.transforms.liftings.graph2hypergraph.knn_lifting module#

This module implements the HypergraphKNNLifting class.

class Graph2HypergraphLifting(**kwargs)#

Bases: GraphLifting

Abstract class for lifting graphs to hypergraphs.

Parameters:
**kwargsoptional

Additional arguments for the class.

__init__(**kwargs)#
class HypergraphKNNLifting(k_value=1, loop=True, **kwargs)#

Bases: Graph2HypergraphLifting

Lift graphs to hypergraph domain by considering k-nearest neighbors.

Parameters:
k_valueint, optional

The number of nearest neighbors to consider. Must be positive. Default is 1.

loopbool, optional

If True the hyperedges will contain the node they were created from.

**kwargsoptional

Additional arguments for the class.

Raises:
ValueError

If k_value is less than 1.

TypeError

If k_value is not an integer or if loop is not a boolean.

__init__(k_value=1, loop=True, **kwargs)#
lift_topology(data)#

Lift a graph to hypergraph by considering k-nearest neighbors.

Parameters:
datatorch_geometric.data.Data

The input data to be lifted.

Returns:
dict

The lifted topology.