summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarrod Millman <jarrod.millman@gmail.com>2022-02-19 08:09:36 -0800
committerGitHub <noreply@github.com>2022-02-19 08:09:36 -0800
commit6be18486825376d1dc25dc075da44684c7fcbc47 (patch)
tree40e822a270cd745a68359e94da12cb190a0e831a
parent834a870e3eb5112ff6d154f1003a293bb88897e5 (diff)
downloadnetworkx-6be18486825376d1dc25dc075da44684c7fcbc47.tar.gz
Add pickle and yaml migration info (#5345)
-rw-r--r--doc/release/migration_guide_from_2.x_to_3.0.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/release/migration_guide_from_2.x_to_3.0.rst b/doc/release/migration_guide_from_2.x_to_3.0.rst
index b3cd96ff..618e2c29 100644
--- a/doc/release/migration_guide_from_2.x_to_3.0.rst
+++ b/doc/release/migration_guide_from_2.x_to_3.0.rst
@@ -30,3 +30,29 @@ Deprecated code
The 2.6 release deprecates over 30 functions.
See :ref:`networkx_2.6`.
+
+---
+
+The functions `read_gpickle` and `write_gpickle` will be removed in 3.0.
+You can read and write NetworkX graphs as Python pickles.
+
+>>> import pickle
+>>> G = nx.path_graph(4)
+>>> with open('test.gpickle', 'wb') as f:
+... pickle.dump(G, f, pickle.HIGHEST_PROTOCOL)
+...
+>>> with open('test.gpickle', 'rb') as f:
+... G = pickle.load(f)
+...
+
+The functions `read_yaml` and `write_yaml` will be removed in 3.0.
+You can read and write NetworkX graphs in YAML format
+using pyyaml.
+
+>>> import yaml
+>>> G = nx.path_graph(4)
+>>> with open('test.yaml', 'w') as f:
+... yaml.dump(G, f)
+...
+>>> with open('test.yaml', 'r') as f:
+... G = yaml.load(f, Loader=yaml.Loader)