SGraph.save(self, filename, format='auto')

Save the SGraph to disk. If the graph is saved in binary format, the graph can be re-loaded using the load_sgraph() method. Alternatively, the SGraph can be saved in JSON format for a human-readable and portable representation.

filename : string

Filename to use when saving the file. It can be either a local or remote url.

format : {‘auto’, ‘binary’, ‘json’}, optional

File format. If not specified, the format is detected automatically based on the filename. Note that JSON format graphs cannot be re-loaded with load_sgraph().

See also



>>> g = turicreate.SGraph()
>>> g = g.add_vertices([turicreate.Vertex(i) for i in range(5)])

Save and load in binary format.

>>> g.save('mygraph')
>>> g2 = turicreate.load_sgraph('mygraph')

Save in JSON format.

>>> g.save('mygraph.json', format='json')