MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / save

Method save

easygraph/classes/hypergraph.py:55–68  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

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]):

Callers

nothing calls this directly

Calls 1

dumpMethod · 0.45

Tested by

no test coverage detected