xgi.convert.hyperedges

Methods for converting to and from hyperedge lists.

Functions

xgi.convert.hyperedges.from_hyperedge_dict(d, create_using=None)[source]

Creates a hypergraph from a dictionary of hyperedges

Parameters:
  • d (dict) – A dictionary where the keys are edge IDs and the values are containers of nodes specifying the edges.

  • create_using (Hypergraph constructor, optional) – The hypergraph object to add the data to, by default None

Returns:

The constructed hypergraph object

Return type:

Hypergraph object

xgi.convert.hyperedges.to_hyperedge_dict(H)[source]

Outputs a hyperedge dictionary

Parameters:

H (Hypergraph object) – The hypergraph of interest

Returns:

A dictionary where the keys are edge IDs and the values are sets of nodes specifying the edges.

Return type:

dict

xgi.convert.hyperedges.from_hyperedge_list(d, create_using=None, max_order=None)[source]

Generate a hypergraph from a list of lists.

Parameters:
  • d (list of iterables) – A hyperedge list

  • create_using (Hypergraph constructor, optional) – The hypergraph to add the edges to, by default None

Returns:

The constructed hypergraph object

Return type:

Hypergraph object

xgi.convert.hyperedges.to_hyperedge_list(H)[source]

Generate a hyperedge list from a hypergraph.

Parameters:

H (Hypergraph object) – The hypergraph of interest

Returns:

The hyperedge list

Return type:

list of sets