xgi.convert.higher_order_network#
Methods for converting to higher-order network objects.
Functions
- to_hypergraph(data, create_using=None)#
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
a DiHypergraph object: each directed edge (tail, head) is converted to an undirected edge containing the union of its tail and head members
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_simplicesConstructs a hypergraph from the maximal simplices of a simplicial complex.
- to_dihypergraph(data, create_using=None)#
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
list-of-iterables
dict-of-iterables
Note
Pandas DataFrame, numpy, and scipy sparse inputs are not yet implemented and will raise an error.
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)#
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)
Note
Construction from an incidence matrix (numpy ndarray or scipy.sparse array) is not yet implemented and will raise an error.
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)#
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