💾 Read & Write

Submodules

hypergraphx.readwrite.load module

hypergraphx.readwrite.load.load(obj_or_path)[source]
hypergraphx.readwrite.load.load_hypergraph(file_name, *, fmt=None)[source]

Load a hypergraph from disk.

Parameters:
  • file_name (str) – Input file path.

  • fmt ({"json", "pickle", "hgr"} | None) – Optional override for the input format. If None (default), infer format from the file extension.

hypergraphx.readwrite.load.load_hypergraph_from_server(dataset_name, *, fmt=None, as_dict=False, allow_network=False, timeout=30)[source]

hypergraphx.readwrite.save module

hypergraphx.readwrite.save.save_hypergraph(hypergraph, file_name, *, fmt='json', binary=None)[source]

Save a hypergraph to disk.

Parameters:
  • hypergraph – Hypergraph-like object.

  • file_name (str) – Output file path.

  • fmt ({"json", "pickle"}) – Output format (default: “json”).

  • binary (bool | None) – Backward-compatible alias for fmt=”pickle” when True. If provided, overrides fmt and emits a DeprecationWarning.

hypergraphx.readwrite.hif module

hypergraphx.readwrite.hif.read_hif(path)[source]

Load a hypergraph from a HIF file.

Parameters:

path (str) – The path to the HIF file

Returns:

The loaded hypergraph

Return type:

Hypergraph

hypergraphx.readwrite.hif.write_hif(H, path)[source]

Save a hypergraph to a HIF file.

Parameters:
  • H (Hypergraph) – The hypergraph to save.

  • path (str) – The path to save the hypergraph to.

hypergraphx.readwrite.io_json module

hypergraphx.readwrite.io_json.load_json_file(file_name)[source]
hypergraphx.readwrite.io_json.save_json_hypergraph(hypergraph, file_name)[source]

hypergraphx.readwrite.io_pickle module

hypergraphx.readwrite.io_pickle.load_pickle(file_name)[source]
hypergraphx.readwrite.io_pickle.save_pickle(obj, file_name)[source]

hypergraphx.readwrite.hashing module

hypergraphx.readwrite.hashing.hash_hypergraph(hypergraph)[source]

Generates a SHA-256 hash of a hypergraph based on its exposed attributes.

Parameters:

hypergraph (object) – The hypergraph instance to hash. Should implement expose_attributes_for_hashing.

Returns:

The SHA-256 hash hex digest of the hypergraph.

Return type:

str

Module contents

hypergraphx.readwrite.load_any(obj_or_path)
hypergraphx.readwrite.load_hypergraph(file_name, *, fmt=None)[source]

Load a hypergraph from disk.

Parameters:
  • file_name (str) – Input file path.

  • fmt ({"json", "pickle", "hgr"} | None) – Optional override for the input format. If None (default), infer format from the file extension.

hypergraphx.readwrite.load_hypergraph_from_server(dataset_name, *, fmt=None, as_dict=False, allow_network=False, timeout=30)[source]
hypergraphx.readwrite.read_hif(path)[source]

Load a hypergraph from a HIF file.

Parameters:

path (str) – The path to the HIF file

Returns:

The loaded hypergraph

Return type:

Hypergraph

hypergraphx.readwrite.save_hypergraph(hypergraph, file_name, *, fmt='json', binary=None)[source]

Save a hypergraph to disk.

Parameters:
  • hypergraph – Hypergraph-like object.

  • file_name (str) – Output file path.

  • fmt ({"json", "pickle"}) – Output format (default: “json”).

  • binary (bool | None) – Backward-compatible alias for fmt=”pickle” when True. If provided, overrides fmt and emits a DeprecationWarning.

hypergraphx.readwrite.write_hif(H, path)[source]

Save a hypergraph to a HIF file.

Parameters:
  • H (Hypergraph) – The hypergraph to save.

  • path (str) – The path to save the hypergraph to.

Next steps