r"""Save the DHG's hypergraph structure a file. Args: ``file_path`` (``Union[str, Path]``): The file path to store the DHG's hypergraph structure.
(self, file_path: Union[str, Path])
| 53 | return {"num_v": self.num_v, "raw_groups": self._raw_groups} |
| 54 | |
| 55 | def save(self, file_path: Union[str, Path]): |
| 56 | r"""Save the DHG's hypergraph structure a file. |
| 57 | |
| 58 | Args: |
| 59 | ``file_path`` (``Union[str, Path]``): The file path to store the DHG's hypergraph structure. |
| 60 | """ |
| 61 | file_path = Path(file_path) |
| 62 | assert file_path.parent.exists(), "The directory does not exist." |
| 63 | data = { |
| 64 | "class": "Hypergraph", |
| 65 | "state_dict": self.state_dict, |
| 66 | } |
| 67 | with open(file_path, "wb") as fp: |
| 68 | pickle.dump(data, fp) |
| 69 | |
| 70 | @staticmethod |
| 71 | def load(file_path: Union[str, Path]): |