xgi.convert.higher_order_network#

Methods for converting to higher-order network objects.

Functions

to_hypergraph(data, create_using=None)[source]#

Make a hypergraph from a known data structure.

The preferred way to call this is automatically from the class constructor.

Parameters:
  • data (object to be converted) –

    Current known types are:
    • a Hypergraph object

    • a SimplicialComplex object

    • list-of-iterables

    • dict-of-iterables

    • Pandas DataFrame (bipartite edgelist)

    • numpy matrix

    • numpy ndarray

    • scipy sparse matrix

  • create_using (Hypergraph constructor, optional (default=Hypergraph)) – Hypergraph type to create. If hypergraph instance, then cleared before populated.

Returns:

A hypergraph constructed from the data

Return type:

Hypergraph object

See also

from_max_simplices

Constructs a hypergraph from the maximal simplices of a simplicial complex.

to_dihypergraph(data, create_using=None)[source]#

Make a dihypergraph from a known data structure.

The preferred way to call this is automatically from the class constructor.

Parameters:
  • data (object to be converted) –

    Current known types are:
    • a DiHypergraph object

    • a SimplicialComplex object

    • list-of-iterables

    • dict-of-iterables

    • Pandas DataFrame (bipartite edgelist)

    • numpy matrix

    • numpy ndarray

    • scipy sparse matrix

  • create_using (Hypergraph constructor, optional (default=Hypergraph)) – Hypergraph type to create. If hypergraph instance, then cleared before populated.

Returns:

A hypergraph constructed from the data

Return type:

Hypergraph object

to_simplicial_complex(data, create_using=None)[source]#

Make a hypergraph from a known data structure. The preferred way to call this is automatically from the class constructor.

Parameters:
  • data (object to be converted) –

    Current known types are:
    • a SimplicialComplex object

    • a Hypergraph object

    • list-of-iterables

    • dict-of-iterables

    • Pandas DataFrame (bipartite edgelist)

    • numpy matrix

    • numpy ndarray

    • scipy sparse matrix

  • create_using (Hypergraph graph constructor, optional (default=Hypergraph)) – Hypergraph type to create. If hypergraph instance, then cleared before populated.

Returns:

A hypergraph constructed from the data

Return type:

Hypergraph object

cut_to_order(H, order)[source]#

Returns a copy of the higher-order network with edges of order less than or equal to the given order.

Parameters:
  • H (Hypergraph) – The higher-order network to cut

  • order (int) – The order of the edges to keep

Returns:

A copy of the higher-order network with edges of order less than or equal to the given order

Return type:

Hypergraph object