MarkedGraph.saveGUM
- MarkedGraph.saveGUM(name, binary=None, indent=None)
Save the graph as a .jgum (text) or .bgum (binary) file (its class, its nodes with their names, its arcs, edges and marks).
- Parameters:
name (
str) – the name of the filebinary (
bool, optional) – True for the msgpack-based .bgum binary format, False for the JSON-based .jgum text format. By default, the format is given by the extension of name (binary for an unknown extension).indent (
int, optional) – JSON indentation for the .jgum text format (ignored for the binary format): -1 for the most compact output, N>=0 to pretty-print with N spaces. Defaults topyagrum.config["core","jgumIndent"].
- Raises:
pyagrum.InvalidArgument – if binary contradicts the extension (
.jgumor.bgum) of name- Return type:
None
Example
import pyagrum as gum
g = gum.fastMarkedGraph("A->B<->C")
g.saveGUM("graph.jgum")
print(gum.loadGraph("graph.jgum"))
# {0<A>,1<B>,2<C>} , {0 --> 1, 1 <-> 2}
Class
Overridden in