Read and write NetworkX graphs as Python pickles.
The pickle library is not secure and can be used to create arbitray objects. Only unpickle data you trust - see pickle — Python object serialization for additional information.
“The pickle module implements a fundamental, but powerful algorithm for serializing and de-serializing a Python object structure. “Pickling” is the process whereby a Python object hierarchy is converted into a byte stream, and “unpickling” is the inverse operation, whereby a byte stream is converted back into an object hierarchy.”
Note that NetworkX graphs can contain any hashable Python object as node (not just integers and strings). For arbitrary data types it may be difficult to represent the data as text. In that case using Python pickles to store the graph data can be used.
Read graph object in Python pickle format.
Write graph in Python pickle format.