(self, fname=None, version=-1)
return result
Saves the graph in Python pickled format

        @param fname: the name of the file or a stream to save to. If
          C{None}, saves the graph to a string and returns the string.
        @param version: pickle protocol version to be used. If -1, uses
          the highest protocol available
        @return: C{None} if the graph was saved successfully to the
          given file, or a string if C{fname} was C{None}.
Saves the graph in Python pickled format
Saves the graph in Python pickled format
def write_pickle(self, fname=None, version=-1):
        """Saves the graph in Python pickled format

        @param fname: the name of the file or a stream to save to. If
          C{None}, saves the graph to a string and returns the string.
        @param version: pickle protocol version to be used. If -1, uses
          the highest protocol available
        @return: C{None} if the graph was saved successfully to the
          given file, or a string if C{fname} was C{None}.
        """
        import pickle as pickle

        if fname is None:
            return pickle.dumps(self, version)
        if not hasattr(fname, "write"):
            file_was_opened = True
            fname = open(fname, "wb")
        else:
            file_was_opened = False
        result = pickle.dump(self, fname, version)
        if file_was_opened:
            fname.close()
        return result
def write_pickle ( self , fname = None , version = - 1 ) : import pickle as pickle if fname is None : return pickle . dumps ( self , version ) if not hasattr ( fname , "write" ) : file_was_opened = True fname = open ( fname , "wb" ) else : file_was_opened = False result = pickle . dump ( self , fname , version ) if file_was_opened : fname . close ( ) return result