turicreate.load_sgraph

turicreate.load_sgraph(filename, format='binary', delimiter='auto')

Load SGraph from text file or previously saved SGraph binary.

Parameters:
filename : string

Location of the file. Can be a local path or a remote URL.

format : {‘binary’, ‘snap’, ‘csv’, ‘tsv’}, optional

Format to of the file to load.

  • ‘binary’: native graph format obtained from SGraph.save.
  • ‘snap’: tab or space separated edge list format with comments, used in the Stanford Network Analysis Platform.
  • ‘csv’: comma-separated edge list without header or comments.
  • ‘tsv’: tab-separated edge list without header or comments.
delimiter : str, optional

Specifying the Delimiter used in ‘snap’, ‘csv’ or ‘tsv’ format. Those format has default delimiter, but sometimes it is useful to overwrite the default delimiter.

Returns:
out : SGraph

Loaded SGraph.

See also

SGraph, SGraph.save

Examples

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

Save and load in binary format.

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