element_51.storeΒΆ

Save a graph to a JSON file and read it back.

The file holds a format_version, the nodes with their positions, and the links. Reading replays every node and link through the same rules as an edit, so a file that breaks the rules is refused instead of loaded.

Functions

load_graph(path, node_types)

Read a graph from path and check it against node_types.

save_graph(graph, path)

Write graph to path as JSON, replacing any file there.

Exceptions

StoreError

A graph file that cannot be loaded.