#

Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

#

networkx.readwrite.gpickle.read_gpickle

read_gpickle(path)[source]

Read graph object in Python pickle format.

Pickles are a serialized byte stream of a Python object 1. This format will preserve Python objects used as nodes or edges.

Parameters

path (file or string) – File or filename to write. Filenames ending in .gz or .bz2 will be uncompressed.

Returns

G – A NetworkX graph

Return type

graph

Examples

>>> G = nx.path_graph(4)
>>> nx.write_gpickle(G, "test.gpickle")
>>> G = nx.read_gpickle("test.gpickle")

References

1

https://docs.python.org/3/library/pickle.html