(self, path: Path | None = None)
| 105 | return g |
| 106 | |
| 107 | def save(self, path: Path | None = None) -> None: |
| 108 | p = path or default_graph_path() |
| 109 | p.parent.mkdir(parents=True, exist_ok=True) |
| 110 | p.write_text(json.dumps(self.to_dict()), encoding="utf-8") |
| 111 | |
| 112 | @classmethod |
| 113 | def load(cls, path: Path | None = None) -> "KnowledgeGraph": |