xgi.readwrite.hif#

Read from and write to the HIF Standard.

For more information on the HIF standard, see the HIF project.

Functions

read_hif(path, nodetype=None, edgetype=None)[source]#

A function to read a file created according to the HIF format.

For more information, see the HIF project.

Parameters:
  • path (str) – The path to the json file

  • nodetype (type, optional) – type that the node IDs will be cast to

  • edgetype (type, optional) – type that the edge IDs will be cast to

Returns:

The loaded network

Return type:

A Hypergraph, SimplicialComplex, or DiHypergraph object

read_hif_collection(path, nodetype=None, edgetype=None)[source]#

A function to read a collection of files created according to the HIF format.

There must be a collection information JSON file which has a top-level field “datasets” with subfields “relative-path”, indicating each dataset’s location relative to the collection file

For more information, see the HIF project.

Parameters:
  • path (str) – A path to the collection json file.

  • nodetype (type, optional) – type that the node IDs will be cast to

  • edgetype (type, optional) – type that the edge IDs will be cast to

Returns:

The collection of networks

Return type:

A dictionary of Hypergraph, SimplicialComplex, or DiHypergraph objects

write_hif(H, path)[source]#

A function to write a higher-order network according to the HIF standard.

For more information, see the HIF project.

Parameters:
  • H (Hypergraph, DiHypergraph, or SimplicialComplex object) – The specified higher-order network

  • path (string) – The path of the file to read from

write_hif_collection(H, path, collection_name='')[source]#

A function to write a collection of higher-order network according to the HIF standard.

For more information, see the HIF project.

Parameters:
  • H (list or dict of Hypergraph, DiHypergraph, or SimplicialComplex objects) – The specified higher-order network

  • path (string) – The path of the file to read from