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

        Parameters
        ----------
        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 :py:func:`load_sgraph`.

        See Also
        --------
        load_sgraph

        Examples
        --------
        >>> 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')

def 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 :py:func:`load_sgraph` method.
        Alternatively, the SGraph can be saved in JSON format for a
        human-readable and portable representation.

        Parameters
        ----------
        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 :py:func:`load_sgraph`.

        See Also
        --------
        load_sgraph

        Examples
        --------
        >>> 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')
        """

        if format is 'auto':
            if filename.endswith(('.json', '.json.gz')):
                format = 'json'
            else:
                format = 'binary'

        if format not in ['binary', 'json', 'csv']:
            raise ValueError('Invalid format: %s. Supported formats are: %s'
                             % (format, ['binary', 'json', 'csv']))
        with cython_context():
            self.__proxy__.save_graph(_make_internal_url(filename), format)