From 4dc286e8e9572913f2437c7c2dc99eebbb758f86 Mon Sep 17 00:00:00 2001
From: Ralph Liu <106174412+oorliu@users.noreply.github.com>
Date: Wed, 3 Aug 2022 13:30:07 -0400
Subject: [PATCH] Use Datasets API to Update Docstring Examples (#2441)

closes #2361

Docstring examples now use the new method of creating graphs by using the `datasets` API. This change cleans up the code by eliminating the usage of `cuDF`.

Old docstring example:
```
>>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
...                   dtype=['int32', 'int32', 'float32'], header=None)
>>> G = cugraph.Graph()
>>> G.from_cudf_edgelist(M, source='0', destination='1')
```

Updated docstring example:
```
>>> from cugraph.experimental.datasets import karate
>>> G = karate.get_graph()
```

Authors:
  - Ralph Liu (https://github.com/oorliu)
  - Dylan Chima-Sanchez (https://github.com/betochimas)

Approvers:
  - Rick Ratzel (https://github.com/rlratzel)

URL: https://github.com/rapidsai/cugraph/pull/2441
---
 MANIFEST.in                                   |  2 +-
 python/cugraph/MANIFEST.in                    |  2 +-
 .../centrality/betweenness_centrality.py      | 14 +++----
 .../cugraph/centrality/degree_centrality.py   |  6 +--
 .../centrality/eigenvector_centrality.py      |  6 +--
 .../cugraph/centrality/katz_centrality.py     |  6 +--
 python/cugraph/cugraph/community/ecg.py       |  7 +---
 python/cugraph/cugraph/community/egonet.py    | 16 ++------
 .../cugraph/community/ktruss_subgraph.py      | 14 ++-----
 python/cugraph/cugraph/community/leiden.py    |  8 +---
 python/cugraph/cugraph/community/louvain.py   |  8 +---
 .../cugraph/community/spectral_clustering.py  | 40 +++++--------------
 .../cugraph/community/subgraph_extraction.py  |  8 +---
 .../cugraph/community/triangle_count.py       |  8 +---
 .../cugraph/components/connectivity.py        | 24 +++--------
 python/cugraph/cugraph/cores/core_number.py   |  6 +--
 python/cugraph/cugraph/cores/k_core.py        |  6 +--
 .../datasets/metadata/__init__.py             |  0
 python/cugraph/cugraph/layout/force_atlas2.py |  7 +---
 python/cugraph/cugraph/link_analysis/hits.py  |  6 +--
 .../cugraph/cugraph/link_analysis/pagerank.py |  6 +--
 .../cugraph/link_prediction/jaccard.py        | 18 +++------
 .../cugraph/link_prediction/overlap.py        |  6 +--
 .../cugraph/link_prediction/sorensen.py       | 12 ++----
 .../cugraph/link_prediction/wjaccard.py       |  6 +--
 .../cugraph/link_prediction/woverlap.py       |  6 +--
 .../cugraph/link_prediction/wsorensen.py      |  6 +--
 python/cugraph/cugraph/sampling/node2vec.py   |  6 +--
 .../cugraph/cugraph/sampling/random_walks.py  |  7 ++--
 python/cugraph/cugraph/traversal/bfs.py       | 12 ++----
 python/cugraph/cugraph/traversal/sssp.py      |  6 +--
 .../cugraph/tree/minimum_spanning_tree.py     | 12 ++----
 32 files changed, 90 insertions(+), 207 deletions(-)
 create mode 100644 python/cugraph/cugraph/experimental/datasets/metadata/__init__.py

diff --git a/MANIFEST.in b/MANIFEST.in
index ea12b9342b3..8b68ff0f2fa 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,4 @@
 include python/versioneer.py
 include python/cugraph/_version.py
 include cugraph/experimental/datasets/*.yaml
-include cugraph/experimental/datasets/metadata/*.yaml
\ No newline at end of file
+include cugraph/experimental/datasets/metadata/*.yaml
diff --git a/python/cugraph/MANIFEST.in b/python/cugraph/MANIFEST.in
index 1f6d9f7a4d0..ef71a68a090 100644
--- a/python/cugraph/MANIFEST.in
+++ b/python/cugraph/MANIFEST.in
@@ -1,4 +1,4 @@
 include versioneer.py
 include cugraph/_version.py
 include cugraph/experimental/datasets/*.yaml
-include cugraph/experimental/datasets/metadata/*.yaml
\ No newline at end of file
+include cugraph/experimental/datasets/metadata/*.yaml
diff --git a/python/cugraph/cugraph/centrality/betweenness_centrality.py b/python/cugraph/cugraph/centrality/betweenness_centrality.py
index e677c02f627..8f8cb3fce95 100644
--- a/python/cugraph/cugraph/centrality/betweenness_centrality.py
+++ b/python/cugraph/cugraph/centrality/betweenness_centrality.py
@@ -106,10 +106,8 @@ def betweenness_centrality(
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> bc = cugraph.betweenness_centrality(G)
 
     """
@@ -235,11 +233,9 @@ def edge_betweenness_centrality(
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
-    >>> ebc = cugraph.edge_betweenness_centrality(G)
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
+    >>> bc = cugraph.betweenness_centrality(G)
 
     """
     if weight is not None:
diff --git a/python/cugraph/cugraph/centrality/degree_centrality.py b/python/cugraph/cugraph/centrality/degree_centrality.py
index c7ef6549598..a57808b0ccb 100644
--- a/python/cugraph/cugraph/centrality/degree_centrality.py
+++ b/python/cugraph/cugraph/centrality/degree_centrality.py
@@ -42,10 +42,8 @@ def degree_centrality(G, normalized=True):
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> dc = cugraph.degree_centrality(G)
 
     """
diff --git a/python/cugraph/cugraph/centrality/eigenvector_centrality.py b/python/cugraph/cugraph/centrality/eigenvector_centrality.py
index 464c4b431cb..514cd84c69b 100644
--- a/python/cugraph/cugraph/centrality/eigenvector_centrality.py
+++ b/python/cugraph/cugraph/centrality/eigenvector_centrality.py
@@ -68,10 +68,8 @@ def eigenvector_centrality(
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> ec = cugraph.eigenvector_centrality(G)
 
     """
diff --git a/python/cugraph/cugraph/centrality/katz_centrality.py b/python/cugraph/cugraph/centrality/katz_centrality.py
index 5aff9f2dd2f..569e53be5c0 100644
--- a/python/cugraph/cugraph/centrality/katz_centrality.py
+++ b/python/cugraph/cugraph/centrality/katz_centrality.py
@@ -107,10 +107,8 @@ def katz_centrality(
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> kc = cugraph.katz_centrality(G)
 
     """
diff --git a/python/cugraph/cugraph/community/ecg.py b/python/cugraph/cugraph/community/ecg.py
index 7b5c8ced5fb..61ef7ce530d 100644
--- a/python/cugraph/cugraph/community/ecg.py
+++ b/python/cugraph/cugraph/community/ecg.py
@@ -61,11 +61,8 @@ def ecg(input_graph, min_weight=0.05, ensemble_size=16, weight=None):
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr='2')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> parts = cugraph.ecg(G)
 
     """
diff --git a/python/cugraph/cugraph/community/egonet.py b/python/cugraph/cugraph/community/egonet.py
index 8e9765100ab..e2f0493eb45 100644
--- a/python/cugraph/cugraph/community/egonet.py
+++ b/python/cugraph/cugraph/community/egonet.py
@@ -81,12 +81,8 @@ def ego_graph(G, n, radius=1, center=True, undirected=False, distance=None):
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> ego_graph = cugraph.ego_graph(G, 1, radius=2)
 
     """
@@ -157,12 +153,8 @@ def batched_ego_graphs(
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> b_ego_graph, offsets = cugraph.batched_ego_graphs(G, seeds=[1,5],
     ...                                                   radius=2)
 
diff --git a/python/cugraph/cugraph/community/ktruss_subgraph.py b/python/cugraph/cugraph/community/ktruss_subgraph.py
index c32c6ce177c..59b7c4e2ae6 100644
--- a/python/cugraph/cugraph/community/ktruss_subgraph.py
+++ b/python/cugraph/cugraph/community/ktruss_subgraph.py
@@ -67,11 +67,8 @@ def k_truss(G, k):
 
     Examples
     --------
-    >>> import cudf # k_truss does not run on CUDA 11.5
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> k_subgraph = cugraph.k_truss(G, 3)
 
     """
@@ -150,11 +147,8 @@ def ktruss_subgraph(G, k, use_weights=True):
 
     Examples
     --------
-    >>> import cudf # ktruss_subgraph does not run on CUDA 11.5
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> k_subgraph = cugraph.ktruss_subgraph(G, 3)
 
     """
diff --git a/python/cugraph/cugraph/community/leiden.py b/python/cugraph/cugraph/community/leiden.py
index d10d5700b1a..ae282cda7ed 100644
--- a/python/cugraph/cugraph/community/leiden.py
+++ b/python/cugraph/cugraph/community/leiden.py
@@ -66,12 +66,8 @@ def leiden(G, max_iter=100, resolution=1.):
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> parts, modularity_score = cugraph.leiden(G)
 
     """
diff --git a/python/cugraph/cugraph/community/louvain.py b/python/cugraph/cugraph/community/louvain.py
index 87591f61cbc..cf0e3cc6ac5 100644
--- a/python/cugraph/cugraph/community/louvain.py
+++ b/python/cugraph/cugraph/community/louvain.py
@@ -65,12 +65,8 @@ def louvain(G, max_iter=100, resolution=1.):
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> parts, modularity_score = cugraph.louvain(G)
 
     """
diff --git a/python/cugraph/cugraph/community/spectral_clustering.py b/python/cugraph/cugraph/community/spectral_clustering.py
index 9415d545d6f..9796d07b4b8 100644
--- a/python/cugraph/cugraph/community/spectral_clustering.py
+++ b/python/cugraph/cugraph/community/spectral_clustering.py
@@ -71,12 +71,8 @@ def spectralBalancedCutClustering(
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.spectralBalancedCutClustering(G, 5)
 
     """
@@ -158,12 +154,8 @@ def spectralModularityMaximizationClustering(
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr='2')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.spectralModularityMaximizationClustering(G, 5)
 
     """
@@ -226,12 +218,8 @@ def analyzeClustering_modularity(G, n_clusters, clustering,
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr='2')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.spectralBalancedCutClustering(G, 5)
     >>> score = cugraph.analyzeClustering_modularity(G, 5, df)
 
@@ -297,12 +285,8 @@ def analyzeClustering_edge_cut(G, n_clusters, clustering,
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr=None)
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.spectralBalancedCutClustering(G, 5)
     >>> score = cugraph.analyzeClustering_edge_cut(G, 5, df)
 
@@ -365,12 +349,8 @@ def analyzeClustering_ratio_cut(G, n_clusters, clustering,
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr='2')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.spectralBalancedCutClustering(G, 5)
     >>> score = cugraph.analyzeClustering_ratio_cut(G, 5, df, 'vertex',
     ...                                             'cluster')
diff --git a/python/cugraph/cugraph/community/subgraph_extraction.py b/python/cugraph/cugraph/community/subgraph_extraction.py
index bc11dbd1294..206f38266b9 100644
--- a/python/cugraph/cugraph/community/subgraph_extraction.py
+++ b/python/cugraph/cugraph/community/subgraph_extraction.py
@@ -43,12 +43,8 @@ def subgraph(G, vertices):
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                     delimiter = ' ',
-    ...                     dtype=['int32', 'int32', 'float32'],
-    ...                     header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> verts = np.zeros(3, dtype=np.int32)
     >>> verts[0] = 0
     >>> verts[1] = 1
diff --git a/python/cugraph/cugraph/community/triangle_count.py b/python/cugraph/cugraph/community/triangle_count.py
index 103999e7010..ce8539c1541 100644
--- a/python/cugraph/cugraph/community/triangle_count.py
+++ b/python/cugraph/cugraph/community/triangle_count.py
@@ -39,12 +39,8 @@ def triangles(G):
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                     delimiter = ' ',
-    ...                     dtype=['int32', 'int32', 'float32'],
-    ...                     header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> count = cugraph.triangles(G)
 
     """
diff --git a/python/cugraph/cugraph/components/connectivity.py b/python/cugraph/cugraph/components/connectivity.py
index c1601cd42bf..1ac78bc1e83 100644
--- a/python/cugraph/cugraph/components/connectivity.py
+++ b/python/cugraph/cugraph/components/connectivity.py
@@ -171,12 +171,8 @@ def weakly_connected_components(G,
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr=None)
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.weakly_connected_components(G)
 
     """
@@ -269,12 +265,8 @@ def strongly_connected_components(G,
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr=None)
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.strongly_connected_components(G)
 
     """
@@ -367,12 +359,8 @@ def connected_components(G,
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv',
-    ...                   delimiter = ' ',
-    ...                   dtype=['int32', 'int32', 'float32'],
-    ...                   header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr=None)
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.connected_components(G, connection="weak")
 
     """
diff --git a/python/cugraph/cugraph/cores/core_number.py b/python/cugraph/cugraph/cores/core_number.py
index f5a1e00de9f..028c4f05b31 100644
--- a/python/cugraph/cugraph/cores/core_number.py
+++ b/python/cugraph/cugraph/cores/core_number.py
@@ -58,10 +58,8 @@ def core_number(G, degree_type=None):
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.core_number(G)
 
     """
diff --git a/python/cugraph/cugraph/cores/k_core.py b/python/cugraph/cugraph/cores/k_core.py
index 7e935c55558..d17076d0f50 100644
--- a/python/cugraph/cugraph/cores/k_core.py
+++ b/python/cugraph/cugraph/cores/k_core.py
@@ -74,10 +74,8 @@ def k_core(G, k=None, core_number=None):
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> KCoreGraph = cugraph.k_core(G)
 
     """
diff --git a/python/cugraph/cugraph/experimental/datasets/metadata/__init__.py b/python/cugraph/cugraph/experimental/datasets/metadata/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/python/cugraph/cugraph/layout/force_atlas2.py b/python/cugraph/cugraph/layout/force_atlas2.py
index ec05a3b8482..366a3009678 100644
--- a/python/cugraph/cugraph/layout/force_atlas2.py
+++ b/python/cugraph/cugraph/layout/force_atlas2.py
@@ -123,11 +123,8 @@ def on_train_end(self, positions):
 
         Examples
         --------
-        >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-        ...                     dtype=['int32', 'int32', 'float32'],
-        ...                     header=None)
-        >>> G = cugraph.Graph()
-        >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+        >>> from cugraph.experimental.datasets import karate
+        >>> G = karate.get_graph(fetch=True)
         >>> pos = cugraph.force_atlas2(G)
 
     """
diff --git a/python/cugraph/cugraph/link_analysis/hits.py b/python/cugraph/cugraph/link_analysis/hits.py
index 820f7d6aba1..544e64aef08 100644
--- a/python/cugraph/cugraph/link_analysis/hits.py
+++ b/python/cugraph/cugraph/link_analysis/hits.py
@@ -79,10 +79,8 @@ def hits(
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> hits = cugraph.hits(G, max_iter = 50)
 
     """
diff --git a/python/cugraph/cugraph/link_analysis/pagerank.py b/python/cugraph/cugraph/link_analysis/pagerank.py
index 1bf238141fc..ecb0ba6ea74 100644
--- a/python/cugraph/cugraph/link_analysis/pagerank.py
+++ b/python/cugraph/cugraph/link_analysis/pagerank.py
@@ -98,10 +98,8 @@ def pagerank(
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> pr = cugraph.pagerank(G, alpha = 0.85, max_iter = 500, tol = 1.0e-05)
 
     """
diff --git a/python/cugraph/cugraph/link_prediction/jaccard.py b/python/cugraph/cugraph/link_prediction/jaccard.py
index 10bfd35f252..1e7ddc2ec43 100644
--- a/python/cugraph/cugraph/link_prediction/jaccard.py
+++ b/python/cugraph/cugraph/link_prediction/jaccard.py
@@ -53,10 +53,8 @@ def jaccard(input_graph, vertex_pair=None):
     you can get the interesting (non-zero) values that are part of the networkx
     solution by doing the following:
 
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> pairs = G.get_two_hop_neighbors()
     >>> df = cugraph.jaccard(G, pairs)
 
@@ -100,10 +98,8 @@ def jaccard(input_graph, vertex_pair=None):
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.jaccard(G)
 
     """
@@ -162,10 +158,8 @@ def jaccard_coefficient(G, ebunch=None):
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.jaccard_coefficient(G)
 
     """
diff --git a/python/cugraph/cugraph/link_prediction/overlap.py b/python/cugraph/cugraph/link_prediction/overlap.py
index 816c580747b..9318c379439 100644
--- a/python/cugraph/cugraph/link_prediction/overlap.py
+++ b/python/cugraph/cugraph/link_prediction/overlap.py
@@ -85,10 +85,8 @@ def overlap(input_graph, vertex_pair=None):
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.overlap(G)
 
     """
diff --git a/python/cugraph/cugraph/link_prediction/sorensen.py b/python/cugraph/cugraph/link_prediction/sorensen.py
index 4a88f6b1558..4a4bc8adcdb 100644
--- a/python/cugraph/cugraph/link_prediction/sorensen.py
+++ b/python/cugraph/cugraph/link_prediction/sorensen.py
@@ -68,10 +68,8 @@ def sorensen(input_graph, vertex_pair=None):
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.sorensen(G)
 
     """
@@ -132,10 +130,8 @@ def sorensen_coefficient(G, ebunch=None):
 
     Examples
     --------
-    >>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                     dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(gdf, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.sorensen_coefficient(G)
 
     """
diff --git a/python/cugraph/cugraph/link_prediction/wjaccard.py b/python/cugraph/cugraph/link_prediction/wjaccard.py
index 3ff00df11ec..68c093a052a 100644
--- a/python/cugraph/cugraph/link_prediction/wjaccard.py
+++ b/python/cugraph/cugraph/link_prediction/wjaccard.py
@@ -70,10 +70,8 @@ def jaccard_w(input_graph, weights, vertex_pair=None):
     Examples
     --------
     >>> import random
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                   dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> # Create a dataframe containing the vertices with their
     >>> # corresponding weight
     >>> weights = cudf.DataFrame()
diff --git a/python/cugraph/cugraph/link_prediction/woverlap.py b/python/cugraph/cugraph/link_prediction/woverlap.py
index 10eca82e951..42509962b2a 100644
--- a/python/cugraph/cugraph/link_prediction/woverlap.py
+++ b/python/cugraph/cugraph/link_prediction/woverlap.py
@@ -69,10 +69,8 @@ def overlap_w(input_graph, weights, vertex_pair=None):
     Examples
     --------
     >>> import random
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                   dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> # Create a dataframe containing the vertices with their
     >>> # corresponding weight
     >>> weights = cudf.DataFrame()
diff --git a/python/cugraph/cugraph/link_prediction/wsorensen.py b/python/cugraph/cugraph/link_prediction/wsorensen.py
index 69eb5b975c7..cacc4242257 100644
--- a/python/cugraph/cugraph/link_prediction/wsorensen.py
+++ b/python/cugraph/cugraph/link_prediction/wsorensen.py
@@ -65,10 +65,8 @@ def sorensen_w(input_graph, weights, vertex_pair=None):
     Examples
     --------
     >>> import random
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                   dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> # Create a dataframe containing the vertices with their
     >>> # corresponding weight
     >>> weights = cudf.DataFrame()
diff --git a/python/cugraph/cugraph/sampling/node2vec.py b/python/cugraph/cugraph/sampling/node2vec.py
index 44af8e1182a..b0b2029153d 100644
--- a/python/cugraph/cugraph/sampling/node2vec.py
+++ b/python/cugraph/cugraph/sampling/node2vec.py
@@ -87,10 +87,8 @@ def node2vec(G,
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                   dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr='2')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> start_vertices = cudf.Series([0, 2], dtype=np.int32)
     >>> paths, weights, path_sizes = cugraph.node2vec(G, start_vertices, 3,
     ...                                               True, 0.8, 0.5)
diff --git a/python/cugraph/cugraph/sampling/random_walks.py b/python/cugraph/cugraph/sampling/random_walks.py
index d7ce6057049..f3c0a7c965a 100644
--- a/python/cugraph/cugraph/sampling/random_walks.py
+++ b/python/cugraph/cugraph/sampling/random_walks.py
@@ -56,10 +56,9 @@ def random_walks(G,
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                   dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr='2')
+    >>> from cugraph.experimental.datasets import karate
+    >>> M = karate.get_edgelist(fetch=True)
+    >>> G = karate.get_graph()
     >>> _, _, _ = cugraph.random_walks(G, M, 3)
 
     """
diff --git a/python/cugraph/cugraph/traversal/bfs.py b/python/cugraph/cugraph/traversal/bfs.py
index 4938b6bb200..64d6dddb403 100644
--- a/python/cugraph/cugraph/traversal/bfs.py
+++ b/python/cugraph/cugraph/traversal/bfs.py
@@ -206,10 +206,8 @@ def bfs(G,
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                   dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.bfs(G, 0)
 
     """
@@ -325,10 +323,8 @@ def bfs_edges(G, source, reverse=False, depth_limit=None, sort_neighbors=None):
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                   dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> df = cugraph.bfs_edges(G, 0)
 
     """
diff --git a/python/cugraph/cugraph/traversal/sssp.py b/python/cugraph/cugraph/traversal/sssp.py
index 4533a834952..1428672559d 100644
--- a/python/cugraph/cugraph/traversal/sssp.py
+++ b/python/cugraph/cugraph/traversal/sssp.py
@@ -238,10 +238,8 @@ def sssp(G,
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
-    ...                   dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import karate
+    >>> G = karate.get_graph(fetch=True)
     >>> distances = cugraph.sssp(G, 0)
     >>> distances
             distance  vertex  predecessor
diff --git a/python/cugraph/cugraph/tree/minimum_spanning_tree.py b/python/cugraph/cugraph/tree/minimum_spanning_tree.py
index 8ad1af0f704..fe19e8ed1ff 100644
--- a/python/cugraph/cugraph/tree/minimum_spanning_tree.py
+++ b/python/cugraph/cugraph/tree/minimum_spanning_tree.py
@@ -92,10 +92,8 @@ def minimum_spanning_tree(
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'netscience.csv', delimiter=' ',
-    ...                   dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import netscience
+    >>> G = netscience.get_graph(fetch=True)
     >>> G_mst = cugraph.minimum_spanning_tree(G)
 
     """
@@ -139,10 +137,8 @@ def maximum_spanning_tree(
 
     Examples
     --------
-    >>> M = cudf.read_csv(datasets_path / 'netscience.csv', delimiter=' ',
-    ...                   dtype=['int32', 'int32', 'float32'], header=None)
-    >>> G = cugraph.Graph()
-    >>> G.from_cudf_edgelist(M, source='0', destination='1')
+    >>> from cugraph.experimental.datasets import netscience
+    >>> G = netscience.get_graph(fetch=True)
     >>> G_mst = cugraph.maximum_spanning_tree(G)
 
     """