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

Method load

easygraph/classes/hypergraph.py:71–82  ·  view source on GitHub ↗

r"""Load the DHG's hypergraph structure from a file. Args: ``file_path`` (``Union[str, Path]``): The file path to load the DHG's hypergraph structure.

(file_path: Union[str, Path])

Source from the content-addressed store, hash-verified

69
70 @staticmethod
71 def load(file_path: Union[str, Path]):
72 r"""Load the DHG's hypergraph structure from a file.
73
74 Args:
75 ``file_path`` (``Union[str, Path]``): The file path to load the DHG's hypergraph structure.
76 """
77 file_path = Path(file_path)
78 assert file_path.exists(), "The file does not exist."
79 with open(file_path, "rb") as fp:
80 data = pickle.load(fp)
81 assert data["class"] == "Hypergraph", "The file is not a DHG's hypergraph file."
82 return Hypergraph.from_state_dict(data["state_dict"])
83
84 def draw(
85 self,

Callers

nothing calls this directly

Calls 1

from_state_dictMethod · 0.45

Tested by

no test coverage detected