diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4354ca40327..74838271093 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -27,6 +27,7 @@ concurrency: jobs: cpp-build: + node_type: cpu32 secrets: inherit uses: rapidsai/shared-action-workflows/.github/workflows/conda-cpp-build.yaml@branch-23.08 with: diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 17d7ac48907..ea4d7c4c625 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -36,7 +36,7 @@ jobs: uses: rapidsai/shared-action-workflows/.github/workflows/conda-cpp-build.yaml@branch-23.08 with: build_type: pull-request - node_type: cpu16 + node_type: cpu32 conda-cpp-tests: needs: conda-cpp-build secrets: inherit diff --git a/notebooks/algorithms/centrality/Betweenness.ipynb b/notebooks/algorithms/centrality/Betweenness.ipynb index 82b7b4bc29e..29ad37ec254 100644 --- a/notebooks/algorithms/centrality/Betweenness.ipynb +++ b/notebooks/algorithms/centrality/Betweenness.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -13,10 +14,12 @@ "| Brad Rees | 04/24/2019 | created | 0.15 | GV100, CUDA 11.0\n", "| Brad Rees | 08/16/2020 | tested / updated | 21.10 nightly | RTX 3090 CUDA 11.4\n", "| Don Acosta | 07/05/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", - "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5" + "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", + "| | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -28,6 +31,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -37,6 +41,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -71,6 +76,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -82,6 +88,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -98,6 +105,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -115,7 +123,7 @@ "import cudf\n", "\n", "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { @@ -129,6 +137,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -142,10 +151,11 @@ "outputs": [], "source": [ "# Create a graph using the imported Dataset object\n", - "G = karate.get_graph(fetch=True)" + "G = karate.get_graph(download=True)" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -173,6 +183,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -203,6 +214,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -210,6 +222,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -267,6 +280,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -274,11 +288,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -303,7 +318,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/centrality/Centrality.ipynb b/notebooks/algorithms/centrality/Centrality.ipynb index 68d7776bbbb..d19dd646b15 100644 --- a/notebooks/algorithms/centrality/Centrality.ipynb +++ b/notebooks/algorithms/centrality/Centrality.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -18,10 +20,12 @@ "| Brad Rees | 04/16/2021 | created | 0.19 | GV100, CUDA 11.0\n", "| Brad Rees | 08/05/2021 | tested / updated | 21.10 nightly | RTX 3090 CUDA 11.4\n", "| Don Acosta | 07/29/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", " " ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -86,6 +90,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -93,6 +98,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -116,7 +122,7 @@ "# Import the cugraph modules\n", "import cugraph\n", "import cudf\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { @@ -132,6 +138,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -194,6 +201,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -203,6 +211,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -216,10 +225,11 @@ "outputs": [], "source": [ "# Create a graph using the imported Dataset object\n", - "G = karate.get_graph(fetch=True)" + "G = karate.get_graph(download=True)" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -236,6 +246,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -254,6 +265,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -312,6 +324,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -320,6 +333,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -369,6 +383,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -385,6 +400,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -392,6 +408,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -420,7 +437,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.15" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/centrality/Degree.ipynb b/notebooks/algorithms/centrality/Degree.ipynb index 9b16cb71336..e7535420b65 100644 --- a/notebooks/algorithms/centrality/Degree.ipynb +++ b/notebooks/algorithms/centrality/Degree.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -10,10 +11,12 @@ "\n", "| Author Credit | Date | Update | cuGraph Version | Test Hardware |\n", "| --------------|------------|------------------|-----------------|----------------|\n", - "| Don Acosta | 07/05/2022 | created | 22.08 nightly | DGX Tesla V100 CUDA 11.5" + "| Don Acosta | 07/05/2022 | created | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", + "| Ralph Liu | 06/29/2023 | updated w/ `datasets` api | 23.08 nightly | DGX Tesla V100 CUDA 12.0" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -28,6 +31,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -37,6 +41,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -57,6 +62,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -67,6 +73,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -83,6 +90,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -90,6 +98,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [] @@ -116,10 +125,11 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ - "### Some Prep" + "### Get Dataset" ] }, { @@ -128,30 +138,11 @@ "metadata": {}, "outputs": [], "source": [ - "# Define the path to the test data \n", - "datafile='../../data/karate-data.csv'" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Read in the data - GPU\n", - "cuGraph depends on cuDF for data loading and the initial Dataframe creation\n", - "\n", - "The data file contains an edge list, which represents the connection of a vertex to another. The `source` to `destination` pairs is in what is known as Coordinate Format (COO). In this test case, the data is just two columns. However a third, `weight`, column is also possible" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "gdf = cudf.read_csv(datafile, delimiter='\\t', names=['src', 'dst'], dtype=['int32', 'int32'] )" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -164,12 +155,11 @@ "metadata": {}, "outputs": [], "source": [ - "# create a Graph using the source (src) and destination (dst) vertex pairs from the Dataframe \n", - "G = cugraph.Graph()\n", - "G.from_cudf_edgelist(gdf, source='src', destination='dst')" + "G = karate.get_graph()" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -187,6 +177,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -233,6 +224,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -240,6 +232,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -252,6 +245,9 @@ "metadata": {}, "outputs": [], "source": [ + "# Define the path to the test data \n", + "datafile='../../data/karate-data.csv'\n", + "\n", "# Read the data, this also created a NetworkX Graph \n", "file = open(datafile, 'rb')\n", "Gnx = nx.read_edgelist(file)" @@ -277,13 +273,17 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ - "As mentioned, the scores are different but the ranking is the same." + "As mentioned, the scores are different but the ranking is the same.\n", + "\n", + "*note: the 0th node from cuGraph is equivalent to the 1st node in NetworkX*" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/notebooks/algorithms/centrality/Eigenvector.ipynb b/notebooks/algorithms/centrality/Eigenvector.ipynb index 7e4a080a00b..2d06aa39708 100644 --- a/notebooks/algorithms/centrality/Eigenvector.ipynb +++ b/notebooks/algorithms/centrality/Eigenvector.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -10,10 +11,12 @@ "\n", "| Author Credit | Date | Update | cuGraph Version | Test Hardware |\n", "| --------------|------------|------------------|-----------------|----------------|\n", - "| Don Acosta | 07/05/2022 | created | 22.08 nightly | DGX Tesla V100 CUDA 11.5" + "| Don Acosta | 07/05/2022 | created | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", + "| Ralph Liu | 07/11/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -27,6 +30,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -42,6 +46,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -78,6 +83,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -88,6 +94,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -104,6 +111,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -133,6 +141,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -145,11 +154,11 @@ "metadata": {}, "outputs": [], "source": [ - "# Define the path to the test data \n", - "datafile='../../data/karate-data.csv'" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -169,13 +178,14 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ - "### Read in the data - GPU\n", - "cuGraph depends on cuDF for data loading and the initial Dataframe creation\n", + "### Create a Graph\n", "\n", - "The data file contains an edge list, which represents the connection of a vertex to another. The `source` to `destination` pairs is in what is known as Coordinate Format (COO). In this test case, the data is just two columns. However a third, `weight`, column is also possible" + "cuGraph's dataset objects depend on cuDF for data loading and the intial edge-list creation.\n", + "The original data file contains an edge-list, which represents the connection of a vertex to another. These `source` to `destination` pairs are in what is known as Coordinate Format (COO)." ] }, { @@ -184,14 +194,7 @@ "metadata": {}, "outputs": [], "source": [ - "gdf = cudf.read_csv(datafile, delimiter='\\t', names=['src', 'dst'], dtype=['int32', 'int32'] )" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Create a Graph " + "karate.get_edgelist(download=True)" ] }, { @@ -200,12 +203,11 @@ "metadata": {}, "outputs": [], "source": [ - "# create a Graph using the source (src) and destination (dst) vertex pairs from the Dataframe \n", - "G = cugraph.Graph(directed=True)\n", - "G.from_cudf_edgelist(gdf, source='src', destination='dst')" + "G = karate.get_graph()" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -223,6 +225,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -230,6 +233,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -237,6 +241,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -249,12 +254,16 @@ "metadata": {}, "outputs": [], "source": [ + "# Define the path to the test data \n", + "datafile='../../data/karate-data.csv'\n", + "\n", "# Read the data, this also created a NetworkX Graph \n", "file = open(datafile, 'rb')\n", "Gnx = nx.read_edgelist(file)" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -273,6 +282,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -291,6 +301,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -298,6 +309,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -327,7 +339,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/centrality/Katz.ipynb b/notebooks/algorithms/centrality/Katz.ipynb index ef5a9c21381..c94a14bb14a 100755 --- a/notebooks/algorithms/centrality/Katz.ipynb +++ b/notebooks/algorithms/centrality/Katz.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -13,10 +14,12 @@ "| Brad Rees | 10/15/2019 | created | 0.14 | GV100, CUDA 10.2\n", "| Brad Rees | 08/16/2020 | tested / updated | 0.15.1 nightly | RTX 3090 CUDA 11.4\n", "| Don Acosta | 07/05/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", - "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5" + "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", + "| | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -67,6 +70,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -77,6 +81,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -93,6 +98,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -110,7 +116,7 @@ "import cudf\n", "\n", "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { @@ -124,6 +130,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -145,6 +152,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -158,7 +166,7 @@ "outputs": [], "source": [ "# Create a graph using the imported Dataset object\n", - "G = karate.get_graph(fetch=True)" + "G = karate.get_graph(download=True)" ] }, { @@ -182,6 +190,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -208,6 +217,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -229,6 +239,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -236,6 +247,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -282,6 +294,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -308,6 +321,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -344,7 +358,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.15" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/community/ECG.ipynb b/notebooks/algorithms/community/ECG.ipynb index 829be21035c..c6c5a7b1b03 100644 --- a/notebooks/algorithms/community/ECG.ipynb +++ b/notebooks/algorithms/community/ECG.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -14,6 +15,7 @@ "| | 08/05/2021 | tested/updated | 21.10 nightly | RTX 3090 CUDA 11.4 |\n", "| Don Acosta | 07/20/2022 | tested/updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", + "| | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "## Introduction\n", "\n", @@ -62,6 +64,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -73,6 +76,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -88,6 +92,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -105,10 +110,11 @@ "import cudf\n", "\n", "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -122,7 +128,7 @@ "outputs": [], "source": [ "# You can also just get the edgelist\n", - "gdf = karate.get_edgelist(fetch=True)\n", + "gdf = karate.get_edgelist(download=True)\n", "\n", "# The algorithm also requires that there are vertex weights. Just use 1.0 \n", "gdf[\"data\"] = 1.0" @@ -204,11 +210,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -233,7 +240,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/community/Louvain.ipynb b/notebooks/algorithms/community/Louvain.ipynb index a8529483534..a6a8cc363df 100755 --- a/notebooks/algorithms/community/Louvain.ipynb +++ b/notebooks/algorithms/community/Louvain.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -16,6 +17,7 @@ "| | 08/05/2021 | tested / updated | 21.10 nightly | RTX 3090 CUDA 11.4 |\n", "| Don Acosta | 07/11/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", + "| | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "\n", "\n", @@ -101,6 +103,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -112,6 +115,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -127,6 +131,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -144,10 +149,11 @@ "import cudf\n", "\n", "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -161,7 +167,7 @@ "outputs": [], "source": [ "# You can also just get the edgelist\n", - "gdf = karate.get_edgelist(fetch=True)\n", + "gdf = karate.get_edgelist(download=True)\n", "\n", "# The algorithm also requires that there are vertex weights. Just use 1.0 \n", "gdf[\"data\"] = 1.0" @@ -295,11 +301,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -324,7 +331,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/community/Spectral-Clustering.ipynb b/notebooks/algorithms/community/Spectral-Clustering.ipynb index 2ac1b9e8c16..fa6f0e954c0 100755 --- a/notebooks/algorithms/community/Spectral-Clustering.ipynb +++ b/notebooks/algorithms/community/Spectral-Clustering.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -14,10 +15,12 @@ "| Brad Rees and James Wyles | 08/01/2019 | created | 0.14 | GV100 32G, CUDA 10.2 |\n", "| | 08/16/2020 | updated | 0.15 | GV100 32G, CUDA 10.2 |\n", "| Don Acosta | 07/11/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", - "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |" + "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", + "| | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -36,6 +39,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -76,6 +80,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -111,6 +116,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -122,6 +128,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -141,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -151,10 +158,11 @@ "import numpy as np\n", "\n", "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -163,11 +171,11 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "gdf = karate.get_edgelist(fetch=True)\n", + "gdf = karate.get_edgelist(download=True)\n", "\n", "# The algorithm requires that there are edge weights. In this case all the weights are being set to 1\n", "gdf[\"data\"] = cudf.Series(np.ones(len(gdf), dtype=np.float32))" @@ -194,6 +202,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -212,6 +221,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -236,6 +246,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -296,6 +307,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -355,6 +367,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -362,11 +375,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -391,7 +405,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.9" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/community/Subgraph-Extraction.ipynb b/notebooks/algorithms/community/Subgraph-Extraction.ipynb index fb7708d1462..8d94eddf878 100755 --- a/notebooks/algorithms/community/Subgraph-Extraction.ipynb +++ b/notebooks/algorithms/community/Subgraph-Extraction.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -14,10 +15,12 @@ "| Brad Rees | 10/16/2019 | created | 0.13 | GV100 32G, CUDA 10.2 |\n", "| | 08/16/2020 | updated | 0.15 | GV100 32G, CUDA 10.2 |\n", "| Don Acosta | 07/11/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", - "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |" + "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", + "| | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -43,6 +46,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -54,6 +58,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -66,6 +71,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -83,10 +89,11 @@ "import cudf\n", "\n", "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -94,6 +101,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -108,7 +116,7 @@ "outputs": [], "source": [ "# You can also just get the edgelist\n", - "gdf = karate.get_edgelist(fetch=True)\n", + "gdf = karate.get_edgelist(download=True)\n", "\n", "# The louvain algorithm requires that there are vertex weights. Just use 1.0 \n", "gdf[\"data\"] = 1.0\n", @@ -162,6 +170,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -239,11 +248,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -268,7 +278,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.10.12" }, "vscode": { "interpreter": { @@ -278,4 +288,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/notebooks/algorithms/community/Triangle-Counting.ipynb b/notebooks/algorithms/community/Triangle-Counting.ipynb index b55c835cf4f..07203373617 100755 --- a/notebooks/algorithms/community/Triangle-Counting.ipynb +++ b/notebooks/algorithms/community/Triangle-Counting.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -15,6 +16,7 @@ "| | 08/16/2020 | updated | 0.15 | GV100 32G, CUDA 10.2 |\n", "| Don Acosta | 07/11/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", "| Ralph Liu | 07/27/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", + "| | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "## Introduction\n", "Triangle Counting, as the name implies, finds the number of triangles in a graph. Triangles are important in computing the clustering Coefficient and can be used for clustering. \n", @@ -52,6 +54,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -63,6 +66,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -76,6 +80,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -94,7 +99,7 @@ "from collections import OrderedDict\n", "\n", "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { @@ -110,6 +115,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -183,6 +189,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -192,6 +199,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -199,6 +207,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -216,6 +225,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -233,13 +243,7 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -258,6 +262,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -267,11 +272,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -296,7 +302,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13-final" + "version": "3.10.12" }, "vscode": { "interpreter": { @@ -306,4 +312,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/notebooks/algorithms/community/ktruss.ipynb b/notebooks/algorithms/community/ktruss.ipynb index 3c96f7ff5a7..cb838e304c3 100644 --- a/notebooks/algorithms/community/ktruss.ipynb +++ b/notebooks/algorithms/community/ktruss.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -15,6 +16,7 @@ "| | 08/05/2021 | tested/updated | 21.10 nightly | RTX 3090 CUDA 11.4 |\n", "| Don Acosta | 07/08/2022 | tested/updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", "| Ralph Liu | 07/26/2022 | updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", + "| | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "## Introduction\n", "\n", "Compute the k-truss of the graph G. A K-Truss is a relaxed cliques where every vertex is supported by at least k-2 triangle.\n", @@ -37,6 +39,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -59,6 +62,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -70,6 +74,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -83,6 +88,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -100,10 +106,11 @@ "import cudf\n", "\n", "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -117,7 +124,7 @@ "outputs": [], "source": [ "# Create a graph using the imported Dataset object\n", - "G = karate.get_graph(fetch=True)\n", + "G = karate.get_graph(download=True)\n", "G = G.to_undirected()" ] }, @@ -133,6 +140,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -161,6 +169,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -200,6 +209,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -229,11 +239,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -258,7 +269,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/components/ConnectedComponents.ipynb b/notebooks/algorithms/components/ConnectedComponents.ipynb index 5f18352647f..c41a004e704 100755 --- a/notebooks/algorithms/components/ConnectedComponents.ipynb +++ b/notebooks/algorithms/components/ConnectedComponents.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -22,6 +23,7 @@ "| Brad Rees | 10/18/2021 | updated | 21.12 nightly | GV100, CUDA 11.4 |\n", "| Ralph Liu | 06/22/2022 | updated/tested | 22.08 | TV100, CUDA 11.5 |\n", "| Don Acosta | 07/22/2021 | updated | 22.08 nightly | DGX Tesla V100, CUDA 11.5 |\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "\n", "\n", @@ -90,6 +92,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -100,6 +103,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -129,6 +133,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -141,10 +146,11 @@ "metadata": {}, "outputs": [], "source": [ - "from cugraph.experimental.datasets import netscience" + "from cugraph.datasets import netscience" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -157,10 +163,11 @@ "metadata": {}, "outputs": [], "source": [ - "G = netscience.get_graph(fetch=True)" + "G = netscience.get_graph(download=True)" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -179,6 +186,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -199,6 +207,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -220,6 +229,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -243,6 +253,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -261,6 +272,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -280,6 +292,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -300,6 +313,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -323,6 +337,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -333,11 +348,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -362,7 +378,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/cores/core-number.ipynb b/notebooks/algorithms/cores/core-number.ipynb index 06fe570d390..cbb3e64311a 100755 --- a/notebooks/algorithms/cores/core-number.ipynb +++ b/notebooks/algorithms/cores/core-number.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -17,6 +18,7 @@ "| Brad Rees | 10/28/2019 | created | 0.13 | GV100, CUDA 10.2 |\n", "| Don Acosta | 07/21/2022 | updated/tested | 22.08 nightly | DGX Tesla V100, CUDA 11.5 |\n", "| Ralph Liu | 07/26/2022 | updated/tested | 22.08 nightly | DGX Tesla V100, CUDA 11.5 |\n", + "| | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "## Introduction\n", "\n", @@ -41,6 +43,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -51,6 +54,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -64,6 +68,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -81,10 +86,11 @@ "import cudf\n", "\n", "# import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -97,11 +103,12 @@ "metadata": {}, "outputs": [], "source": [ - "G = karate.get_graph(fetch=True)\n", + "G = karate.get_graph(download=True)\n", "G = G.to_undirected()" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -128,11 +135,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -157,7 +165,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/cores/kcore.ipynb b/notebooks/algorithms/cores/kcore.ipynb index 065f02ffd98..ebb9cbe9c50 100755 --- a/notebooks/algorithms/cores/kcore.ipynb +++ b/notebooks/algorithms/cores/kcore.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -18,6 +19,7 @@ "| Brad Rees | 08/16/2020 | created | 0.15 | GV100, CUDA 10.2 |\n", "| Don Acosta | 07/21/2022 | updated/tested | 22.08 nightly | DGX Tesla V100, CUDA 11.5 |\n", "| Ralph Liu | 07/26/2022 | updated/tested | 22.08 nightly | DGX Tesla V100, CUDA 11.5 |\n", + "| | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "## Introduction\n", "\n", @@ -41,6 +43,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -51,6 +54,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -64,6 +68,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -72,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -81,10 +86,11 @@ "import cudf\n", "\n", "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -93,29 +99,19 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "G = karate.get_graph(fetch=True)\n", + "G = karate.get_graph(download=True)\n", "G = G.to_undirected()" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Main Graph\n", - "\tNumber of Vertices: 34\n", - "\tNumber of Edges: 156\n" - ] - } - ], + "outputs": [], "source": [ "print(\"Main Graph\")\n", "print(\"\\tNumber of Vertices: \" + str(G.number_of_vertices()))\n", @@ -123,6 +119,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -131,25 +128,9 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "ename": "RuntimeError", - "evalue": "non-success value returned from cugraph_core_number: CUGRAPH_UNKNOWN_ERROR", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m/home/nfs/ralphl/datasets-api/notebooks/algorithms/cores/kcore.ipynb Cell 10\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[39m# Call k-cores on the graph\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m kcg \u001b[39m=\u001b[39m cugraph\u001b[39m.\u001b[39;49mk_core(G)\n", - "File \u001b[0;32m~/miniconda3/envs/cugraph_dev/lib/python3.9/site-packages/cugraph-22.2.0a0+366.gabd2f0ef-py3.9-linux-x86_64.egg/cugraph/cores/k_core.py:103\u001b[0m, in \u001b[0;36mk_core\u001b[0;34m(G, k, core_number)\u001b[0m\n\u001b[1;32m 99\u001b[0m core_number \u001b[39m=\u001b[39m G\u001b[39m.\u001b[39madd_internal_vertex_id(core_number, \u001b[39m'\u001b[39m\u001b[39mvertex\u001b[39m\u001b[39m'\u001b[39m,\n\u001b[1;32m 100\u001b[0m cols)\n\u001b[1;32m 102\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m--> 103\u001b[0m core_number \u001b[39m=\u001b[39m _call_plc_core_number(G)\n\u001b[1;32m 104\u001b[0m core_number \u001b[39m=\u001b[39m core_number\u001b[39m.\u001b[39mrename(\n\u001b[1;32m 105\u001b[0m columns\u001b[39m=\u001b[39m{\u001b[39m\"\u001b[39m\u001b[39mcore_number\u001b[39m\u001b[39m\"\u001b[39m: \u001b[39m\"\u001b[39m\u001b[39mvalues\u001b[39m\u001b[39m\"\u001b[39m}, copy\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m\n\u001b[1;32m 106\u001b[0m )\n\u001b[1;32m 108\u001b[0m \u001b[39mif\u001b[39;00m k \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n", - "File \u001b[0;32m~/miniconda3/envs/cugraph_dev/lib/python3.9/site-packages/cugraph-22.2.0a0+366.gabd2f0ef-py3.9-linux-x86_64.egg/cugraph/cores/k_core.py:27\u001b[0m, in \u001b[0;36m_call_plc_core_number\u001b[0;34m(G)\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m_call_plc_core_number\u001b[39m(G):\n\u001b[1;32m 26\u001b[0m vertex, core_number \u001b[39m=\u001b[39m \\\n\u001b[0;32m---> 27\u001b[0m pylibcugraph_core_number(\n\u001b[1;32m 28\u001b[0m resource_handle\u001b[39m=\u001b[39;49mResourceHandle(),\n\u001b[1;32m 29\u001b[0m graph\u001b[39m=\u001b[39;49mG\u001b[39m.\u001b[39;49m_plc_graph,\n\u001b[1;32m 30\u001b[0m degree_type\u001b[39m=\u001b[39;49m\u001b[39mNone\u001b[39;49;00m,\n\u001b[1;32m 31\u001b[0m do_expensive_check\u001b[39m=\u001b[39;49m\u001b[39mFalse\u001b[39;49;00m\n\u001b[1;32m 32\u001b[0m )\n\u001b[1;32m 34\u001b[0m df \u001b[39m=\u001b[39m cudf\u001b[39m.\u001b[39mDataFrame()\n\u001b[1;32m 35\u001b[0m df[\u001b[39m\"\u001b[39m\u001b[39mvertex\u001b[39m\u001b[39m\"\u001b[39m] \u001b[39m=\u001b[39m vertex\n", - "File \u001b[0;32mcore_number.pyx:124\u001b[0m, in \u001b[0;36mpylibcugraph.core_number.core_number\u001b[0;34m()\u001b[0m\n", - "File \u001b[0;32mutils.pyx:51\u001b[0m, in \u001b[0;36mpylibcugraph.utils.assert_success\u001b[0;34m()\u001b[0m\n", - "\u001b[0;31mRuntimeError\u001b[0m: non-success value returned from cugraph_core_number: CUGRAPH_UNKNOWN_ERROR" - ] - } - ], + "outputs": [], "source": [ "# Call k-cores on the graph\n", "kcg = cugraph.k_core(G) " @@ -167,6 +148,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -186,6 +168,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -194,6 +177,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -221,6 +205,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -261,11 +246,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -290,7 +276,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/layout/Force-Atlas2.ipynb b/notebooks/algorithms/layout/Force-Atlas2.ipynb index eaab502f180..f457d3f38fc 100644 --- a/notebooks/algorithms/layout/Force-Atlas2.ipynb +++ b/notebooks/algorithms/layout/Force-Atlas2.ipynb @@ -21,10 +21,18 @@ "| Author Credit | Date | Update | cuGraph Version | Test Hardware |\n", "| -----------------|------------|------------------|-----------------|----------------|\n", "| Hugo Linsenmaier | 11/16/2020 | created | 0.17 | GV100, CUDA 11.0\n", - "| Brad Rees | 01/11/2022 | tested / updated | 22.02 nightly | RTX A6000 48GB CUDA 11.5\n", - "| Ralph Liu | 06/22/2022 | updated/tested | 22.08 nightly | V100, CUDA 11.5\n", + "| Brad Rees | 01/11/2022 | tested / updated | 22.02 nightly | RTX A6000 CUDA 11.5\n", + "| Ralph Liu | 06/22/2022 | updated/tested | 22.08 | TV100, CUDA 11.5\n", "| Don Acosta | 08/01/2022 | tested / updated | 22.08 nightly | DGX Tesla A100 CUDA 11.5 \n", - "| Don Acosta | 07/17/2023 | tested / updated | 23.08 nightly |RTX A6000 48GB CUDA 11.7 " + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### This notebook will not currently run because there is a conflict between the version of CuPy required by cugraph (11.0) and the version supported in cuxfilter (7.8 to 10.0). Notebook will be updated when cuxfilter supports CuPy 11." ] }, { @@ -74,7 +82,23 @@ "outputs": [], "source": [ "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import netscience" + "from cugraph.datasets import netscience" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Setup Viz\n", + "client = Client()\n", + "hv.notebook_extension('bokeh','matplotlib')\n", + "decimate.max_samples=20000\n", + "dynspread.threshold=0.01\n", + "datashade.cmap=fire[40:]\n", + "sz = dict(width=150,height=150)\n", + "%opts RGB [xaxis=None yaxis=None show_grid=False bgcolor=\"black\"]" ] }, { @@ -91,7 +115,7 @@ "metadata": {}, "outputs": [], "source": [ - "G = netscience.get_graph(fetch=True)\n", + "G = netscience.get_graph(download=True)\n", "G.number_of_nodes(), G.number_of_edges()" ] }, @@ -146,6 +170,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -209,6 +234,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/notebooks/algorithms/link_analysis/HITS.ipynb b/notebooks/algorithms/link_analysis/HITS.ipynb index 9578377b747..7e4673ae2a9 100755 --- a/notebooks/algorithms/link_analysis/HITS.ipynb +++ b/notebooks/algorithms/link_analysis/HITS.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -15,6 +16,7 @@ "| | 08/16/2020 | tested / updated | 0.15.1 nightly | RTX 3090 CUDA 11.4\n", "| Ralph Liu | 06/22/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", "| Don Acosta | 07/27/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "## Introduction\n", "HITS, also known as hubs and authorities, computes the relative importance of vertices. \n", @@ -36,6 +38,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -71,6 +74,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -84,6 +88,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -124,6 +129,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -137,10 +143,11 @@ "outputs": [], "source": [ "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -179,6 +186,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -189,6 +197,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -196,6 +205,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -208,10 +218,11 @@ "metadata": {}, "outputs": [], "source": [ - "G = karate.get_graph(fetch=True)" + "G = karate.get_graph(download=True)" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -229,6 +240,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -288,6 +300,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -315,6 +328,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -340,11 +354,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", diff --git a/notebooks/algorithms/link_analysis/Pagerank.ipynb b/notebooks/algorithms/link_analysis/Pagerank.ipynb index 6b78f5866d9..0e7d5b134a7 100755 --- a/notebooks/algorithms/link_analysis/Pagerank.ipynb +++ b/notebooks/algorithms/link_analysis/Pagerank.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": { "tags": [] @@ -16,6 +17,7 @@ "| | 04/06/2022 | tested / updated | 22.04 nightly | GV100 32G, CUDA 11.5\n", "| Ralph Liu | 06/22/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", "| Don Acosta | 07/27/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "## Introduction\n", "Pagerank is measure of the relative importance, also called centrality, of a vertex based on the relative importance of it's neighbors. PageRank was developed by Google and is (was) used to rank it's search results. PageRank uses the connectivity information of a graph to rank the importance of each vertex. \n", @@ -43,6 +45,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -56,6 +59,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -99,6 +103,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -124,10 +129,11 @@ "outputs": [], "source": [ "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -166,6 +172,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -176,6 +183,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -183,6 +191,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -195,10 +204,11 @@ "metadata": {}, "outputs": [], "source": [ - "G = karate.get_graph(fetch=True)" + "G = karate.get_graph(download=True)" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -216,6 +226,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -248,6 +259,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -288,6 +300,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -317,6 +330,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -343,6 +357,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -350,6 +365,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -358,6 +374,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -406,11 +423,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", diff --git a/notebooks/algorithms/link_prediction/Jaccard-Similarity.ipynb b/notebooks/algorithms/link_prediction/Jaccard-Similarity.ipynb index 64255868cbc..1e6cd032650 100755 --- a/notebooks/algorithms/link_prediction/Jaccard-Similarity.ipynb +++ b/notebooks/algorithms/link_prediction/Jaccard-Similarity.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -18,10 +19,12 @@ "| Author Credit | Date | Update | cuGraph Version | Test Hardware |\n", "| --------------|------------|------------------|-----------------|-----------------------|\n", "| Brad Rees | 10/14/2019 | created | 0.14 | GV100 32 GB, CUDA 10.2 |\n", - "| Don Acosta | 07/20/2022 | tested/updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |" + "| Don Acosta | 07/20/2022 | tested/updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -34,6 +37,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -41,6 +45,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -69,6 +74,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -77,6 +83,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -111,6 +118,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -119,6 +127,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -129,6 +138,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -143,6 +153,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -165,6 +176,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -212,6 +224,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -226,8 +239,8 @@ "outputs": [], "source": [ "# Test file \n", - "from cugraph.experimental.datasets import karate\n", - "gdf = karate.get_edgelist(fetch=True)" + "from cugraph.datasets import karate\n", + "gdf = karate.get_edgelist(download=True)" ] }, { @@ -251,6 +264,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -269,6 +283,17 @@ ] }, { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# How many vertices are in the graph? Remember that Graph is zero based\n", + "G.number_of_vertices()" + ] + }, + { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -280,6 +305,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -311,6 +337,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -346,6 +373,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -384,6 +412,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -391,6 +420,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -398,6 +428,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -425,6 +456,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -452,6 +484,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/notebooks/algorithms/link_prediction/Overlap-Similarity.ipynb b/notebooks/algorithms/link_prediction/Overlap-Similarity.ipynb index f99e34f2224..97f3874681b 100755 --- a/notebooks/algorithms/link_prediction/Overlap-Similarity.ipynb +++ b/notebooks/algorithms/link_prediction/Overlap-Similarity.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -18,10 +19,12 @@ "| | 08/16/2020 | upadated | 0.12 | GV100, CUDA 10.0 |\n", "| | 08/05/2021 | tested / updated | 21.10 nightly | RTX 3090 CUDA 11.4 |\n", "| Ralph Liu | 06/22/2022 | updated/tested | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", - "| Don Acosta | 08/03/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |" + "| Don Acosta | 08/03/2022 | tested / updated | 22.08 nightly | DGX Tesla V100 CUDA 11.5 |\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -34,6 +37,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -42,6 +46,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -67,6 +72,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -94,6 +100,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -103,6 +110,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -114,6 +122,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -129,6 +138,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -150,6 +160,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -236,6 +247,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -248,8 +260,8 @@ "metadata": {}, "outputs": [], "source": [ - "from cugraph.experimental.datasets import karate\n", - "gdf = karate.get_edgelist(fetch=True)" + "from cugraph.datasets import karate\n", + "gdf = karate.get_edgelist(download=True)" ] }, { @@ -273,6 +285,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -301,6 +314,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -330,6 +344,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -365,6 +380,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -373,6 +389,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -415,6 +432,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -422,6 +440,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -471,6 +490,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -478,6 +498,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -564,6 +585,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/notebooks/algorithms/link_prediction/Sorensen_coefficient.ipynb b/notebooks/algorithms/link_prediction/Sorensen_coefficient.ipynb index 75cb54dced6..5281f69d5dc 100755 --- a/notebooks/algorithms/link_prediction/Sorensen_coefficient.ipynb +++ b/notebooks/algorithms/link_prediction/Sorensen_coefficient.ipynb @@ -158,7 +158,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Use the cuGraph Datasets api to get the dataframe containing edge data\n" + "### Use the cuGraph Datasets API to get the dataframe containing edge data\n" ] }, { @@ -168,8 +168,8 @@ "outputs": [], "source": [ "# Test file \n", - "from cugraph.experimental.datasets import karate\n", - "gdf = karate.get_edgelist(fetch=True)" + "from cugraph.datasets import karate\n", + "gdf = karate.get_edgelist(download=True)" ] }, { diff --git a/notebooks/algorithms/sampling/RandomWalk.ipynb b/notebooks/algorithms/sampling/RandomWalk.ipynb index 687e55c0b16..011346a93af 100644 --- a/notebooks/algorithms/sampling/RandomWalk.ipynb +++ b/notebooks/algorithms/sampling/RandomWalk.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -14,11 +15,13 @@ "| Brad Rees | 04/20/2021 | created | 0.19 | GV100, CUDA 11.0\n", "| Ralph Liu | 06/22/2022 | updated/tested | 22.08 | TV100, CUDA 11.5\n", "| Don Acosta | 08/28/2022 | updated/tested | 22.10 | TV100, CUDA 11.5\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "Currently NetworkX does not have a random walk function. There is code on StackOverflow that generates a random walk by getting a vertex and then randomly selecting a neighbor and then repeating the process. " ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -45,7 +48,7 @@ "import cudf\n", "\n", "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate" + "from cugraph.datasets import karate" ] }, { @@ -54,7 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "gdf = karate.get_edgelist(fetch=True)" + "gdf = karate.get_edgelist(download=True)" ] }, { @@ -117,6 +120,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -153,11 +157,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "-----\n", - "Copyright (c) 2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2022-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -191,4 +196,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/notebooks/algorithms/structure/Renumber-2.ipynb b/notebooks/algorithms/structure/Renumber-2.ipynb index 6a52632b38a..479df53c6be 100755 --- a/notebooks/algorithms/structure/Renumber-2.ipynb +++ b/notebooks/algorithms/structure/Renumber-2.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -20,6 +21,7 @@ "| Brad Rees | 07/08/2020 | updated | 0.15 | GV100, CUDA 11.0\n", "| Ralph Liu | 06/22/2022 | docs & code change | 22.08 | TV100, CUDA 11.5\n", "| Don Acosta | 08/28/2022 | updated/tested | 22.10 | TV100, CUDA 11.5\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "\n", "## Introduction\n", @@ -42,6 +44,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -50,6 +53,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -77,11 +81,12 @@ "outputs": [], "source": [ "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import cyber\n", - "gdf = cyber.get_edgelist(fetch=True)" + "from cugraph.datasets import cyber\n", + "gdf = cyber.get_edgelist(download=True)" ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -128,6 +133,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -137,6 +143,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -170,6 +177,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -192,6 +200,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -214,11 +223,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -253,4 +263,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/notebooks/algorithms/structure/Renumber.ipynb b/notebooks/algorithms/structure/Renumber.ipynb index 13b1eeba074..b6cca6591d7 100755 --- a/notebooks/algorithms/structure/Renumber.ipynb +++ b/notebooks/algorithms/structure/Renumber.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -36,6 +37,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -59,6 +61,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -88,6 +91,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -113,6 +117,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -139,6 +144,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -159,6 +165,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -177,6 +184,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -206,6 +214,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -235,6 +244,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -257,6 +267,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -288,6 +299,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -319,11 +331,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -358,4 +371,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/notebooks/algorithms/structure/Symmetrize.ipynb b/notebooks/algorithms/structure/Symmetrize.ipynb index 0357a2737b1..5d5b270708a 100755 --- a/notebooks/algorithms/structure/Symmetrize.ipynb +++ b/notebooks/algorithms/structure/Symmetrize.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -14,6 +15,7 @@ "| Brad Rees and James Wyles | 08/13/2019 | created | 0.10 | GV100, CUDA 11.0\n", "| Brad Rees | 06/22/2020 | updated | 0.15 | GV100, CUDA 11.0\n", "| Don Acosta | 08/28/2022 | updated/tested | 22.10 | TV100, CUDA 11.5\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "\n", "## Introduction\n", @@ -35,6 +37,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -77,10 +80,10 @@ "outputs": [], "source": [ "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate\n", + "from cugraph.datasets import karate\n", "\n", "# This is the symmetrized dataset\n", - "test_gdf = karate.get_edgelist(fetch=True)" + "test_gdf = karate.get_edgelist(download=True)" ] }, { @@ -96,6 +99,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -126,6 +130,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -156,11 +161,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "---\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", diff --git a/notebooks/algorithms/traversal/BFS.ipynb b/notebooks/algorithms/traversal/BFS.ipynb index 7c4b87f30c3..4339ce26a70 100755 --- a/notebooks/algorithms/traversal/BFS.ipynb +++ b/notebooks/algorithms/traversal/BFS.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -14,6 +15,7 @@ "| Brad Rees and James Wyles | 08/13/2019 | created | 0.10 | GV100, CUDA 11.0\n", "| Ralph Liu | 06/22/2020 | updated | 22.08 | GV100, CUDA 11.0\n", "| Don Acosta | 08/28/2022 | updated/tested | 22.10 | TV100, CUDA 11.5\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "## Introduction\n", "\n", @@ -44,6 +46,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -86,6 +89,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -99,9 +103,9 @@ "outputs": [], "source": [ "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate\n", + "from cugraph.datasets import karate\n", "\n", - "gdf = karate.get_edgelist(fetch=True)" + "gdf = karate.get_edgelist(download=True)" ] }, { @@ -115,6 +119,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -172,6 +177,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -200,6 +206,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -248,11 +255,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", @@ -277,7 +285,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.12" }, "vscode": { "interpreter": { diff --git a/notebooks/algorithms/traversal/SSSP.ipynb b/notebooks/algorithms/traversal/SSSP.ipynb index 0b5ff3d0932..4889ab399e8 100755 --- a/notebooks/algorithms/traversal/SSSP.ipynb +++ b/notebooks/algorithms/traversal/SSSP.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -14,6 +15,7 @@ "| Brad Rees and James Wyles | 08/13/2019 | created | 0.10 | GV100, CUDA 11.0\n", "| Ralph Liu | 06/22/2022 | updated | 22.08 | GV100, CUDA 11.0\n", "| Don Acosta | 08/28/2022 | updated/tested | 22.10 | TV100, CUDA 11.5\n", + "| Ralph Liu | 06/29/2023 | updated | 23.08 nightly | DGX Tesla V100 CUDA 12.0\n", "\n", "## Introduction\n", "\n", @@ -41,6 +43,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -68,6 +71,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -81,9 +85,9 @@ "outputs": [], "source": [ "# Import a built-in dataset\n", - "from cugraph.experimental.datasets import karate\n", + "from cugraph.datasets import karate\n", "\n", - "gdf = karate.get_edgelist(fetch=True)" + "gdf = karate.get_edgelist(download=True)" ] }, { @@ -106,6 +110,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -147,6 +152,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -154,11 +160,12 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "___\n", - "Copyright (c) 2019-2022, NVIDIA CORPORATION.\n", + "Copyright (c) 2019-2023, NVIDIA CORPORATION.\n", "\n", "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n", "\n", diff --git a/python/cugraph/cugraph/__init__.py b/python/cugraph/cugraph/__init__.py index 3b9c4e007e2..4be27991823 100644 --- a/python/cugraph/cugraph/__init__.py +++ b/python/cugraph/cugraph/__init__.py @@ -120,4 +120,6 @@ from cugraph import exceptions +from cugraph import datasets + __version__ = "23.08.00" diff --git a/python/cugraph/cugraph/centrality/betweenness_centrality.py b/python/cugraph/cugraph/centrality/betweenness_centrality.py index 63af410e06c..80ad2e630bd 100644 --- a/python/cugraph/cugraph/centrality/betweenness_centrality.py +++ b/python/cugraph/cugraph/centrality/betweenness_centrality.py @@ -120,8 +120,8 @@ def betweenness_centrality( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> bc = cugraph.betweenness_centrality(G) """ @@ -283,8 +283,8 @@ def edge_betweenness_centrality( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> bc = cugraph.edge_betweenness_centrality(G) """ diff --git a/python/cugraph/cugraph/centrality/degree_centrality.py b/python/cugraph/cugraph/centrality/degree_centrality.py index 66946afded2..12d39f4127e 100644 --- a/python/cugraph/cugraph/centrality/degree_centrality.py +++ b/python/cugraph/cugraph/centrality/degree_centrality.py @@ -45,8 +45,8 @@ def degree_centrality(G, normalized=True): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 07cbfefaaf1..6be797096fc 100644 --- a/python/cugraph/cugraph/centrality/eigenvector_centrality.py +++ b/python/cugraph/cugraph/centrality/eigenvector_centrality.py @@ -68,8 +68,8 @@ def eigenvector_centrality(G, max_iter=100, tol=1.0e-6): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 ffede18b5d2..d902f9b06c9 100644 --- a/python/cugraph/cugraph/centrality/katz_centrality.py +++ b/python/cugraph/cugraph/centrality/katz_centrality.py @@ -105,8 +105,8 @@ def katz_centrality( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> kc = cugraph.katz_centrality(G) """ diff --git a/python/cugraph/cugraph/community/ecg.py b/python/cugraph/cugraph/community/ecg.py index e59f3dcb1b7..fbf8df43867 100644 --- a/python/cugraph/cugraph/community/ecg.py +++ b/python/cugraph/cugraph/community/ecg.py @@ -65,8 +65,8 @@ def ecg(input_graph, min_weight=0.05, ensemble_size=16, weight=None): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> parts = cugraph.ecg(G) """ diff --git a/python/cugraph/cugraph/community/egonet.py b/python/cugraph/cugraph/community/egonet.py index 684ae92febd..01bbc41d8cd 100644 --- a/python/cugraph/cugraph/community/egonet.py +++ b/python/cugraph/cugraph/community/egonet.py @@ -86,8 +86,8 @@ def ego_graph(G, n, radius=1, center=True, undirected=None, distance=None): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> ego_graph = cugraph.ego_graph(G, 1, radius=2) """ @@ -190,8 +190,8 @@ def batched_ego_graphs(G, seeds, radius=1, center=True, undirected=None, distanc Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> b_ego_graph, offsets = cugraph.batched_ego_graphs(G, seeds=[1,5], ... radius=2) diff --git a/python/cugraph/cugraph/community/induced_subgraph.py b/python/cugraph/cugraph/community/induced_subgraph.py index d82e9d466a8..29fe2f29c1e 100644 --- a/python/cugraph/cugraph/community/induced_subgraph.py +++ b/python/cugraph/cugraph/community/induced_subgraph.py @@ -91,8 +91,8 @@ def induced_subgraph( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> verts = np.zeros(3, dtype=np.int32) >>> verts[0] = 0 >>> verts[1] = 1 diff --git a/python/cugraph/cugraph/community/ktruss_subgraph.py b/python/cugraph/cugraph/community/ktruss_subgraph.py index 134df98f496..0ebbe633317 100644 --- a/python/cugraph/cugraph/community/ktruss_subgraph.py +++ b/python/cugraph/cugraph/community/ktruss_subgraph.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2022, NVIDIA CORPORATION. +# Copyright (c) 2019-2023, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -69,8 +69,8 @@ def k_truss(G, k): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> k_subgraph = cugraph.k_truss(G, 3) """ @@ -150,8 +150,8 @@ def ktruss_subgraph(G, k, use_weights=True): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 1caa5476623..d2a1a413d7b 100644 --- a/python/cugraph/cugraph/community/leiden.py +++ b/python/cugraph/cugraph/community/leiden.py @@ -94,8 +94,8 @@ def leiden( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> parts, modularity_score = cugraph.leiden(G) """ diff --git a/python/cugraph/cugraph/community/louvain.py b/python/cugraph/cugraph/community/louvain.py index a313aa44048..35ca864824f 100644 --- a/python/cugraph/cugraph/community/louvain.py +++ b/python/cugraph/cugraph/community/louvain.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2022, NVIDIA CORPORATION. +# Copyright (c) 2019-2023, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -69,8 +69,8 @@ def louvain(G, max_iter=100, resolution=1.0): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> parts = cugraph.louvain(G) """ diff --git a/python/cugraph/cugraph/community/spectral_clustering.py b/python/cugraph/cugraph/community/spectral_clustering.py index 5116d4c8fdf..864c1005d20 100644 --- a/python/cugraph/cugraph/community/spectral_clustering.py +++ b/python/cugraph/cugraph/community/spectral_clustering.py @@ -81,8 +81,8 @@ def spectralBalancedCutClustering( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.spectralBalancedCutClustering(G, 5) """ @@ -178,8 +178,8 @@ def spectralModularityMaximizationClustering( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.spectralModularityMaximizationClustering(G, 5) """ @@ -254,8 +254,8 @@ def analyzeClustering_modularity( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.spectralBalancedCutClustering(G, 5) >>> score = cugraph.analyzeClustering_modularity(G, 5, df) @@ -336,8 +336,8 @@ def analyzeClustering_edge_cut( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.spectralBalancedCutClustering(G, 5) >>> score = cugraph.analyzeClustering_edge_cut(G, 5, df) @@ -416,8 +416,8 @@ def analyzeClustering_ratio_cut( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 601b6365e5d..77b28d4daff 100644 --- a/python/cugraph/cugraph/community/subgraph_extraction.py +++ b/python/cugraph/cugraph/community/subgraph_extraction.py @@ -57,8 +57,8 @@ def subgraph( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> verts = np.zeros(3, dtype=np.int32) >>> verts[0] = 0 >>> verts[1] = 1 diff --git a/python/cugraph/cugraph/components/connectivity.py b/python/cugraph/cugraph/components/connectivity.py index e235c6c92d4..45dba37d2ce 100644 --- a/python/cugraph/cugraph/components/connectivity.py +++ b/python/cugraph/cugraph/components/connectivity.py @@ -169,8 +169,8 @@ def weakly_connected_components(G, directed=None, connection=None, return_labels Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.weakly_connected_components(G) """ @@ -278,8 +278,8 @@ def strongly_connected_components( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.strongly_connected_components(G) """ @@ -387,8 +387,8 @@ def connected_components(G, directed=None, connection="weak", return_labels=None Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 84153632f58..3e6cbe0d96f 100644 --- a/python/cugraph/cugraph/cores/core_number.py +++ b/python/cugraph/cugraph/cores/core_number.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2022, NVIDIA CORPORATION. +# Copyright (c) 2019-2023, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -55,8 +55,8 @@ def core_number(G, degree_type="bidirectional"): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 b1cc796a7dd..3dbc1cfa377 100644 --- a/python/cugraph/cugraph/cores/k_core.py +++ b/python/cugraph/cugraph/cores/k_core.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2022, NVIDIA CORPORATION. +# Copyright (c) 2019-2023, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -82,8 +82,8 @@ def k_core(G, k=None, core_number=None, degree_type="bidirectional"): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> KCoreGraph = cugraph.k_core(G) """ diff --git a/python/cugraph/cugraph/datasets/__init__.py b/python/cugraph/cugraph/datasets/__init__.py new file mode 100644 index 00000000000..7ba274c5960 --- /dev/null +++ b/python/cugraph/cugraph/datasets/__init__.py @@ -0,0 +1,40 @@ +# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from pathlib import Path + +# datasets module +from cugraph.datasets.dataset import ( + Dataset, + download_all, + set_download_dir, + get_download_dir, + default_download_dir, +) +from cugraph.datasets import metadata + +# metadata path for .yaml files +meta_path = Path(__file__).parent / "metadata" + +cyber = Dataset(meta_path / "cyber.yaml") +dolphins = Dataset(meta_path / "dolphins.yaml") +email_Eu_core = Dataset(meta_path / "email_Eu_core.yaml") +karate = Dataset(meta_path / "karate.yaml") +karate_asymmetric = Dataset(meta_path / "karate_asymmetric.yaml") +karate_disjoint = Dataset(meta_path / "karate_disjoint.yaml") +netscience = Dataset(meta_path / "netscience.yaml") +polbooks = Dataset(meta_path / "polbooks.yaml") +small_line = Dataset(meta_path / "small_line.yaml") +small_tree = Dataset(meta_path / "small_tree.yaml") +toy_graph = Dataset(meta_path / "toy_graph.yaml") +toy_graph_undirected = Dataset(meta_path / "toy_graph_undirected.yaml") diff --git a/python/cugraph/cugraph/datasets/dataset.py b/python/cugraph/cugraph/datasets/dataset.py new file mode 100644 index 00000000000..229d0fda632 --- /dev/null +++ b/python/cugraph/cugraph/datasets/dataset.py @@ -0,0 +1,312 @@ +# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import cudf +import yaml +import os +from pathlib import Path +from cugraph.structure.graph_classes import Graph + + +class DefaultDownloadDir: + """ + Maintains the path to the download directory used by Dataset instances. + Instances of this class are typically shared by several Dataset instances + in order to allow for the download directory to be defined and updated by + a single object. + """ + + def __init__(self): + self._path = Path( + os.environ.get("RAPIDS_DATASET_ROOT_DIR", Path.home() / ".cugraph/datasets") + ) + + @property + def path(self): + """ + If `path` is not set, set it to the environment variable + RAPIDS_DATASET_ROOT_DIR. If the variable is not set, default to the + user's home directory. + """ + if self._path is None: + self._path = Path( + os.environ.get( + "RAPIDS_DATASET_ROOT_DIR", Path.home() / ".cugraph/datasets" + ) + ) + return self._path + + @path.setter + def path(self, new): + self._path = Path(new) + + def clear(self): + self._path = None + + +default_download_dir = DefaultDownloadDir() + + +class Dataset: + """ + A Dataset Object, used to easily import edgelist data and cuGraph.Graph + instances. + + Parameters + ---------- + meta_data_file_name : yaml file + The metadata file for the specific graph dataset, which includes + information on the name, type, url link, data loading format, graph + properties + """ + + def __init__( + self, + metadata_yaml_file=None, + csv_file=None, + csv_header=None, + csv_delim=" ", + csv_col_names=None, + csv_col_dtypes=None, + ): + self._metadata_file = None + self._dl_path = default_download_dir + self._edgelist = None + self._path = None + + if metadata_yaml_file is not None and csv_file is not None: + raise ValueError("cannot specify both metadata_yaml_file and csv_file") + + elif metadata_yaml_file is not None: + with open(metadata_yaml_file, "r") as file: + self.metadata = yaml.safe_load(file) + self._metadata_file = Path(metadata_yaml_file) + + elif csv_file is not None: + if csv_col_names is None or csv_col_dtypes is None: + raise ValueError( + "csv_col_names and csv_col_dtypes must both be " + "not None when csv_file is specified." + ) + self._path = Path(csv_file) + if self._path.exists() is False: + raise FileNotFoundError(csv_file) + self.metadata = { + "name": self._path.with_suffix("").name, + "file_type": ".csv", + "url": None, + "header": csv_header, + "delim": csv_delim, + "col_names": csv_col_names, + "col_types": csv_col_dtypes, + } + + else: + raise ValueError("must specify either metadata_yaml_file or csv_file") + + def __str__(self): + """ + Use the basename of the meta_data_file the instance was constructed with, + without any extension, as the string repr. + """ + # The metadata file is likely to have a more descriptive file name, so + # use that one first if present. + # FIXME: this may need to provide a more unique or descriptive string repr + if self._metadata_file is not None: + return self._metadata_file.with_suffix("").name + else: + return self.get_path().with_suffix("").name + + def __download_csv(self, url): + """ + Downloads the .csv file from url to the current download path + (self._dl_path), updates self._path with the full path to the + downloaded file, and returns the latest value of self._path. + """ + self._dl_path.path.mkdir(parents=True, exist_ok=True) + + filename = self.metadata["name"] + self.metadata["file_type"] + if self._dl_path.path.is_dir(): + df = cudf.read_csv(url) + self._path = self._dl_path.path / filename + df.to_csv(self._path, index=False) + + else: + raise RuntimeError( + f"The directory {self._dl_path.path.absolute()}" "does not exist" + ) + return self._path + + def unload(self): + + """ + Remove all saved internal objects, forcing them to be re-created when + accessed. + + NOTE: This will cause calls to get_*() to re-read the dataset file from + disk. The caller should ensure the file on disk has not moved/been + deleted/changed. + """ + self._edgelist = None + + def get_edgelist(self, download=False): + """ + Return an Edgelist + + Parameters + ---------- + download : Boolean (default=False) + Automatically download the dataset from the 'url' location within + the YAML file. + """ + if self._edgelist is None: + full_path = self.get_path() + if not full_path.is_file(): + if download: + full_path = self.__download_csv(self.metadata["url"]) + else: + raise RuntimeError( + f"The datafile {full_path} does not" + " exist. Try setting download=True" + " to download the datafile" + ) + header = None + if isinstance(self.metadata["header"], int): + header = self.metadata["header"] + self._edgelist = cudf.read_csv( + full_path, + delimiter=self.metadata["delim"], + names=self.metadata["col_names"], + dtype=self.metadata["col_types"], + header=header, + ) + + return self._edgelist + + def get_graph( + self, + download=False, + create_using=Graph, + ignore_weights=False, + store_transposed=False, + ): + """ + Return a Graph object. + + Parameters + ---------- + download : Boolean (default=False) + Downloads the dataset from the web. + + create_using: cugraph.Graph (instance or class), optional + (default=Graph) + Specify the type of Graph to create. Can pass in an instance to + create a Graph instance with specified 'directed' attribute. + + ignore_weights : Boolean (default=False) + Ignores weights in the dataset if True, resulting in an + unweighted Graph. If False (the default), weights from the + dataset -if present- will be applied to the Graph. If the + dataset does not contain weights, the Graph returned will + be unweighted regardless of ignore_weights. + """ + if self._edgelist is None: + self.get_edgelist(download) + + if create_using is None: + G = Graph() + elif isinstance(create_using, Graph): + # what about BFS if trnaposed is True + attrs = {"directed": create_using.is_directed()} + G = type(create_using)(**attrs) + elif type(create_using) is type: + G = create_using() + else: + raise TypeError( + "create_using must be a cugraph.Graph " + "(or subclass) type or instance, got: " + f"{type(create_using)}" + ) + + if len(self.metadata["col_names"]) > 2 and not (ignore_weights): + G.from_cudf_edgelist( + self._edgelist, + source="src", + destination="dst", + edge_attr="wgt", + store_transposed=store_transposed, + ) + else: + G.from_cudf_edgelist( + self._edgelist, + source="src", + destination="dst", + store_transposed=store_transposed, + ) + return G + + def get_path(self): + """ + Returns the location of the stored dataset file + """ + if self._path is None: + self._path = self._dl_path.path / ( + self.metadata["name"] + self.metadata["file_type"] + ) + + return self._path.absolute() + + +def download_all(force=False): + """ + Looks in `metadata` directory and downloads all datafiles from the the URLs + provided in each YAML file. + + Parameters + force : Boolean (default=False) + Overwrite any existing copies of datafiles. + """ + default_download_dir.path.mkdir(parents=True, exist_ok=True) + + meta_path = Path(__file__).parent.absolute() / "metadata" + for file in meta_path.iterdir(): + meta = None + if file.suffix == ".yaml": + with open(meta_path / file, "r") as metafile: + meta = yaml.safe_load(metafile) + + if "url" in meta: + filename = meta["name"] + meta["file_type"] + save_to = default_download_dir.path / filename + if not save_to.is_file() or force: + df = cudf.read_csv(meta["url"]) + df.to_csv(save_to, index=False) + + +def set_download_dir(path): + """ + Set the download location fors datasets + + Parameters + ---------- + path : String + Location used to store datafiles + """ + if path is None: + default_download_dir.clear() + else: + default_download_dir.path = path + + +def get_download_dir(): + return default_download_dir.path.absolute() diff --git a/python/cugraph/cugraph/datasets/datasets_config.yaml b/python/cugraph/cugraph/datasets/datasets_config.yaml new file mode 100644 index 00000000000..69a79db9cd9 --- /dev/null +++ b/python/cugraph/cugraph/datasets/datasets_config.yaml @@ -0,0 +1,5 @@ +--- +fetch: "False" +force: "False" +# path where datasets will be downloaded to and stored +download_dir: "datasets" diff --git a/python/cugraph/cugraph/datasets/metadata/__init__.py b/python/cugraph/cugraph/datasets/metadata/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/python/cugraph/cugraph/datasets/metadata/cyber.yaml b/python/cugraph/cugraph/datasets/metadata/cyber.yaml new file mode 100644 index 00000000000..09bf26541c7 --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/cyber.yaml @@ -0,0 +1,26 @@ +name: cyber +file_type: .csv +description: + IP edge pairs of a cyber data set from the University of New South Wales. +author: Moustafa, Nour, and Jill Slay +refs: + Moustafa, Nour. Designing an online and reliable statistical anomaly detection + framework for dealing with large high-speed network traffic. Diss. University + of New South Wales, Canberra, Australia, 2017. +delim: "," +header: 0 +col_names: + - idx + - srcip + - dstip +col_types: + - int32 + - str + - str +has_loop: false +is_directed: true +is_multigraph: false +is_symmetric: false +number_of_edges: 2546575 +number_of_nodes: 706529 +url: https://data.rapids.ai/cugraph/datasets/cyber.csv diff --git a/python/cugraph/cugraph/datasets/metadata/dolphins.yaml b/python/cugraph/cugraph/datasets/metadata/dolphins.yaml new file mode 100644 index 00000000000..bc7cb6cd486 --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/dolphins.yaml @@ -0,0 +1,31 @@ +name: dolphins +file_type: .csv +description: An undirected social network of frequent associations between 62 dolphins in a community living off Doubtful Sound, New Zealand, as compiled by Lusseau et al. (2003). +author: + - D. Lusseau + - K. Schneider + - O. J. Boisseau + - P. Haase + - E. Slooten + - S. M. Dawson +refs: + D. Lusseau, K. Schneider, O. J. Boisseau, P. Haase, E. Slooten, and S. M. Dawson, + The bottlenose dolphin community of Doubtful Sound features a large proportion of + long-lasting associations, Behavioral Ecology and Sociobiology 54, 396-405 (2003). +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: false +is_directed: false +is_multigraph: false +is_symmetric: true +number_of_edges: 159 +number_of_nodes: 62 +url: https://data.rapids.ai/cugraph/datasets/dolphins.csv diff --git a/python/cugraph/cugraph/datasets/metadata/email_Eu_core.yaml b/python/cugraph/cugraph/datasets/metadata/email_Eu_core.yaml new file mode 100644 index 00000000000..444a823788b --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/email_Eu_core.yaml @@ -0,0 +1,29 @@ +name: email-Eu-core +file_type: .csv +description: + The network was generated using anonymized email data from a large European + research institution. There is an edge (u, v) in the network if person u sent + person v at least one email. The e-mails only represent communication between + institution members (the core), and the dataset does not contain incoming messages + from or outgoing messages to the rest of the world. +author: Jure Leskovec +refs: + - Hao Yin, Austin R. Benson, Jure Leskovec, and David F. Gleich. 'Local Higher-order Graph Clustering.' In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. 2017. + - J. Leskovec, J. Kleinberg and C. Faloutsos. Graph Evolution. Densification and Shrinking Diameters. ACM Transactions on Knowledge Discovery from Data (ACM TKDD), 1(1), 2007. +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: true +is_directed: true +is_multigraph: false +is_symmetric: false +number_of_edges: 25571 +number_of_nodes: 1005 +url: https://data.rapids.ai/cugraph/datasets/email-Eu-core.csv diff --git a/python/cugraph/cugraph/datasets/metadata/karate.yaml b/python/cugraph/cugraph/datasets/metadata/karate.yaml new file mode 100644 index 00000000000..d10ecb242f5 --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/karate.yaml @@ -0,0 +1,26 @@ +name: karate +file_type: .csv +description: + The graph "karate" contains the network of friendships between the 34 members + of a karate club at a US university, as described by Wayne Zachary in 1977. +author: Zachary W. +refs: + W. W. Zachary, An information flow model for conflict and fission in small groups, + Journal of Anthropological Research 33, 452-473 (1977). +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: false +is_directed: true +is_multigraph: false +is_symmetric: true +number_of_edges: 156 +number_of_nodes: 34 +url: https://data.rapids.ai/cugraph/datasets/karate.csv diff --git a/python/cugraph/cugraph/datasets/metadata/karate_asymmetric.yaml b/python/cugraph/cugraph/datasets/metadata/karate_asymmetric.yaml new file mode 100644 index 00000000000..3b3a1e2478b --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/karate_asymmetric.yaml @@ -0,0 +1,26 @@ +name: karate-asymmetric +file_type: .csv +description: + This is an undirected, asymmetric variant of the Karate dataset. The original dataset, which + this is based on, was created by Wayne Zachary in 1977. +author: Nvidia +refs: + W. W. Zachary, An information flow model for conflict and fission in small + groups, Journal of Anthropological Research 33, 452-473 (1977). +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: false +is_directed: false +is_multigraph: false +is_symmetric: true +number_of_edges: 78 +number_of_nodes: 34 +url: https://data.rapids.ai/cugraph/datasets/karate-asymmetric.csv diff --git a/python/cugraph/cugraph/datasets/metadata/karate_disjoint.yaml b/python/cugraph/cugraph/datasets/metadata/karate_disjoint.yaml new file mode 100644 index 00000000000..40cf59b3cfe --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/karate_disjoint.yaml @@ -0,0 +1,26 @@ +name: karate-disjoint +file_type: .csv +description: + This is disjoint variant of the Karate dataset. The original dataset, which + this is based on, was created by Wayne Zachary in 1977. +author: Nvidia +refs: + W. W. Zachary, An information flow model for conflict and fission in small groups, + Journal of Anthropological Research 33, 452-473 (1977). +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: false +is_directed: true +is_multigraph: false +is_symmetric: true +number_of_edges: 312 +number_of_nodes: 68 +url: https://data.rapids.ai/cugraph/datasets/karate-disjoint.csv diff --git a/python/cugraph/cugraph/datasets/metadata/netscience.yaml b/python/cugraph/cugraph/datasets/metadata/netscience.yaml new file mode 100644 index 00000000000..4233da4bc7d --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/netscience.yaml @@ -0,0 +1,24 @@ +name: netscience +file_type: .csv +description: + The graph netscience contains a coauthorship network of scientists working + on network theory and experiment, as compiled by M. Newman in May 2006. +author: Newman, Mark E.J. +refs: Finding community structure in networks using the eigenvectors of matrices. +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: false +is_directed: true +is_multigraph: false +is_symmetric: true +number_of_edges: 5484 +number_of_nodes: 1461 +url: https://data.rapids.ai/cugraph/datasets/netscience.csv diff --git a/python/cugraph/cugraph/datasets/metadata/polbooks.yaml b/python/cugraph/cugraph/datasets/metadata/polbooks.yaml new file mode 100644 index 00000000000..fbeb529ef8a --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/polbooks.yaml @@ -0,0 +1,24 @@ +name: polbooks +file_type: .csv +description: + A network of books about U.S. politics published close to the 2004 U.S. presidential election, and sold by Amazon.com. Edges between books represent frequent copurchasing of those books by the same buyers. +author: V. Krebs +refs: + V. Krebs, "The political books network", unpublished, https://doi.org/10.2307/40124305 [@sci-hub] +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: false +is_directed: true +is_multigraph: false +is_symmetric: true +number_of_edges: 882 +number_of_nodes: 105 +url: https://data.rapids.ai/cugraph/datasets/polbooks.csv diff --git a/python/cugraph/cugraph/datasets/metadata/small_line.yaml b/python/cugraph/cugraph/datasets/metadata/small_line.yaml new file mode 100644 index 00000000000..825e829f16b --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/small_line.yaml @@ -0,0 +1,24 @@ +name: small_line +file_type: .csv +description: + The `small_line` dataset was created by Nvidia for testing and demonstration + purposes, and consists of a small (10 nodes) path/linear graph. +author: Nvidia +refs: null +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: false +is_directed: false +is_multigraph: false +is_symmetric: true +number_of_edges: 9 +number_of_nodes: 10 +url: https://data.rapids.ai/cugraph/datasets/small_line.csv diff --git a/python/cugraph/cugraph/datasets/metadata/small_tree.yaml b/python/cugraph/cugraph/datasets/metadata/small_tree.yaml new file mode 100644 index 00000000000..30df37c4d47 --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/small_tree.yaml @@ -0,0 +1,24 @@ +name: small_tree +file_type: .csv +description: + The `small_tree` dataset was created by Nvidia for testing/demonstration + purposes, and consists of a small (9 nodes) directed tree. +author: Nvidia +refs: null +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: false +is_directed: true +is_multigraph: false +is_symmetric: false +number_of_edges: 11 +number_of_nodes: 9 +url: https://data.rapids.ai/cugraph/datasets/small_tree.csv diff --git a/python/cugraph/cugraph/datasets/metadata/toy_graph.yaml b/python/cugraph/cugraph/datasets/metadata/toy_graph.yaml new file mode 100644 index 00000000000..afe85c01a4e --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/toy_graph.yaml @@ -0,0 +1,24 @@ +name: toy_graph +file_type: .csv +description: + The `toy_graph` dataset was created by Nvidia for testing and demonstration + purposes, and consists of a small (6 nodes) directed graph. +author: null +refs: null +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: false +is_directed: true +is_multigraph: false +is_symmetric: true +number_of_edges: 16 +number_of_nodes: 6 +url: https://data.rapids.ai/cugraph/datasets/toy_graph.csv diff --git a/python/cugraph/cugraph/datasets/metadata/toy_graph_undirected.yaml b/python/cugraph/cugraph/datasets/metadata/toy_graph_undirected.yaml new file mode 100644 index 00000000000..20c1a56df9a --- /dev/null +++ b/python/cugraph/cugraph/datasets/metadata/toy_graph_undirected.yaml @@ -0,0 +1,24 @@ +name: toy_graph_undirected +file_type: .csv +description: + The `toy_graph_undirected` dataset was created by Nvidia for testing and + demonstration purposes, and consists of a small (6 nodes) undirected graph. +author: Nvidia +refs: null +delim: " " +header: None +col_names: + - src + - dst + - wgt +col_types: + - int32 + - int32 + - float32 +has_loop: false +is_directed: false +is_multigraph: false +is_symmetric: true +number_of_edges: 8 +number_of_nodes: 6 +url: https://data.rapids.ai/cugraph/datasets/toy_graph_undirected.csv diff --git a/python/cugraph/cugraph/experimental/__init__.py b/python/cugraph/cugraph/experimental/__init__.py index 2adfb84868e..b96b760e634 100644 --- a/python/cugraph/cugraph/experimental/__init__.py +++ b/python/cugraph/cugraph/experimental/__init__.py @@ -48,8 +48,6 @@ experimental_warning_wrapper(EXPERIMENTAL__find_bicliques) ) -from cugraph.experimental.datasets.dataset import Dataset - from cugraph.experimental.link_prediction.jaccard import ( EXPERIMENTAL__jaccard, EXPERIMENTAL__jaccard_coefficient, diff --git a/python/cugraph/cugraph/experimental/datasets/__init__.py b/python/cugraph/cugraph/experimental/datasets/__init__.py index a1dd45b3d9f..18220243df1 100644 --- a/python/cugraph/cugraph/experimental/datasets/__init__.py +++ b/python/cugraph/cugraph/experimental/datasets/__init__.py @@ -22,9 +22,18 @@ from cugraph.experimental.datasets import metadata from pathlib import Path +from cugraph.utilities.api_tools import promoted_experimental_warning_wrapper + + +Dataset = promoted_experimental_warning_wrapper(Dataset) +load_all = promoted_experimental_warning_wrapper(load_all) +set_download_dir = promoted_experimental_warning_wrapper(set_download_dir) +get_download_dir = promoted_experimental_warning_wrapper(get_download_dir) meta_path = Path(__file__).parent / "metadata" + +# individual dataset objects karate = Dataset(meta_path / "karate.yaml") karate_data = Dataset(meta_path / "karate_data.yaml") karate_undirected = Dataset(meta_path / "karate_undirected.yaml") @@ -41,6 +50,8 @@ email_Eu_core = Dataset(meta_path / "email-Eu-core.yaml") ktruss_polbooks = Dataset(meta_path / "ktruss_polbooks.yaml") + +# batches of datasets DATASETS_UNDIRECTED = [karate, dolphins] DATASETS_UNDIRECTED_WEIGHTS = [netscience] diff --git a/python/cugraph/cugraph/experimental/link_prediction/jaccard.py b/python/cugraph/cugraph/experimental/link_prediction/jaccard.py index 29f2f3ffe16..2eba73b3824 100644 --- a/python/cugraph/cugraph/experimental/link_prediction/jaccard.py +++ b/python/cugraph/cugraph/experimental/link_prediction/jaccard.py @@ -80,8 +80,8 @@ def EXPERIMENTAL__jaccard(G, vertex_pair=None, use_weight=False): you can get the interesting (non-zero) values that are part of the networkx solution by doing the following: - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True, ignore_weights=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True, ignore_weights=True) >>> pairs = G.get_two_hop_neighbors() >>> df = cugraph.jaccard(G, pairs) @@ -130,9 +130,9 @@ def EXPERIMENTAL__jaccard(G, vertex_pair=None, use_weight=False): Examples -------- - >>> from cugraph.experimental.datasets import karate + >>> from cugraph.datasets import karate >>> from cugraph.experimental import jaccard as exp_jaccard - >>> G = karate.get_graph(fetch=True, ignore_weights=True) + >>> G = karate.get_graph(download=True, ignore_weights=True) >>> df = exp_jaccard(G) """ @@ -230,9 +230,9 @@ def EXPERIMENTAL__jaccard_coefficient(G, ebunch=None, use_weight=False): Examples -------- - >>> from cugraph.experimental.datasets import karate + >>> from cugraph.datasets import karate >>> from cugraph.experimental import jaccard_coefficient as exp_jaccard_coefficient - >>> G = karate.get_graph(fetch=True, ignore_weights=True) + >>> G = karate.get_graph(download=True, ignore_weights=True) >>> df = exp_jaccard_coefficient(G) """ diff --git a/python/cugraph/cugraph/experimental/link_prediction/overlap.py b/python/cugraph/cugraph/experimental/link_prediction/overlap.py index f0c320be26b..0981ced4835 100644 --- a/python/cugraph/cugraph/experimental/link_prediction/overlap.py +++ b/python/cugraph/cugraph/experimental/link_prediction/overlap.py @@ -86,9 +86,9 @@ def EXPERIMENTAL__overlap_coefficient(G, ebunch=None, use_weight=False): Examples -------- - >>> from cugraph.experimental.datasets import karate + >>> from cugraph.datasets import karate >>> from cugraph.experimental import overlap_coefficient as exp_overlap_coefficient - >>> G = karate.get_graph(fetch=True, ignore_weights=True) + >>> G = karate.get_graph(download=True, ignore_weights=True) >>> df = exp_overlap_coefficient(G) """ vertex_pair = None @@ -164,9 +164,9 @@ def EXPERIMENTAL__overlap(G, vertex_pair=None, use_weight=False): Examples -------- - >>> from cugraph.experimental.datasets import karate + >>> from cugraph.datasets import karate >>> from cugraph.experimental import overlap as exp_overlap - >>> G = karate.get_graph(fetch=True, ignore_weights=True) + >>> G = karate.get_graph(download=True, ignore_weights=True) >>> df = exp_overlap(G) """ diff --git a/python/cugraph/cugraph/experimental/link_prediction/sorensen.py b/python/cugraph/cugraph/experimental/link_prediction/sorensen.py index c6fdc1ee422..ed27e4813d3 100644 --- a/python/cugraph/cugraph/experimental/link_prediction/sorensen.py +++ b/python/cugraph/cugraph/experimental/link_prediction/sorensen.py @@ -98,9 +98,9 @@ def EXPERIMENTAL__sorensen(G, vertex_pair=None, use_weight=False): Examples -------- - >>> from cugraph.experimental.datasets import karate + >>> from cugraph.datasets import karate >>> from cugraph.experimental import sorensen as exp_sorensen - >>> G = karate.get_graph(fetch=True, ignore_weights=True) + >>> G = karate.get_graph(download=True, ignore_weights=True) >>> df = exp_sorensen(G) """ @@ -196,9 +196,9 @@ def EXPERIMENTAL__sorensen_coefficient(G, ebunch=None, use_weight=False): Examples -------- - >>> from cugraph.experimental.datasets import karate + >>> from cugraph.datasets import karate >>> from cugraph.experimental import sorensen_coefficient as exp_sorensen_coef - >>> G = karate.get_graph(fetch=True, ignore_weights=True) + >>> G = karate.get_graph(download=True, ignore_weights=True) >>> df = exp_sorensen_coef(G) """ diff --git a/python/cugraph/cugraph/gnn/data_loading/bulk_sampler.py b/python/cugraph/cugraph/gnn/data_loading/bulk_sampler.py index 2bd01e5b5c7..90d290cbf0f 100644 --- a/python/cugraph/cugraph/gnn/data_loading/bulk_sampler.py +++ b/python/cugraph/cugraph/gnn/data_loading/bulk_sampler.py @@ -145,7 +145,7 @@ def add_batches( -------- >>> import cudf >>> from cugraph.experimental.gnn import BulkSampler - >>> from cugraph.experimental.datasets import karate + >>> from cugraph.datasets import karate >>> import tempfile >>> df = cudf.DataFrame({ ... "start_vid": [0, 4, 2, 3, 9, 11], @@ -155,7 +155,7 @@ def add_batches( >>> bulk_sampler = BulkSampler( ... batch_size=3, ... output_path=output_tempdir.name, - ... graph=karate.get_graph(fetch=True)) + ... graph=karate.get_graph(download=True)) >>> bulk_sampler.add_batches( ... df, ... start_col_name="start_vid", diff --git a/python/cugraph/cugraph/layout/force_atlas2.py b/python/cugraph/cugraph/layout/force_atlas2.py index fb000feea89..0e15eee718f 100644 --- a/python/cugraph/cugraph/layout/force_atlas2.py +++ b/python/cugraph/cugraph/layout/force_atlas2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022, NVIDIA CORPORATION. +# Copyright (c) 2020-2023, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -123,8 +123,8 @@ def on_train_end(self, positions): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 fd3313ef86c..c826efb6095 100644 --- a/python/cugraph/cugraph/link_analysis/hits.py +++ b/python/cugraph/cugraph/link_analysis/hits.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022, NVIDIA CORPORATION. +# Copyright (c) 2022-2023, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -75,8 +75,8 @@ def hits(G, max_iter=100, tol=1.0e-5, nstart=None, normalized=True): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 d2b827fa7c8..3b39ac597ab 100644 --- a/python/cugraph/cugraph/link_analysis/pagerank.py +++ b/python/cugraph/cugraph/link_analysis/pagerank.py @@ -207,8 +207,8 @@ def pagerank( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 dd411fa889d..f1b488c8cca 100644 --- a/python/cugraph/cugraph/link_prediction/jaccard.py +++ b/python/cugraph/cugraph/link_prediction/jaccard.py @@ -58,8 +58,8 @@ def jaccard(input_graph, vertex_pair=None, do_expensive_check=True): you can get the interesting (non-zero) values that are part of the networkx solution by doing the following: - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> pairs = G.get_two_hop_neighbors() >>> df = cugraph.jaccard(G, pairs) @@ -107,8 +107,8 @@ def jaccard(input_graph, vertex_pair=None, do_expensive_check=True): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.jaccard(G) """ @@ -187,8 +187,8 @@ def jaccard_coefficient(G, ebunch=None, do_expensive_check=True): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 e05e0c944fe..9bb7b76b0ca 100644 --- a/python/cugraph/cugraph/link_prediction/overlap.py +++ b/python/cugraph/cugraph/link_prediction/overlap.py @@ -97,8 +97,8 @@ def overlap(input_graph, vertex_pair=None, do_expensive_check=True): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.overlap(G) """ diff --git a/python/cugraph/cugraph/link_prediction/sorensen.py b/python/cugraph/cugraph/link_prediction/sorensen.py index 0f35f868b7c..1d43adb51cd 100644 --- a/python/cugraph/cugraph/link_prediction/sorensen.py +++ b/python/cugraph/cugraph/link_prediction/sorensen.py @@ -79,8 +79,8 @@ def sorensen(input_graph, vertex_pair=None, do_expensive_check=True): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.sorensen(G) """ @@ -160,8 +160,8 @@ def sorensen_coefficient(G, ebunch=None, do_expensive_check=True): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 fc6edae8d3e..e3486473fe5 100644 --- a/python/cugraph/cugraph/link_prediction/wjaccard.py +++ b/python/cugraph/cugraph/link_prediction/wjaccard.py @@ -78,8 +78,8 @@ def jaccard_w(input_graph, weights, vertex_pair=None, do_expensive_check=True): Examples -------- >>> import random - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 27fb7d608ca..d7ebc5fc684 100644 --- a/python/cugraph/cugraph/link_prediction/woverlap.py +++ b/python/cugraph/cugraph/link_prediction/woverlap.py @@ -80,8 +80,8 @@ def overlap_w(input_graph, weights, vertex_pair=None, do_expensive_check=True): Examples -------- >>> import random - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 c27e4f66a02..8337b4602de 100644 --- a/python/cugraph/cugraph/link_prediction/wsorensen.py +++ b/python/cugraph/cugraph/link_prediction/wsorensen.py @@ -76,8 +76,8 @@ def sorensen_w(input_graph, weights, vertex_pair=None, do_expensive_check=True): Examples -------- >>> import random - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 247989648f3..bc9b88250af 100644 --- a/python/cugraph/cugraph/sampling/node2vec.py +++ b/python/cugraph/cugraph/sampling/node2vec.py @@ -78,8 +78,8 @@ def node2vec(G, start_vertices, max_depth=1, compress_result=True, p=1.0, q=1.0) Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 a5e2a0371b3..015c05d1b08 100644 --- a/python/cugraph/cugraph/sampling/random_walks.py +++ b/python/cugraph/cugraph/sampling/random_walks.py @@ -114,8 +114,8 @@ def random_walks( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> M = karate.get_edgelist(fetch=True) + >>> from cugraph.datasets import karate + >>> M = karate.get_edgelist(download=True) >>> G = karate.get_graph() >>> start_vertices = G.nodes()[:4] >>> _, _, _ = cugraph.random_walks(G, "uniform", start_vertices, 3) diff --git a/python/cugraph/cugraph/testing/__init__.py b/python/cugraph/cugraph/testing/__init__.py index db1c574de21..db841a9a865 100644 --- a/python/cugraph/cugraph/testing/__init__.py +++ b/python/cugraph/cugraph/testing/__init__.py @@ -11,6 +11,46 @@ # See the License for the specific language governing permissions and # limitations under the License. -from cugraph.testing.utils import ( - RAPIDS_DATASET_ROOT_DIR_PATH, +from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH, RAPIDS_DATASET_ROOT_DIR +from cugraph.datasets import ( + cyber, + dolphins, + karate, + karate_disjoint, + polbooks, + netscience, + small_line, + small_tree, + email_Eu_core, + toy_graph, + toy_graph_undirected, ) + +# +# Moved Dataset Batches +# + +UNDIRECTED_DATASETS = [karate, dolphins] +SMALL_DATASETS = [karate, dolphins, polbooks] +WEIGHTED_DATASETS = [ + dolphins, + karate, + karate_disjoint, + netscience, + polbooks, + small_line, + small_tree, +] +ALL_DATASETS = [ + dolphins, + karate, + karate_disjoint, + polbooks, + netscience, + small_line, + small_tree, + email_Eu_core, + toy_graph, + toy_graph_undirected, +] +DEFAULT_DATASETS = [dolphins, netscience, karate_disjoint] diff --git a/python/cugraph/cugraph/tests/centrality/test_batch_betweenness_centrality_mg.py b/python/cugraph/cugraph/tests/centrality/test_batch_betweenness_centrality_mg.py index 3d1bbc5d67d..8ccbbfc9ec5 100644 --- a/python/cugraph/cugraph/tests/centrality/test_batch_betweenness_centrality_mg.py +++ b/python/cugraph/cugraph/tests/centrality/test_batch_betweenness_centrality_mg.py @@ -17,7 +17,7 @@ import numpy as np from cugraph.dask.common.mg_utils import is_single_gpu -from cugraph.experimental.datasets import karate +from cugraph.datasets import karate from test_betweenness_centrality import ( calc_betweenness_centrality, diff --git a/python/cugraph/cugraph/tests/centrality/test_batch_edge_betweenness_centrality_mg.py b/python/cugraph/cugraph/tests/centrality/test_batch_edge_betweenness_centrality_mg.py index dedf85a034b..154477a1a67 100644 --- a/python/cugraph/cugraph/tests/centrality/test_batch_edge_betweenness_centrality_mg.py +++ b/python/cugraph/cugraph/tests/centrality/test_batch_edge_betweenness_centrality_mg.py @@ -17,8 +17,7 @@ import numpy as np from cugraph.dask.common.mg_utils import is_single_gpu - -from cugraph.experimental.datasets import karate, netscience +from cugraph.datasets import karate, netscience # Get parameters from standard betwenness_centrality_test # As tests directory is not a module, we need to add it to the path diff --git a/python/cugraph/cugraph/tests/centrality/test_betweenness_centrality.py b/python/cugraph/cugraph/tests/centrality/test_betweenness_centrality.py index c9e31e804d4..3e4dd3af4fc 100644 --- a/python/cugraph/cugraph/tests/centrality/test_betweenness_centrality.py +++ b/python/cugraph/cugraph/tests/centrality/test_betweenness_centrality.py @@ -14,16 +14,15 @@ import gc import pytest - -import cugraph -from cugraph.testing import utils import random import numpy as np +import networkx as nx + import cudf import cupy - -import networkx as nx -from cugraph.experimental.datasets import DATASETS_SMALL, DATASETS_UNRENUMBERED +import cugraph +from cugraph.datasets import karate_disjoint +from cugraph.testing import utils, SMALL_DATASETS # ============================================================================= @@ -113,7 +112,9 @@ def calc_betweenness_centrality( edge_attr = None G = graph_file.get_graph( - create_using=cugraph.Graph(directed=directed), ignore_weights=not edgevals + download=True, + create_using=cugraph.Graph(directed=directed), + ignore_weights=not edgevals, ) M = G.to_pandas_edgelist().rename( @@ -304,7 +305,7 @@ def compare_scores(sorted_df, first_key, second_key, epsilon=DEFAULT_EPSILON): # Tests # ============================================================================= @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", [False, True]) @pytest.mark.parametrize("subset_size", SUBSET_SIZE_OPTIONS) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) @@ -339,7 +340,7 @@ def test_betweenness_centrality( @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("subset_size", [None]) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) @@ -384,7 +385,7 @@ def test_betweenness_centrality_k_full( # to a random sampling over the number of vertices (thus direct offsets) # in the graph structure instead of actual vertices identifiers @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNRENUMBERED) +@pytest.mark.parametrize("graph_file", [karate_disjoint]) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("subset_size", SUBSET_SIZE_OPTIONS) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) @@ -423,7 +424,7 @@ def test_betweenness_centrality_fixed_sample( @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("subset_size", SUBSET_SIZE_OPTIONS) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) @@ -464,7 +465,7 @@ def test_betweenness_centrality_weight_except( @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) @pytest.mark.parametrize("subset_size", SUBSET_SIZE_OPTIONS) diff --git a/python/cugraph/cugraph/tests/centrality/test_betweenness_centrality_mg.py b/python/cugraph/cugraph/tests/centrality/test_betweenness_centrality_mg.py index e36e50c91aa..930f80c1bfa 100644 --- a/python/cugraph/cugraph/tests/centrality/test_betweenness_centrality_mg.py +++ b/python/cugraph/cugraph/tests/centrality/test_betweenness_centrality_mg.py @@ -11,16 +11,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cugraph.dask as dcg import gc + import pytest -import cugraph + import dask_cudf import cupy import cudf - - -# from cugraph.dask.common.mg_utils import is_single_gpu +import cugraph +import cugraph.dask as dcg from cugraph.testing import utils from pylibcugraph.testing import gen_fixture_params_product diff --git a/python/cugraph/cugraph/tests/centrality/test_degree_centrality.py b/python/cugraph/cugraph/tests/centrality/test_degree_centrality.py index b1bf033aff4..921b419c3ae 100644 --- a/python/cugraph/cugraph/tests/centrality/test_degree_centrality.py +++ b/python/cugraph/cugraph/tests/centrality/test_degree_centrality.py @@ -14,13 +14,11 @@ import gc import pytest +import networkx as nx import cudf import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED - -import networkx as nx +from cugraph.testing import utils, UNDIRECTED_DATASETS # ============================================================================= @@ -37,7 +35,7 @@ def topKVertices(degree, col, k): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_degree_centrality_nx(graph_file): dataset_path = graph_file.get_path() NM = utils.read_csv_for_nx(dataset_path) @@ -69,7 +67,7 @@ def test_degree_centrality_nx(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_degree_centrality_multi_column(graph_file): dataset_path = graph_file.get_path() cu_M = utils.read_csv_file(dataset_path) diff --git a/python/cugraph/cugraph/tests/centrality/test_degree_centrality_mg.py b/python/cugraph/cugraph/tests/centrality/test_degree_centrality_mg.py index ba49a131d91..a46f4b9463b 100644 --- a/python/cugraph/cugraph/tests/centrality/test_degree_centrality_mg.py +++ b/python/cugraph/cugraph/tests/centrality/test_degree_centrality_mg.py @@ -12,14 +12,15 @@ # limitations under the License. import gc + import pytest + import cudf import dask_cudf -from cudf.testing import assert_series_equal - import cugraph from cugraph.dask.common.mg_utils import is_single_gpu from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH +from cudf.testing import assert_series_equal # ============================================================================= # Pytest Setup / Teardown - called for each test function diff --git a/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality.py b/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality.py index 12e9dd4c0a5..6b464f057f4 100644 --- a/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality.py +++ b/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality.py @@ -14,25 +14,16 @@ import gc import pytest - -import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_SMALL, DATASETS_UNRENUMBERED import random +import networkx as nx import numpy as np + import cupy import cudf +import cugraph +from cugraph.datasets import karate_disjoint +from cugraph.testing import utils, SMALL_DATASETS -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx # NOTE: Endpoint parameter is not currently being tested, there could be a test # to verify that python raise an error if it is used @@ -322,7 +313,7 @@ def generate_upper_triangle(dataframe): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("subset_size", SUBSET_SIZE_OPTIONS) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) @@ -352,7 +343,7 @@ def test_edge_betweenness_centrality( @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("subset_size", [None]) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) @@ -391,7 +382,7 @@ def test_edge_betweenness_centrality_k_full( # to a random sampling over the number of vertices (thus direct offsets) # in the graph structure instead of actual vertices identifiers @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNRENUMBERED) +@pytest.mark.parametrize("graph_file", [karate_disjoint]) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("subset_size", SUBSET_SIZE_OPTIONS) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) @@ -425,7 +416,7 @@ def test_edge_betweenness_centrality_fixed_sample( @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("subset_size", SUBSET_SIZE_OPTIONS) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) @@ -461,7 +452,7 @@ def test_edge_betweenness_centrality_weight_except( @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) @pytest.mark.parametrize("subset_size", SUBSET_SIZE_OPTIONS) @@ -494,7 +485,7 @@ def test_edge_betweenness_invalid_dtype( @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("edgevals", WEIGHTED_GRAPH_OPTIONS) @pytest.mark.parametrize("normalized", NORMALIZED_OPTIONS) diff --git a/python/cugraph/cugraph/tests/centrality/test_eigenvector_centrality.py b/python/cugraph/cugraph/tests/centrality/test_eigenvector_centrality.py index 2b348314c20..006cb89b79c 100644 --- a/python/cugraph/cugraph/tests/centrality/test_eigenvector_centrality.py +++ b/python/cugraph/cugraph/tests/centrality/test_eigenvector_centrality.py @@ -14,17 +14,12 @@ import gc import pytest +import networkx as nx import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import ( - toy_graph, - karate, - DATASETS_UNDIRECTED, - DATASETS, -) +from cugraph.testing import utils, UNDIRECTED_DATASETS, DEFAULT_DATASETS +from cugraph.datasets import toy_graph, karate -import networkx as nx # This toy graph is used in multiple tests throughout libcugraph_c and pylib. TOY = toy_graph @@ -46,7 +41,7 @@ def topKVertices(eigen, col, k): def calc_eigenvector(graph_file): dataset_path = graph_file.get_path() G = graph_file.get_graph( - create_using=cugraph.Graph(directed=True), ignore_weights=True + download=True, create_using=cugraph.Graph(directed=True), ignore_weights=True ) k_df = cugraph.eigenvector_centrality(G, max_iter=1000) @@ -62,7 +57,7 @@ def calc_eigenvector(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_eigenvector_centrality(graph_file): eigen_scores = calc_eigenvector(graph_file) @@ -73,7 +68,7 @@ def test_eigenvector_centrality(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_eigenvector_centrality_nx(graph_file): dataset_path = graph_file.get_path() NM = utils.read_csv_for_nx(dataset_path) @@ -141,7 +136,7 @@ def test_eigenvector_centrality_multi_column(graph_file): @pytest.mark.parametrize("graph_file", [TOY]) def test_eigenvector_centrality_toy(graph_file): # This test is based off of libcugraph_c and pylibcugraph tests - G = graph_file.get_graph(create_using=cugraph.Graph(directed=True)) + G = graph_file.get_graph(download=True, create_using=cugraph.Graph(directed=True)) tol = 1e-6 max_iter = 200 diff --git a/python/cugraph/cugraph/tests/centrality/test_eigenvector_centrality_mg.py b/python/cugraph/cugraph/tests/centrality/test_eigenvector_centrality_mg.py index f91ac418ef0..6828dd3cbd2 100644 --- a/python/cugraph/cugraph/tests/centrality/test_eigenvector_centrality_mg.py +++ b/python/cugraph/cugraph/tests/centrality/test_eigenvector_centrality_mg.py @@ -11,13 +11,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# import numpy as np -import pytest -import cugraph.dask as dcg import gc -import cugraph -import dask_cudf + +import pytest + import cudf +import dask_cudf +import cugraph +import cugraph.dask as dcg from cugraph.dask.common.mg_utils import is_single_gpu from cugraph.testing.utils import DATASETS diff --git a/python/cugraph/cugraph/tests/centrality/test_katz_centrality.py b/python/cugraph/cugraph/tests/centrality/test_katz_centrality.py index 5c34866e0d0..3c1371b8eff 100644 --- a/python/cugraph/cugraph/tests/centrality/test_katz_centrality.py +++ b/python/cugraph/cugraph/tests/centrality/test_katz_centrality.py @@ -14,27 +14,17 @@ import gc import pytest +import networkx as nx import cudf import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import ( - toy_graph_undirected, - karate, - DATASETS, - DATASETS_UNDIRECTED, +from cugraph.testing import ( + utils, + DEFAULT_DATASETS, + UNDIRECTED_DATASETS, ) +from cugraph.datasets import toy_graph_undirected, karate -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx # This toy graph is used in multiple tests throughout libcugraph_c and pylib. TOY = toy_graph_undirected @@ -75,7 +65,7 @@ def calc_katz(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_katz_centrality(graph_file): katz_scores = calc_katz(graph_file) @@ -86,7 +76,7 @@ def test_katz_centrality(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_katz_centrality_nx(graph_file): dataset_path = graph_file.get_path() NM = utils.read_csv_for_nx(dataset_path) @@ -118,7 +108,7 @@ def test_katz_centrality_nx(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_katz_centrality_multi_column(graph_file): dataset_path = graph_file.get_path() cu_M = utils.read_csv_file(dataset_path) @@ -161,7 +151,7 @@ def test_katz_centrality_multi_column(graph_file): @pytest.mark.parametrize("graph_file", [TOY]) def test_katz_centrality_toy(graph_file): # This test is based off of libcugraph_c and pylibcugraph tests - G = graph_file.get_graph(create_using=cugraph.Graph(directed=True)) + G = graph_file.get_graph(create_using=cugraph.Graph(directed=True), download=True) alpha = 0.01 beta = 1.0 tol = 0.000001 diff --git a/python/cugraph/cugraph/tests/centrality/test_katz_centrality_mg.py b/python/cugraph/cugraph/tests/centrality/test_katz_centrality_mg.py index 9a6ee2d2668..1dcbcbae3cd 100644 --- a/python/cugraph/cugraph/tests/centrality/test_katz_centrality_mg.py +++ b/python/cugraph/cugraph/tests/centrality/test_katz_centrality_mg.py @@ -11,13 +11,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# import numpy as np -import pytest -import cugraph.dask as dcg import gc -import cugraph -import dask_cudf + +import pytest + import cudf +import dask_cudf +import cugraph +import cugraph.dask as dcg from cugraph.dask.common.mg_utils import is_single_gpu from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH diff --git a/python/cugraph/cugraph/tests/comms/test_comms_mg.py b/python/cugraph/cugraph/tests/comms/test_comms_mg.py index cebb97923ee..d4b33641c1a 100644 --- a/python/cugraph/cugraph/tests/comms/test_comms_mg.py +++ b/python/cugraph/cugraph/tests/comms/test_comms_mg.py @@ -11,16 +11,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +import gc + import pytest import cugraph.dask as dcg -import gc -# import pytest -import cugraph -import dask_cudf import cudf - -# from cugraph.dask.common.mg_utils import is_single_gpu +import dask_cudf +import cugraph from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH # ============================================================================= diff --git a/python/cugraph/cugraph/tests/community/test_balanced_cut.py b/python/cugraph/cugraph/tests/community/test_balanced_cut.py index 5beca07dfb7..0a95a1846ce 100644 --- a/python/cugraph/cugraph/tests/community/test_balanced_cut.py +++ b/python/cugraph/cugraph/tests/community/test_balanced_cut.py @@ -12,14 +12,15 @@ # limitations under the License. import gc -import random +import random import pytest import networkx as nx import pandas as pd + import cudf import cugraph -from cugraph.experimental.datasets import DATASETS +from cugraph.testing import DEFAULT_DATASETS def cugraph_call(G, partitions): @@ -57,7 +58,7 @@ def random_call(G, partitions): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("partitions", PARTITIONS) def test_edge_cut_clustering(graph_file, partitions): gc.collect() @@ -78,7 +79,7 @@ def test_edge_cut_clustering(graph_file, partitions): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("partitions", PARTITIONS) def test_edge_cut_clustering_with_edgevals(graph_file, partitions): gc.collect() @@ -101,7 +102,7 @@ def test_edge_cut_clustering_with_edgevals(graph_file, partitions): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", [DATASETS[2]]) +@pytest.mark.parametrize("graph_file", [DEFAULT_DATASETS[2]]) @pytest.mark.parametrize("partitions", PARTITIONS) def test_edge_cut_clustering_with_edgevals_nx(graph_file, partitions): gc.collect() diff --git a/python/cugraph/cugraph/tests/community/test_ecg.py b/python/cugraph/cugraph/tests/community/test_ecg.py index 5536d562402..4440973df83 100644 --- a/python/cugraph/cugraph/tests/community/test_ecg.py +++ b/python/cugraph/cugraph/tests/community/test_ecg.py @@ -12,15 +12,14 @@ # limitations under the License. import gc +from pathlib import PurePath import pytest import networkx as nx -import cugraph +import cugraph from cugraph.testing import utils -from cugraph.experimental.datasets import karate, dolphins, netscience - -from pathlib import PurePath +from cugraph.datasets import karate, dolphins, netscience def cugraph_call(G, min_weight, ensemble_size): diff --git a/python/cugraph/cugraph/tests/community/test_induced_subgraph_mg.py b/python/cugraph/cugraph/tests/community/test_induced_subgraph_mg.py index 34cbf73aae6..3a6a6e0d409 100644 --- a/python/cugraph/cugraph/tests/community/test_induced_subgraph_mg.py +++ b/python/cugraph/cugraph/tests/community/test_induced_subgraph_mg.py @@ -12,17 +12,17 @@ # limitations under the License. import gc + import pytest -import dask_cudf +import cudf from cudf.testing.testing import assert_frame_equal -from pylibcugraph.testing import gen_fixture_params_product - +import dask_cudf import cugraph import cugraph.dask as dcg from cugraph.testing import utils from cugraph.dask.common.mg_utils import is_single_gpu -import cudf +from pylibcugraph.testing import gen_fixture_params_product # ============================================================================= diff --git a/python/cugraph/cugraph/tests/community/test_k_truss_subgraph.py b/python/cugraph/cugraph/tests/community/test_k_truss_subgraph.py index 56c719ce7da..b0dcc2ede3d 100644 --- a/python/cugraph/cugraph/tests/community/test_k_truss_subgraph.py +++ b/python/cugraph/cugraph/tests/community/test_k_truss_subgraph.py @@ -14,31 +14,20 @@ import gc import pytest +import networkx as nx +import numpy as np import cugraph from cugraph.testing import utils - -import numpy as np +from cugraph.datasets import polbooks, karate_asymmetric from numba import cuda -from cugraph.experimental.datasets import DATASETS_KTRUSS, karate_asymmetric - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx - -print("Networkx version : {} ".format(nx.__version__)) # ============================================================================= # Pytest Setup / Teardown - called for each test function # ============================================================================= + + def setup_function(): gc.collect() @@ -91,8 +80,7 @@ def test_unsupported_cuda_version(): """ k = 5 - graph_file = DATASETS_KTRUSS[0][0] - G = graph_file.get_graph() + G = polbooks.get_graph(download=True) if __cuda_version == __unsupported_cuda_version: with pytest.raises(NotImplementedError): cugraph.k_truss(G, k) @@ -105,13 +93,11 @@ def test_unsupported_cuda_version(): (__cuda_version == __unsupported_cuda_version), reason="skipping on unsupported CUDA " f"{__unsupported_cuda_version} environment.", ) -@pytest.mark.parametrize("graph_file, nx_ground_truth", utils.DATASETS_KTRUSS) -def test_ktruss_subgraph_Graph(graph_file, nx_ground_truth): +@pytest.mark.parametrize("_, nx_ground_truth", utils.DATASETS_KTRUSS) +def test_ktruss_subgraph_Graph(_, nx_ground_truth): k = 5 - cu_M = utils.read_csv_file(graph_file) - G = cugraph.Graph() - G.from_cudf_edgelist(cu_M, source="0", destination="1", edge_attr="2") + G = polbooks.get_graph(download=True, create_using=cugraph.Graph(directed=False)) k_subgraph = cugraph.ktruss_subgraph(G, k) compare_k_truss(k_subgraph, k, nx_ground_truth) @@ -122,11 +108,9 @@ def test_ktruss_subgraph_Graph(graph_file, nx_ground_truth): (__cuda_version == __unsupported_cuda_version), reason="skipping on unsupported CUDA " f"{__unsupported_cuda_version} environment.", ) -@pytest.mark.parametrize("graph_file, nx_ground_truth", DATASETS_KTRUSS) -def test_ktruss_subgraph_Graph_nx(graph_file, nx_ground_truth): - +def test_ktruss_subgraph_Graph_nx(): k = 5 - dataset_path = graph_file.get_path() + dataset_path = polbooks.get_path() M = utils.read_csv_for_nx(dataset_path, read_weights_in_sp=True) G = nx.from_pandas_edgelist( M, source="0", target="1", edge_attr="weight", create_using=nx.Graph() @@ -146,7 +130,9 @@ def test_ktruss_subgraph_directed_Graph(): k = 5 edgevals = True G = karate_asymmetric.get_graph( - create_using=cugraph.Graph(directed=True), ignore_weights=not edgevals + download=True, + create_using=cugraph.Graph(directed=True), + ignore_weights=not edgevals, ) with pytest.raises(ValueError): cugraph.k_truss(G, k) diff --git a/python/cugraph/cugraph/tests/community/test_leiden.py b/python/cugraph/cugraph/tests/community/test_leiden.py index 9cbe0df2532..a06b0dd22c5 100644 --- a/python/cugraph/cugraph/tests/community/test_leiden.py +++ b/python/cugraph/cugraph/tests/community/test_leiden.py @@ -15,12 +15,12 @@ import time import pytest - import networkx as nx + import cugraph import cudf -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED, karate_asymmetric +from cugraph.testing import utils, UNDIRECTED_DATASETS +from cugraph.datasets import karate_asymmetric from cudf.testing.testing import assert_series_equal @@ -179,7 +179,7 @@ def cugraph_louvain(G): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_leiden(graph_file): edgevals = True @@ -192,7 +192,7 @@ def test_leiden(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_leiden_nx(graph_file): dataset_path = graph_file.get_path() NM = utils.read_csv_for_nx(dataset_path) diff --git a/python/cugraph/cugraph/tests/community/test_leiden_mg.py b/python/cugraph/cugraph/tests/community/test_leiden_mg.py index e76696e5769..69fccdae260 100644 --- a/python/cugraph/cugraph/tests/community/test_leiden_mg.py +++ b/python/cugraph/cugraph/tests/community/test_leiden_mg.py @@ -13,13 +13,12 @@ import pytest -import cugraph.dask as dcg -import cugraph import dask_cudf +import cugraph +import cugraph.dask as dcg from cugraph.testing import utils -# from cugraph.dask.common.mg_utils import is_single_gpu try: from rapids_pytest_benchmark import setFixtureParamNames diff --git a/python/cugraph/cugraph/tests/community/test_louvain.py b/python/cugraph/cugraph/tests/community/test_louvain.py index 6c0dcef8c4a..183be071a44 100644 --- a/python/cugraph/cugraph/tests/community/test_louvain.py +++ b/python/cugraph/cugraph/tests/community/test_louvain.py @@ -12,26 +12,17 @@ # limitations under the License. import gc -import time +import time import pytest +import networkx as nx import cugraph import cupyx import cudf -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED, karate_asymmetric - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, these import community and import networkx need to be -# relocated in the third-party group once this gets fixed. -import warnings +from cugraph.testing import utils, UNDIRECTED_DATASETS +from cugraph.datasets import karate_asymmetric -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx try: import community @@ -82,7 +73,7 @@ def networkx_call(M): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_louvain(graph_file): dataset_path = graph_file.get_path() M = utils.read_csv_for_nx(dataset_path) @@ -116,7 +107,7 @@ def test_louvain_directed_graph(): @pytest.mark.sg @pytest.mark.parametrize("is_weighted", [True, False]) def test_louvain_csr_graph(is_weighted): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] df = karate.get_edgelist() M = cupyx.scipy.sparse.coo_matrix( diff --git a/python/cugraph/cugraph/tests/community/test_louvain_mg.py b/python/cugraph/cugraph/tests/community/test_louvain_mg.py index a766f804673..5318262fe26 100644 --- a/python/cugraph/cugraph/tests/community/test_louvain_mg.py +++ b/python/cugraph/cugraph/tests/community/test_louvain_mg.py @@ -19,7 +19,6 @@ import dask_cudf from cugraph.testing import utils -# from cugraph.dask.common.mg_utils import is_single_gpu try: from rapids_pytest_benchmark import setFixtureParamNames diff --git a/python/cugraph/cugraph/tests/community/test_modularity.py b/python/cugraph/cugraph/tests/community/test_modularity.py index 07fa2718ee1..ac44b6c89c1 100644 --- a/python/cugraph/cugraph/tests/community/test_modularity.py +++ b/python/cugraph/cugraph/tests/community/test_modularity.py @@ -12,17 +12,15 @@ # limitations under the License. import gc -import random +import random import pytest +import networkx as nx import cudf import cugraph -from cugraph.testing import utils +from cugraph.testing import utils, DEFAULT_DATASETS from cugraph.utilities import ensure_cugraph_obj_for_nx -from cugraph.experimental.datasets import DATASETS - -import networkx as nx def cugraph_call(G, partitions): @@ -55,7 +53,7 @@ def random_call(G, partitions): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("partitions", PARTITIONS) def test_modularity_clustering(graph_file, partitions): gc.collect() @@ -77,7 +75,7 @@ def test_modularity_clustering(graph_file, partitions): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("partitions", PARTITIONS) def test_modularity_clustering_nx(graph_file, partitions): # Read in the graph and get a cugraph object @@ -108,7 +106,7 @@ def test_modularity_clustering_nx(graph_file, partitions): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("partitions", PARTITIONS) def test_modularity_clustering_multi_column(graph_file, partitions): # Read in the graph and get a cugraph object diff --git a/python/cugraph/cugraph/tests/community/test_subgraph_extraction.py b/python/cugraph/cugraph/tests/community/test_subgraph_extraction.py index 5b115be81e0..8abab3179fe 100644 --- a/python/cugraph/cugraph/tests/community/test_subgraph_extraction.py +++ b/python/cugraph/cugraph/tests/community/test_subgraph_extraction.py @@ -19,8 +19,8 @@ import cudf import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS, karate +from cugraph.testing import utils, DEFAULT_DATASETS +from cugraph.datasets import karate ############################################################################### @@ -66,7 +66,7 @@ def nx_call(M, verts, directed=True): ############################################################################### @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_subgraph_extraction_DiGraph(graph_file): dataset_path = graph_file.get_path() M = utils.read_csv_for_nx(dataset_path) @@ -80,7 +80,7 @@ def test_subgraph_extraction_DiGraph(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_subgraph_extraction_Graph(graph_file): dataset_path = graph_file.get_path() M = utils.read_csv_for_nx(dataset_path) @@ -94,7 +94,7 @@ def test_subgraph_extraction_Graph(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", [DATASETS[2]]) +@pytest.mark.parametrize("graph_file", [DEFAULT_DATASETS[2]]) def test_subgraph_extraction_Graph_nx(graph_file): directed = False verts = np.zeros(3, dtype=np.int32) @@ -123,7 +123,7 @@ def test_subgraph_extraction_Graph_nx(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_subgraph_extraction_multi_column(graph_file): dataset_path = graph_file.get_path() M = utils.read_csv_for_nx(dataset_path) diff --git a/python/cugraph/cugraph/tests/community/test_triangle_count.py b/python/cugraph/cugraph/tests/community/test_triangle_count.py index 3705ffbf8ed..a4d267719ba 100644 --- a/python/cugraph/cugraph/tests/community/test_triangle_count.py +++ b/python/cugraph/cugraph/tests/community/test_triangle_count.py @@ -12,27 +12,16 @@ # limitations under the License. import gc -import random +import random +import networkx as nx import pytest -import cudf -from pylibcugraph.testing.utils import gen_fixture_params_product +import cudf import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED, karate_asymmetric - - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx +from cugraph.testing import utils, UNDIRECTED_DATASETS +from cugraph.datasets import karate_asymmetric +from pylibcugraph.testing.utils import gen_fixture_params_product # ============================================================================= @@ -45,7 +34,7 @@ def setup_function(): # ============================================================================= # Pytest fixtures # ============================================================================= -datasets = DATASETS_UNDIRECTED +datasets = UNDIRECTED_DATASETS fixture_params = gen_fixture_params_product( (datasets, "graph_file"), ([True, False], "edgevals"), diff --git a/python/cugraph/cugraph/tests/community/test_triangle_count_mg.py b/python/cugraph/cugraph/tests/community/test_triangle_count_mg.py index 4127b6ea4bd..2cf0525d2ad 100644 --- a/python/cugraph/cugraph/tests/community/test_triangle_count_mg.py +++ b/python/cugraph/cugraph/tests/community/test_triangle_count_mg.py @@ -11,17 +11,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -import random import gc +import random import pytest + import cudf import dask_cudf -from pylibcugraph.testing.utils import gen_fixture_params_product - import cugraph -from cugraph.testing import utils import cugraph.dask as dcg +from cugraph.testing import utils +from pylibcugraph.testing.utils import gen_fixture_params_product # ============================================================================= diff --git a/python/cugraph/cugraph/tests/components/test_connectivity.py b/python/cugraph/cugraph/tests/components/test_connectivity.py index 71bec2e15c1..df45e055c5e 100644 --- a/python/cugraph/cugraph/tests/components/test_connectivity.py +++ b/python/cugraph/cugraph/tests/components/test_connectivity.py @@ -12,35 +12,29 @@ # limitations under the License. import gc + import time from collections import defaultdict import pytest import cupy as cp import numpy as np +import networkx as nx from cupyx.scipy.sparse import coo_matrix as cp_coo_matrix from cupyx.scipy.sparse import csr_matrix as cp_csr_matrix from cupyx.scipy.sparse import csc_matrix as cp_csc_matrix from scipy.sparse import coo_matrix as sp_coo_matrix from scipy.sparse import csr_matrix as sp_csr_matrix from scipy.sparse import csc_matrix as sp_csc_matrix -from cugraph.experimental.datasets import DATASETS, STRONGDATASETS from cugraph.utilities import is_nx_graph_type import cudf import cugraph -from cugraph.testing import utils +from cugraph.testing import utils, DEFAULT_DATASETS +from cugraph.datasets import dolphins, netscience, email_Eu_core -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx +DATASETS_BATCH = [dolphins, netscience, email_Eu_core] print("Networkx version : {} ".format(nx.__version__)) @@ -270,22 +264,22 @@ def assert_scipy_api_compat(G, dataset_path, api_type): # ============================================================================= # Pytest fixtures # ============================================================================= -@pytest.fixture(scope="module", params=DATASETS) +@pytest.fixture(scope="module", params=DEFAULT_DATASETS) def dataset_nxresults_weak(request): return networkx_weak_call(request.param) -@pytest.fixture(scope="module", params=[DATASETS[0]]) +@pytest.fixture(scope="module", params=[DEFAULT_DATASETS[0]]) def single_dataset_nxresults_weak(request): return networkx_weak_call(request.param) -@pytest.fixture(scope="module", params=STRONGDATASETS) +@pytest.fixture(scope="module", params=DATASETS_BATCH) def dataset_nxresults_strong(request): return networkx_strong_call(request.param) -@pytest.fixture(scope="module", params=[STRONGDATASETS[0]]) +@pytest.fixture(scope="module", params=[DATASETS_BATCH[0]]) def single_dataset_nxresults_strong(request): return networkx_strong_call(request.param) @@ -440,9 +434,9 @@ def test_scipy_api_compat_strong(single_dataset_nxresults_strong): @pytest.mark.parametrize("connection_type", ["strong", "weak"]) def test_scipy_api_compat(connection_type): if connection_type == "strong": - graph_file = STRONGDATASETS[0] + graph_file = DATASETS_BATCH[0] else: - graph_file = DATASETS[0] + graph_file = DEFAULT_DATASETS[0] input_cugraph_graph = graph_file.get_graph() diff --git a/python/cugraph/cugraph/tests/components/test_connectivity_mg.py b/python/cugraph/cugraph/tests/components/test_connectivity_mg.py index 691e85e51cd..e809ab66438 100644 --- a/python/cugraph/cugraph/tests/components/test_connectivity_mg.py +++ b/python/cugraph/cugraph/tests/components/test_connectivity_mg.py @@ -11,18 +11,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pytest -import cugraph.dask as dcg import gc -# import pytest -import cugraph -import dask_cudf -import cudf +import pytest -# from cugraph.dask.common.mg_utils import is_single_gpu +import cudf +import dask_cudf +import cugraph +import cugraph.dask as dcg from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH + # ============================================================================= # Pytest Setup / Teardown - called for each test function # ============================================================================= diff --git a/python/cugraph/cugraph/tests/core/test_core_number.py b/python/cugraph/cugraph/tests/core/test_core_number.py index 6a8fedfe11c..a01b837ff61 100644 --- a/python/cugraph/cugraph/tests/core/test_core_number.py +++ b/python/cugraph/cugraph/tests/core/test_core_number.py @@ -14,13 +14,12 @@ import gc import pytest -import cudf -from pylibcugraph.testing.utils import gen_fixture_params_product import networkx as nx +import cudf import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED +from cugraph.testing import utils, UNDIRECTED_DATASETS +from pylibcugraph.testing.utils import gen_fixture_params_product # ============================================================================= @@ -33,11 +32,10 @@ def setup_function(): # ============================================================================= # Pytest fixtures # ============================================================================= -datasets = DATASETS_UNDIRECTED degree_type = ["incoming", "outgoing"] fixture_params = gen_fixture_params_product( - (datasets, "graph_file"), + (UNDIRECTED_DATASETS, "graph_file"), (degree_type, "degree_type"), ) diff --git a/python/cugraph/cugraph/tests/core/test_core_number_mg.py b/python/cugraph/cugraph/tests/core/test_core_number_mg.py index cff2ae11ef3..23214b5f51b 100644 --- a/python/cugraph/cugraph/tests/core/test_core_number_mg.py +++ b/python/cugraph/cugraph/tests/core/test_core_number_mg.py @@ -14,12 +14,12 @@ import gc import pytest -import dask_cudf -from pylibcugraph.testing.utils import gen_fixture_params_product +import dask_cudf import cugraph -from cugraph.testing import utils import cugraph.dask as dcg +from cugraph.testing import utils +from pylibcugraph.testing.utils import gen_fixture_params_product # ============================================================================= diff --git a/python/cugraph/cugraph/tests/core/test_k_core.py b/python/cugraph/cugraph/tests/core/test_k_core.py index 1ea3bdd8a0a..f0169238ece 100644 --- a/python/cugraph/cugraph/tests/core/test_k_core.py +++ b/python/cugraph/cugraph/tests/core/test_k_core.py @@ -14,21 +14,10 @@ import gc import pytest +import networkx as nx import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx +from cugraph.testing import utils, UNDIRECTED_DATASETS print("Networkx version : {} ".format(nx.__version__)) @@ -73,7 +62,7 @@ def compare_edges(cg, nxg): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_k_core_Graph(graph_file): cu_kcore, nx_kcore = calc_k_cores(graph_file, False) @@ -82,7 +71,7 @@ def test_k_core_Graph(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_k_core_Graph_nx(graph_file): dataset_path = graph_file.get_path() NM = utils.read_csv_for_nx(dataset_path) @@ -94,7 +83,7 @@ def test_k_core_Graph_nx(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_k_core_corenumber_multicolumn(graph_file): dataset_path = graph_file.get_path() cu_M = utils.read_csv_file(dataset_path) @@ -133,7 +122,7 @@ def test_k_core_corenumber_multicolumn(graph_file): @pytest.mark.sg def test_k_core_invalid_input(): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] G = karate.get_graph(create_using=cugraph.Graph(directed=True)) with pytest.raises(ValueError): cugraph.k_core(G) diff --git a/python/cugraph/cugraph/tests/core/test_k_core_mg.py b/python/cugraph/cugraph/tests/core/test_k_core_mg.py index d8e7ef98d24..c68108ce241 100644 --- a/python/cugraph/cugraph/tests/core/test_k_core_mg.py +++ b/python/cugraph/cugraph/tests/core/test_k_core_mg.py @@ -14,14 +14,14 @@ import gc import pytest -import dask_cudf -from cudf.testing.testing import assert_frame_equal -from pylibcugraph.testing import gen_fixture_params_product +import dask_cudf import cugraph -from cugraph.testing import utils import cugraph.dask as dcg +from cugraph.testing import utils +from cudf.testing.testing import assert_frame_equal from cugraph.structure.symmetrize import symmetrize_df +from pylibcugraph.testing import gen_fixture_params_product # ============================================================================= diff --git a/python/cugraph/cugraph/tests/data_store/test_gnn_feat_storage.py b/python/cugraph/cugraph/tests/data_store/test_gnn_feat_storage.py index 2b7a5a2b1c9..2d1537d11e3 100644 --- a/python/cugraph/cugraph/tests/data_store/test_gnn_feat_storage.py +++ b/python/cugraph/cugraph/tests/data_store/test_gnn_feat_storage.py @@ -11,10 +11,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # Import FeatureStore class -from cugraph.gnn import FeatureStore + +import pytest import numpy as np + import cudf -import pytest +from cugraph.gnn import FeatureStore @pytest.mark.sg diff --git a/python/cugraph/cugraph/tests/data_store/test_property_graph.py b/python/cugraph/cugraph/tests/data_store/test_property_graph.py index c5c382df2eb..a33d4f753db 100644 --- a/python/cugraph/cugraph/tests/data_store/test_property_graph.py +++ b/python/cugraph/cugraph/tests/data_store/test_property_graph.py @@ -17,11 +17,16 @@ import pytest import pandas as pd import numpy as np + import cudf import cupy as cp +import cugraph +from cugraph.generators import rmat +from cugraph.datasets import cyber from cudf.testing import assert_frame_equal, assert_series_equal from pylibcugraph.testing.utils import gen_fixture_params_product + # If the rapids-pytest-benchmark plugin is installed, the "gpubenchmark" # fixture will be available automatically. Check that this fixture is available # by trying to import rapids_pytest_benchmark, and if that fails, set @@ -44,10 +49,6 @@ SettingWithCopyWarning as pandas_SettingWithCopyWarning, ) -import cugraph -from cugraph.generators import rmat -from cugraph.experimental.datasets import cyber - def type_is_categorical(pG): return ( diff --git a/python/cugraph/cugraph/tests/data_store/test_property_graph_mg.py b/python/cugraph/cugraph/tests/data_store/test_property_graph_mg.py index 8bc2da37e89..dd48fc72e36 100644 --- a/python/cugraph/cugraph/tests/data_store/test_property_graph_mg.py +++ b/python/cugraph/cugraph/tests/data_store/test_property_graph_mg.py @@ -10,22 +10,23 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import gc -import dask_cudf import pytest import pandas as pd +import numpy as np + import cudf +import cugraph +import dask_cudf import cupy as cp -import numpy as np -from cudf.testing import assert_frame_equal, assert_series_equal +import cugraph.dask as dcg from cupy.testing import assert_array_equal +from cudf.testing import assert_frame_equal, assert_series_equal from pylibcugraph.testing.utils import gen_fixture_params_product from cugraph.dask.common.mg_utils import is_single_gpu - -import cugraph.dask as dcg -from cugraph.experimental.datasets import cyber -from cugraph.experimental.datasets import netscience +from cugraph.datasets import cyber, netscience # If the rapids-pytest-benchmark plugin is installed, the "gpubenchmark" # fixture will be available automatically. Check that this fixture is available @@ -39,8 +40,6 @@ gpubenchmark = pytest_benchmark.plugin.benchmark -import cugraph - def type_is_categorical(pG): return ( diff --git a/python/cugraph/cugraph/tests/generators/test_rmat.py b/python/cugraph/cugraph/tests/generators/test_rmat.py index 876e9727b37..9b8353a4ca5 100644 --- a/python/cugraph/cugraph/tests/generators/test_rmat.py +++ b/python/cugraph/cugraph/tests/generators/test_rmat.py @@ -15,9 +15,8 @@ import pytest import cudf - -from cugraph.generators import rmat import cugraph +from cugraph.generators import rmat from cupy.sparse import coo_matrix, triu, tril import numpy as np import cupy as cp diff --git a/python/cugraph/cugraph/tests/generators/test_rmat_mg.py b/python/cugraph/cugraph/tests/generators/test_rmat_mg.py index d5d6db4d70f..0e1808d2f80 100644 --- a/python/cugraph/cugraph/tests/generators/test_rmat_mg.py +++ b/python/cugraph/cugraph/tests/generators/test_rmat_mg.py @@ -15,7 +15,8 @@ import pytest import dask_cudf - +import cugraph +from cugraph.generators import rmat from cugraph.testing.mg_utils import ( start_dask_client, stop_dask_client, @@ -23,8 +24,6 @@ from cugraph.dask.common.mg_utils import ( is_single_gpu, ) -from cugraph.generators import rmat -import cugraph ############################################################################## diff --git a/python/cugraph/cugraph/tests/gnn/test_dgl_uniform_sampler.py b/python/cugraph/cugraph/tests/gnn/test_dgl_uniform_sampler.py index 8d94aa6137d..eeb9d06b162 100644 --- a/python/cugraph/cugraph/tests/gnn/test_dgl_uniform_sampler.py +++ b/python/cugraph/cugraph/tests/gnn/test_dgl_uniform_sampler.py @@ -11,12 +11,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cudf +import pytest import pandas as pd import numpy as np -import cupy as cp -import pytest +import cudf +import cupy as cp from cugraph.gnn.dgl_extensions.dgl_uniform_sampler import DGLUniformSampler diff --git a/python/cugraph/cugraph/tests/gnn/test_dgl_uniform_sampler_mg.py b/python/cugraph/cugraph/tests/gnn/test_dgl_uniform_sampler_mg.py index 45a64a1f4ca..bc36e5f0631 100644 --- a/python/cugraph/cugraph/tests/gnn/test_dgl_uniform_sampler_mg.py +++ b/python/cugraph/cugraph/tests/gnn/test_dgl_uniform_sampler_mg.py @@ -10,13 +10,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import dask_cudf -import cudf + +import pytest import pandas as pd import numpy as np -import cupy as cp -import pytest +import dask_cudf +import cudf +import cupy as cp from cugraph.gnn.dgl_extensions.dgl_uniform_sampler import DGLUniformSampler diff --git a/python/cugraph/cugraph/tests/internals/test_renumber.py b/python/cugraph/cugraph/tests/internals/test_renumber.py index 4526770ec2a..cd27dfecfe9 100644 --- a/python/cugraph/cugraph/tests/internals/test_renumber.py +++ b/python/cugraph/cugraph/tests/internals/test_renumber.py @@ -15,14 +15,13 @@ import gc -import pandas as pd import pytest +import pandas as pd + import cudf from cudf.testing import assert_series_equal - from cugraph.structure.number_map import NumberMap -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS +from cugraph.testing import utils, DEFAULT_DATASETS @pytest.mark.sg @@ -108,7 +107,7 @@ def test_renumber_negative_col(): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_renumber_files_col(graph_file): gc.collect() dataset_path = graph_file.get_path() @@ -150,7 +149,7 @@ def test_renumber_files_col(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_renumber_files_multi_col(graph_file): gc.collect() dataset_path = graph_file.get_path() diff --git a/python/cugraph/cugraph/tests/internals/test_renumber_mg.py b/python/cugraph/cugraph/tests/internals/test_renumber_mg.py index cc7ee0368a5..c0abc61b050 100644 --- a/python/cugraph/cugraph/tests/internals/test_renumber_mg.py +++ b/python/cugraph/cugraph/tests/internals/test_renumber_mg.py @@ -18,17 +18,17 @@ import pandas import numpy as np -import dask_cudf + import dask import cudf -from cudf.testing import assert_frame_equal, assert_series_equal - +import dask_cudf import cugraph.dask as dcg import cugraph from cugraph.testing import utils from cugraph.structure.number_map import NumberMap from cugraph.dask.common.mg_utils import is_single_gpu from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH +from cudf.testing import assert_frame_equal, assert_series_equal # ============================================================================= diff --git a/python/cugraph/cugraph/tests/internals/test_symmetrize.py b/python/cugraph/cugraph/tests/internals/test_symmetrize.py index 8d772abe822..654ed3296d9 100644 --- a/python/cugraph/cugraph/tests/internals/test_symmetrize.py +++ b/python/cugraph/cugraph/tests/internals/test_symmetrize.py @@ -14,11 +14,11 @@ import gc import pytest - import pandas as pd + import cudf import cugraph -from cugraph.experimental.datasets import DATASETS +from cugraph.testing import DEFAULT_DATASETS @pytest.mark.sg @@ -155,7 +155,7 @@ def compare(src1, dst1, val1, src2, dst2, val2): @pytest.mark.sg @pytest.mark.skip("debugging") -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_symmetrize_unweighted(graph_file): gc.collect() @@ -178,7 +178,7 @@ def test_symmetrize_unweighted(graph_file): @pytest.mark.sg @pytest.mark.skip("debugging") -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_symmetrize_weighted(graph_file): gc.collect() cu_M = graph_file.get_edgelist() diff --git a/python/cugraph/cugraph/tests/internals/test_symmetrize_mg.py b/python/cugraph/cugraph/tests/internals/test_symmetrize_mg.py index d7b59e4f73a..05cc06e6282 100644 --- a/python/cugraph/cugraph/tests/internals/test_symmetrize_mg.py +++ b/python/cugraph/cugraph/tests/internals/test_symmetrize_mg.py @@ -15,11 +15,11 @@ import pytest import pandas as pd -import dask_cudf -from pylibcugraph.testing.utils import gen_fixture_params_product +import dask_cudf import cugraph from cugraph.testing import utils +from pylibcugraph.testing.utils import gen_fixture_params_product # ============================================================================= diff --git a/python/cugraph/cugraph/tests/layout/test_force_atlas2.py b/python/cugraph/cugraph/tests/layout/test_force_atlas2.py index 12d0a4e3aa6..495a2d945c0 100644 --- a/python/cugraph/cugraph/tests/layout/test_force_atlas2.py +++ b/python/cugraph/cugraph/tests/layout/test_force_atlas2.py @@ -13,19 +13,13 @@ import time import pytest +import scipy.io +from sklearn.manifold import trustworthiness import cudf import cugraph from cugraph.internals import GraphBasedDimRedCallback -from sklearn.manifold import trustworthiness -import scipy.io -from cugraph.experimental.datasets import karate, polbooks, dolphins, netscience - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, these import fa2 and import networkx need to be -# relocated in the third-party group once this gets fixed. +from cugraph.datasets import karate, polbooks, dolphins, netscience def cugraph_call( diff --git a/python/cugraph/cugraph/tests/link_analysis/test_hits.py b/python/cugraph/cugraph/tests/link_analysis/test_hits.py index 16d89f20e80..1c5a135e944 100644 --- a/python/cugraph/cugraph/tests/link_analysis/test_hits.py +++ b/python/cugraph/cugraph/tests/link_analysis/test_hits.py @@ -16,12 +16,12 @@ import pytest import networkx as nx import pandas as pd -import cudf -from pylibcugraph.testing.utils import gen_fixture_params_product +import cudf import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED, email_Eu_core, karate +from cugraph.testing import utils, UNDIRECTED_DATASETS +from cugraph.datasets import email_Eu_core, karate +from pylibcugraph.testing.utils import gen_fixture_params_product # ============================================================================= @@ -34,7 +34,7 @@ def setup_function(): # ============================================================================= # Pytest fixtures # ============================================================================= -datasets = DATASETS_UNDIRECTED + [email_Eu_core] +datasets = UNDIRECTED_DATASETS + [email_Eu_core] fixture_params = gen_fixture_params_product( (datasets, "graph_file"), ([50], "max_iter"), diff --git a/python/cugraph/cugraph/tests/link_analysis/test_hits_mg.py b/python/cugraph/cugraph/tests/link_analysis/test_hits_mg.py index 9885d47b24a..bfb33ccd619 100644 --- a/python/cugraph/cugraph/tests/link_analysis/test_hits_mg.py +++ b/python/cugraph/cugraph/tests/link_analysis/test_hits_mg.py @@ -12,16 +12,14 @@ # limitations under the License. import gc + import pytest import dask_cudf -from pylibcugraph.testing.utils import gen_fixture_params_product - import cugraph import cugraph.dask as dcg - -# from cugraph.dask.common.mg_utils import is_single_gpu from cugraph.testing import utils +from pylibcugraph.testing.utils import gen_fixture_params_product # ============================================================================= diff --git a/python/cugraph/cugraph/tests/link_analysis/test_pagerank.py b/python/cugraph/cugraph/tests/link_analysis/test_pagerank.py index b7487ae329c..8e8ab13574d 100644 --- a/python/cugraph/cugraph/tests/link_analysis/test_pagerank.py +++ b/python/cugraph/cugraph/tests/link_analysis/test_pagerank.py @@ -13,26 +13,15 @@ import gc import time -import numpy as np import pytest +import numpy as np +import networkx as nx import cudf import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS, karate - - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx +from cugraph.testing import utils, DEFAULT_DATASETS +from cugraph.datasets import karate print("Networkx version : {} ".format(nx.__version__)) @@ -158,7 +147,7 @@ def setup_function(): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("max_iter", MAX_ITERATIONS) @pytest.mark.parametrize("tol", TOLERANCE) @pytest.mark.parametrize("alpha", ALPHA) @@ -224,7 +213,7 @@ def test_pagerank( @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("max_iter", MAX_ITERATIONS) @pytest.mark.parametrize("tol", TOLERANCE) @pytest.mark.parametrize("alpha", ALPHA) @@ -269,7 +258,7 @@ def test_pagerank_nx(graph_file, max_iter, tol, alpha, personalization_perc, has @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("max_iter", MAX_ITERATIONS) @pytest.mark.parametrize("tol", TOLERANCE) @pytest.mark.parametrize("alpha", ALPHA) diff --git a/python/cugraph/cugraph/tests/link_analysis/test_pagerank_mg.py b/python/cugraph/cugraph/tests/link_analysis/test_pagerank_mg.py index 14a512c59e5..d68aeda4a2f 100644 --- a/python/cugraph/cugraph/tests/link_analysis/test_pagerank_mg.py +++ b/python/cugraph/cugraph/tests/link_analysis/test_pagerank_mg.py @@ -10,23 +10,23 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np -import pytest -import cugraph.dask as dcg + import gc + +import pytest +import numpy as np + +import cudf import cugraph +import cugraph.dask as dcg import dask_cudf from cugraph.testing import utils -import cudf - from cugraph.dask.common.mg_utils import is_single_gpu from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH # The function selects personalization_perc% of accessible vertices in graph M # and randomly assigns them personalization values - - def personalize(vertices, personalization_perc): personalization = None if personalization_perc != 0: diff --git a/python/cugraph/cugraph/tests/link_prediction/test_jaccard.py b/python/cugraph/cugraph/tests/link_prediction/test_jaccard.py index 43077126827..cd883fb88f2 100644 --- a/python/cugraph/cugraph/tests/link_prediction/test_jaccard.py +++ b/python/cugraph/cugraph/tests/link_prediction/test_jaccard.py @@ -12,27 +12,17 @@ # limitations under the License. import gc + import pytest +import networkx as nx import cudf -from cudf.testing import assert_series_equal, assert_frame_equal - import cugraph -from cugraph.testing import utils -from cugraph.experimental import jaccard_coefficient as exp_jaccard_coefficient +from cugraph.datasets import netscience +from cugraph.testing import utils, UNDIRECTED_DATASETS from cugraph.experimental import jaccard as exp_jaccard -from cugraph.experimental.datasets import DATASETS_UNDIRECTED, netscience - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx +from cudf.testing import assert_series_equal, assert_frame_equal +from cugraph.experimental import jaccard_coefficient as exp_jaccard_coefficient print("Networkx version : {} ".format(nx.__version__)) @@ -140,7 +130,7 @@ def networkx_call(M, benchmark_callable=None): # ============================================================================= # Pytest Fixtures # ============================================================================= -@pytest.fixture(scope="module", params=DATASETS_UNDIRECTED) +@pytest.fixture(scope="module", params=UNDIRECTED_DATASETS) def read_csv(request): """ Read csv file for both networkx and cugraph @@ -318,7 +308,7 @@ def test_jaccard_multi_column(read_csv): @pytest.mark.sg def test_weighted_exp_jaccard(): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] G = karate.get_graph() with pytest.raises(ValueError): exp_jaccard(G) @@ -331,7 +321,7 @@ def test_weighted_exp_jaccard(): @pytest.mark.sg def test_invalid_datasets_jaccard(): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] df = karate.get_edgelist() df = df.add(1) G = cugraph.Graph(directed=False) diff --git a/python/cugraph/cugraph/tests/link_prediction/test_jaccard_mg.py b/python/cugraph/cugraph/tests/link_prediction/test_jaccard_mg.py index 35f17d99184..1f7c0a9cadb 100644 --- a/python/cugraph/cugraph/tests/link_prediction/test_jaccard_mg.py +++ b/python/cugraph/cugraph/tests/link_prediction/test_jaccard_mg.py @@ -15,11 +15,12 @@ import random import pytest + import dask_cudf -from pylibcugraph.testing import gen_fixture_params_product -import cugraph.dask as dcg import cugraph +import cugraph.dask as dcg from cugraph.testing import utils +from pylibcugraph.testing import gen_fixture_params_product # ============================================================================= diff --git a/python/cugraph/cugraph/tests/link_prediction/test_overlap.py b/python/cugraph/cugraph/tests/link_prediction/test_overlap.py index 03bee451f3c..586d534cd42 100644 --- a/python/cugraph/cugraph/tests/link_prediction/test_overlap.py +++ b/python/cugraph/cugraph/tests/link_prediction/test_overlap.py @@ -12,18 +12,16 @@ # limitations under the License. import gc + import pytest import numpy as np import scipy import cudf -from cudf.testing import assert_series_equal, assert_frame_equal - -from cugraph.experimental import overlap as exp_overlap - import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED +from cugraph.testing import utils, UNDIRECTED_DATASETS +from cugraph.experimental import overlap as exp_overlap +from cudf.testing import assert_series_equal, assert_frame_equal # ============================================================================= @@ -113,7 +111,7 @@ def cpu_call(M, first, second): # ============================================================================= # Pytest Fixtures # ============================================================================= -@pytest.fixture(scope="module", params=DATASETS_UNDIRECTED) +@pytest.fixture(scope="module", params=UNDIRECTED_DATASETS) def read_csv(request): """ Read csv file for both networkx and cugraph @@ -171,7 +169,7 @@ def test_overlap_edge_vals(gpubenchmark, read_csv, extract_two_hop): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_overlap_multi_column(graph_file): dataset_path = graph_file.get_path() M = utils.read_csv_for_nx(dataset_path) @@ -216,7 +214,7 @@ def test_overlap_multi_column(graph_file): @pytest.mark.sg def test_weighted_exp_overlap(): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] G = karate.get_graph() with pytest.raises(ValueError): exp_overlap(G) @@ -229,7 +227,7 @@ def test_weighted_exp_overlap(): @pytest.mark.sg def test_invalid_datasets_overlap(): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] df = karate.get_edgelist() df = df.add(1) G = cugraph.Graph(directed=False) diff --git a/python/cugraph/cugraph/tests/link_prediction/test_overlap_mg.py b/python/cugraph/cugraph/tests/link_prediction/test_overlap_mg.py index 541e3123e78..220b90cbb47 100644 --- a/python/cugraph/cugraph/tests/link_prediction/test_overlap_mg.py +++ b/python/cugraph/cugraph/tests/link_prediction/test_overlap_mg.py @@ -15,12 +15,12 @@ import random import pytest -import dask_cudf -from pylibcugraph.testing import gen_fixture_params_product import cugraph +import dask_cudf import cugraph.dask as dcg from cugraph.testing import utils +from pylibcugraph.testing import gen_fixture_params_product # ============================================================================= diff --git a/python/cugraph/cugraph/tests/link_prediction/test_sorensen.py b/python/cugraph/cugraph/tests/link_prediction/test_sorensen.py index 14d84784161..3da33a3e853 100644 --- a/python/cugraph/cugraph/tests/link_prediction/test_sorensen.py +++ b/python/cugraph/cugraph/tests/link_prediction/test_sorensen.py @@ -12,26 +12,16 @@ # limitations under the License. import gc + import pytest +import networkx as nx import cudf -from cudf.testing import assert_series_equal, assert_frame_equal - import cugraph -from cugraph.testing import utils +from cugraph.testing import utils, UNDIRECTED_DATASETS +from cugraph.datasets import netscience from cugraph.experimental import sorensen as exp_sorensen -from cugraph.experimental.datasets import DATASETS_UNDIRECTED, netscience - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx +from cudf.testing import assert_series_equal, assert_frame_equal print("Networkx version : {} ".format(nx.__version__)) @@ -145,7 +135,7 @@ def networkx_call(M, benchmark_callable=None): # ============================================================================= # Pytest Fixtures # ============================================================================= -@pytest.fixture(scope="module", params=DATASETS_UNDIRECTED) +@pytest.fixture(scope="module", params=UNDIRECTED_DATASETS) def read_csv(request): """ Read csv file for both networkx and cugraph @@ -280,7 +270,7 @@ def test_sorensen_multi_column(read_csv): @pytest.mark.sg def test_weighted_exp_sorensen(): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] G = karate.get_graph() with pytest.raises(ValueError): exp_sorensen(G) @@ -293,7 +283,7 @@ def test_weighted_exp_sorensen(): @pytest.mark.sg def test_invalid_datasets_sorensen(): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] df = karate.get_edgelist() df = df.add(1) G = cugraph.Graph(directed=False) diff --git a/python/cugraph/cugraph/tests/link_prediction/test_sorensen_mg.py b/python/cugraph/cugraph/tests/link_prediction/test_sorensen_mg.py index 7c84fce989b..d9d013c7e35 100644 --- a/python/cugraph/cugraph/tests/link_prediction/test_sorensen_mg.py +++ b/python/cugraph/cugraph/tests/link_prediction/test_sorensen_mg.py @@ -12,16 +12,16 @@ # limitations under the License. import gc + import random import pytest +import cugraph import dask_cudf -from pylibcugraph.testing import gen_fixture_params_product -from cugraph.dask.common.mg_utils import is_single_gpu - import cugraph.dask as dcg -import cugraph from cugraph.testing import utils +from cugraph.dask.common.mg_utils import is_single_gpu +from pylibcugraph.testing import gen_fixture_params_product # ============================================================================= diff --git a/python/cugraph/cugraph/tests/link_prediction/test_wjaccard.py b/python/cugraph/cugraph/tests/link_prediction/test_wjaccard.py index 2bc39b877ea..36a21df46b8 100644 --- a/python/cugraph/cugraph/tests/link_prediction/test_wjaccard.py +++ b/python/cugraph/cugraph/tests/link_prediction/test_wjaccard.py @@ -13,27 +13,15 @@ import gc -import numpy as np import pytest +import numpy as np +import networkx as nx import cudf -from cudf.testing import assert_series_equal - import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED - - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings +from cugraph.testing import utils, UNDIRECTED_DATASETS +from cudf.testing import assert_series_equal -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx print("Networkx version : {} ".format(nx.__version__)) @@ -97,7 +85,7 @@ def networkx_call(M, benchmark_callable=None): # ============================================================================= # Pytest Fixtures # ============================================================================= -@pytest.fixture(scope="module", params=DATASETS_UNDIRECTED) +@pytest.fixture(scope="module", params=UNDIRECTED_DATASETS) def read_csv(request): """ Read csv file for both networkx and cugraph @@ -180,7 +168,7 @@ def test_wjaccard_multi_column(read_csv): @pytest.mark.sg def test_invalid_datasets_jaccard_w(): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] df = karate.get_edgelist() df = df.add(1) G = cugraph.Graph(directed=False) diff --git a/python/cugraph/cugraph/tests/link_prediction/test_woverlap.py b/python/cugraph/cugraph/tests/link_prediction/test_woverlap.py index 5e35bb66f07..1dffb9fca41 100644 --- a/python/cugraph/cugraph/tests/link_prediction/test_woverlap.py +++ b/python/cugraph/cugraph/tests/link_prediction/test_woverlap.py @@ -16,12 +16,11 @@ import pytest import scipy import numpy as np -import cudf -from cudf.testing import assert_series_equal -from cugraph.experimental.datasets import DATASETS_UNDIRECTED +import cudf import cugraph -from cugraph.testing import utils +from cudf.testing import assert_series_equal +from cugraph.testing import utils, UNDIRECTED_DATASETS # ============================================================================= @@ -94,7 +93,7 @@ def cpu_call(M, first, second): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_woverlap(gpubenchmark, graph_file): dataset_path = graph_file.get_path() Mnx = utils.read_csv_for_nx(dataset_path) @@ -122,7 +121,7 @@ def test_woverlap(gpubenchmark, graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_woverlap_multi_column(graph_file): dataset_path = graph_file.get_path() M = utils.read_csv_for_nx(dataset_path) @@ -163,7 +162,7 @@ def test_woverlap_multi_column(graph_file): @pytest.mark.sg def test_invalid_datasets_overlap_w(): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] df = karate.get_edgelist() df = df.add(1) G = cugraph.Graph(directed=False) diff --git a/python/cugraph/cugraph/tests/link_prediction/test_wsorensen.py b/python/cugraph/cugraph/tests/link_prediction/test_wsorensen.py index cca2363d2d6..8d09b3e25b3 100644 --- a/python/cugraph/cugraph/tests/link_prediction/test_wsorensen.py +++ b/python/cugraph/cugraph/tests/link_prediction/test_wsorensen.py @@ -13,27 +13,15 @@ import gc -import numpy as np import pytest +import numpy as np +import networkx as nx import cudf -from cudf.testing import assert_series_equal - import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED - - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings +from cudf.testing import assert_series_equal +from cugraph.testing import utils, UNDIRECTED_DATASETS -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx print("Networkx version : {} ".format(nx.__version__)) @@ -101,7 +89,7 @@ def networkx_call(M, benchmark_callable=None): # ============================================================================= # Pytest Fixtures # ============================================================================= -@pytest.fixture(scope="module", params=DATASETS_UNDIRECTED) +@pytest.fixture(scope="module", params=UNDIRECTED_DATASETS) def read_csv(request): """ Read csv file for both networkx and cugraph @@ -184,7 +172,7 @@ def test_wsorensen_multi_column(read_csv): @pytest.mark.sg def test_invalid_datasets_sorensen_w(): - karate = DATASETS_UNDIRECTED[0] + karate = UNDIRECTED_DATASETS[0] df = karate.get_edgelist() df = df.add(1) G = cugraph.Graph(directed=False) diff --git a/python/cugraph/cugraph/tests/nx/test_compat_algo.py b/python/cugraph/cugraph/tests/nx/test_compat_algo.py index 2a074d588eb..4b9160da416 100644 --- a/python/cugraph/cugraph/tests/nx/test_compat_algo.py +++ b/python/cugraph/cugraph/tests/nx/test_compat_algo.py @@ -11,8 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cugraph.experimental.compat.nx as nx import pytest +import cugraph.experimental.compat.nx as nx @pytest.mark.sg diff --git a/python/cugraph/cugraph/tests/nx/test_compat_pr.py b/python/cugraph/cugraph/tests/nx/test_compat_pr.py index a8dc6f7bb22..9be3912a33f 100644 --- a/python/cugraph/cugraph/tests/nx/test_compat_pr.py +++ b/python/cugraph/cugraph/tests/nx/test_compat_pr.py @@ -22,10 +22,10 @@ import pytest import numpy as np -from pylibcugraph.testing.utils import gen_fixture_params_product from cugraph.testing import utils from cugraph.experimental.datasets import karate +from pylibcugraph.testing.utils import gen_fixture_params_product MAX_ITERATIONS = [100, 200] diff --git a/python/cugraph/cugraph/tests/nx/test_nx_convert.py b/python/cugraph/cugraph/tests/nx/test_nx_convert.py index ee14bfe361c..58b89a4bda9 100644 --- a/python/cugraph/cugraph/tests/nx/test_nx_convert.py +++ b/python/cugraph/cugraph/tests/nx/test_nx_convert.py @@ -11,25 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pandas as pd import pytest -import cudf +import pandas as pd +import networkx as nx +import cudf import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS - - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx +from cugraph.testing import utils, DEFAULT_DATASETS def _compare_graphs(nxG, cuG, has_wt=True): @@ -70,7 +58,7 @@ def _compare_graphs(nxG, cuG, has_wt=True): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_networkx_compatibility(graph_file): # test to make sure cuGraph and Nx build similar Graphs # Read in the graph @@ -97,7 +85,7 @@ def test_networkx_compatibility(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_nx_convert_undirected(graph_file): # read data and create a Nx Graph dataset_path = graph_file.get_path() @@ -114,7 +102,7 @@ def test_nx_convert_undirected(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_nx_convert_directed(graph_file): # read data and create a Nx DiGraph dataset_path = graph_file.get_path() @@ -130,7 +118,7 @@ def test_nx_convert_directed(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_nx_convert_weighted(graph_file): # read data and create a Nx DiGraph dataset_path = graph_file.get_path() @@ -147,7 +135,7 @@ def test_nx_convert_weighted(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_nx_convert_multicol(graph_file): # read data and create a Nx Graph dataset_path = graph_file.get_path() diff --git a/python/cugraph/cugraph/tests/sampling/test_bulk_sampler.py b/python/cugraph/cugraph/tests/sampling/test_bulk_sampler.py index 553cd5cf788..cbd8321a338 100644 --- a/python/cugraph/cugraph/tests/sampling/test_bulk_sampler.py +++ b/python/cugraph/cugraph/tests/sampling/test_bulk_sampler.py @@ -12,10 +12,11 @@ # limitations under the License. import pytest + import cudf import cupy import cugraph -from cugraph.experimental.datasets import karate +from cugraph.datasets import karate from cugraph.experimental.gnn import BulkSampler from cugraph.utilities.utils import create_directory_with_overwrite diff --git a/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_io.py b/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_io.py index ffbba74f229..0b4b9fa73de 100644 --- a/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_io.py +++ b/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_io.py @@ -11,11 +11,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pytest -import cudf import os import shutil +import pytest + +import cudf from cugraph.gnn.data_loading.bulk_sampler_io import write_samples from cugraph.utilities.utils import create_directory_with_overwrite diff --git a/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_io_mg.py b/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_io_mg.py index 7c96c899ce1..4115eca1c1f 100644 --- a/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_io_mg.py +++ b/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_io_mg.py @@ -11,14 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import shutil + import pytest import cudf import dask_cudf - -import os -import shutil - from cugraph.gnn.data_loading.bulk_sampler_io import write_samples from cugraph.utilities.utils import create_directory_with_overwrite diff --git a/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_mg.py b/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_mg.py index e20b6883209..b7cd4b0822b 100644 --- a/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_mg.py +++ b/python/cugraph/cugraph/tests/sampling/test_bulk_sampler_mg.py @@ -11,19 +11,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os +import shutil +import re + import pytest + import cudf -import dask_cudf import cupy import cugraph -from cugraph.experimental.datasets import karate +import dask_cudf +from cugraph.datasets import karate from cugraph.experimental import BulkSampler from cugraph.utilities.utils import create_directory_with_overwrite -import os -import shutil -import re - @pytest.mark.mg def test_bulk_sampler_simple(dask_client, scratch_dir): diff --git a/python/cugraph/cugraph/tests/sampling/test_egonet.py b/python/cugraph/cugraph/tests/sampling/test_egonet.py index 2af31438a13..1ae7fcc0c88 100644 --- a/python/cugraph/cugraph/tests/sampling/test_egonet.py +++ b/python/cugraph/cugraph/tests/sampling/test_egonet.py @@ -12,23 +12,14 @@ # limitations under the License. import gc + import pytest +import networkx as nx import cudf import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings +from cugraph.testing import utils, DEFAULT_DATASETS -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx print("Networkx version : {} ".format(nx.__version__)) @@ -37,7 +28,7 @@ @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("seed", SEEDS) @pytest.mark.parametrize("radius", RADIUS) def test_ego_graph_nx(graph_file, seed, radius): @@ -58,7 +49,7 @@ def test_ego_graph_nx(graph_file, seed, radius): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("seeds", [[0, 5, 13]]) @pytest.mark.parametrize("radius", [1, 2, 3]) def test_batched_ego_graphs(graph_file, seeds, radius): @@ -83,7 +74,7 @@ def test_batched_ego_graphs(graph_file, seeds, radius): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("seed", SEEDS) @pytest.mark.parametrize("radius", RADIUS) def test_multi_column_ego_graph(graph_file, seed, radius): diff --git a/python/cugraph/cugraph/tests/sampling/test_egonet_mg.py b/python/cugraph/cugraph/tests/sampling/test_egonet_mg.py index 172296c07f9..7f5891abdd3 100644 --- a/python/cugraph/cugraph/tests/sampling/test_egonet_mg.py +++ b/python/cugraph/cugraph/tests/sampling/test_egonet_mg.py @@ -12,16 +12,16 @@ # limitations under the License. import gc -import pytest -import dask_cudf -from cudf.testing.testing import assert_frame_equal, assert_series_equal -from pylibcugraph.testing import gen_fixture_params_product +import pytest import cugraph +import dask_cudf import cugraph.dask as dcg from cugraph.testing import utils from cugraph.dask.common.mg_utils import is_single_gpu +from pylibcugraph.testing import gen_fixture_params_product +from cudf.testing.testing import assert_frame_equal, assert_series_equal # ============================================================================= diff --git a/python/cugraph/cugraph/tests/sampling/test_node2vec.py b/python/cugraph/cugraph/tests/sampling/test_node2vec.py index 60b937cc1b2..0bfdd460cae 100644 --- a/python/cugraph/cugraph/tests/sampling/test_node2vec.py +++ b/python/cugraph/cugraph/tests/sampling/test_node2vec.py @@ -13,12 +13,13 @@ import gc import random + import pytest -from cugraph.testing import utils -import cugraph import cudf -from cugraph.experimental.datasets import small_line, karate, DATASETS_SMALL +import cugraph +from cugraph.datasets import small_line, karate +from cugraph.testing import utils, SMALL_DATASETS # ============================================================================= @@ -75,7 +76,7 @@ def calc_node2vec(G, start_vertices, max_depth, compress_result, p=1.0, q=1.0): @pytest.mark.sg @pytest.mark.parametrize(*_get_param_args("graph_file", [KARATE])) def test_node2vec_invalid(graph_file): - G = graph_file.get_graph(create_using=cugraph.Graph(directed=True)) + G = graph_file.get_graph(download=True, create_using=cugraph.Graph(directed=True)) k = random.randint(1, 10) start_vertices = cudf.Series( random.sample(range(G.number_of_vertices()), k), dtype="int32" @@ -135,7 +136,9 @@ def test_node2vec_invalid(graph_file): @pytest.mark.parametrize(*_get_param_args("graph_file", [LINE])) @pytest.mark.parametrize(*_get_param_args("directed", DIRECTED_GRAPH_OPTIONS)) def test_node2vec_line(graph_file, directed): - G = graph_file.get_graph(create_using=cugraph.Graph(directed=directed)) + G = graph_file.get_graph( + download=True, create_using=cugraph.Graph(directed=directed) + ) max_depth = 3 start_vertices = cudf.Series([0, 3, 6], dtype="int32") df, seeds = calc_node2vec( @@ -144,7 +147,7 @@ def test_node2vec_line(graph_file, directed): @pytest.mark.sg -@pytest.mark.parametrize(*_get_param_args("graph_file", DATASETS_SMALL)) +@pytest.mark.parametrize(*_get_param_args("graph_file", SMALL_DATASETS)) @pytest.mark.parametrize(*_get_param_args("directed", DIRECTED_GRAPH_OPTIONS)) @pytest.mark.parametrize(*_get_param_args("compress", COMPRESSED)) def test_node2vec( diff --git a/python/cugraph/cugraph/tests/sampling/test_random_walks.py b/python/cugraph/cugraph/tests/sampling/test_random_walks.py index 508f927c296..48629fa03a6 100644 --- a/python/cugraph/cugraph/tests/sampling/test_random_walks.py +++ b/python/cugraph/cugraph/tests/sampling/test_random_walks.py @@ -15,21 +15,22 @@ import random import pytest -from cudf.testing import assert_series_equal +import networkx as nx -import cugraph import cudf -import networkx as nx +import cugraph +from cudf.testing import assert_series_equal from cugraph.utilities import ensure_cugraph_obj_for_nx -from cugraph.experimental.datasets import DATASETS, DATASETS_SMALL +from cugraph.testing import SMALL_DATASETS, DEFAULT_DATASETS + # ============================================================================= # Parameters # ============================================================================= DIRECTED_GRAPH_OPTIONS = [False, True] WEIGHTED_GRAPH_OPTIONS = [False, True] -DATASETS = [pytest.param(d) for d in DATASETS] -DATASETS_SMALL = [pytest.param(d) for d in DATASETS_SMALL] +DATASETS = [pytest.param(d) for d in DEFAULT_DATASETS] +SMALL_DATASETS = [pytest.param(d) for d in SMALL_DATASETS] # ============================================================================= @@ -207,7 +208,7 @@ def check_random_walks_padded(G, path_data, seeds, max_depth, legacy_result_type @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) @pytest.mark.parametrize("max_depth", [None]) def test_random_walks_invalid_max_dept(graph_file, directed, max_depth): @@ -219,7 +220,7 @@ def test_random_walks_invalid_max_dept(graph_file, directed, max_depth): @pytest.mark.sg @pytest.mark.cugraph_ops -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) def test_random_walks_coalesced(graph_file, directed): max_depth = random.randint(2, 10) @@ -243,7 +244,7 @@ def test_random_walks_coalesced(graph_file, directed): @pytest.mark.sg @pytest.mark.cugraph_ops -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) @pytest.mark.parametrize("directed", DIRECTED_GRAPH_OPTIONS) def test_random_walks_padded_0(graph_file, directed): max_depth = random.randint(2, 10) @@ -291,7 +292,7 @@ def test_random_walks_padded_1(): @pytest.mark.sg @pytest.mark.cugraph_ops -@pytest.mark.parametrize("graph_file", DATASETS_SMALL) +@pytest.mark.parametrize("graph_file", SMALL_DATASETS) def test_random_walks_nx(graph_file): G = graph_file.get_graph(create_using=cugraph.Graph(directed=True)) diff --git a/python/cugraph/cugraph/tests/sampling/test_random_walks_mg.py b/python/cugraph/cugraph/tests/sampling/test_random_walks_mg.py index df1db0a95a9..a8aa34710ec 100644 --- a/python/cugraph/cugraph/tests/sampling/test_random_walks_mg.py +++ b/python/cugraph/cugraph/tests/sampling/test_random_walks_mg.py @@ -15,14 +15,13 @@ import random import pytest -import dask_cudf -from pylibcugraph.testing.utils import gen_fixture_params_product import cugraph - -# from cugraph.dask.common.mg_utils import is_single_gpu +import dask_cudf import cugraph.dask as dcg -from cugraph.experimental.datasets import DATASETS_SMALL, karate_asymmetric +from cugraph.testing import SMALL_DATASETS +from cugraph.datasets import karate_asymmetric +from pylibcugraph.testing.utils import gen_fixture_params_product # ============================================================================= @@ -41,7 +40,7 @@ def setup_function(): # Pytest fixtures # ============================================================================= -datasets = DATASETS_SMALL + [karate_asymmetric] +datasets = SMALL_DATASETS + [karate_asymmetric] fixture_params = gen_fixture_params_product( (datasets, "graph_file"), diff --git a/python/cugraph/cugraph/tests/sampling/test_uniform_neighbor_sample.py b/python/cugraph/cugraph/tests/sampling/test_uniform_neighbor_sample.py index 49fce5dbe61..62599291d04 100644 --- a/python/cugraph/cugraph/tests/sampling/test_uniform_neighbor_sample.py +++ b/python/cugraph/cugraph/tests/sampling/test_uniform_neighbor_sample.py @@ -14,12 +14,13 @@ import random import pytest -import cudf -from pylibcugraph.testing.utils import gen_fixture_params_product +import cudf import cugraph from cugraph import uniform_neighbor_sample -from cugraph.experimental.datasets import DATASETS_UNDIRECTED, email_Eu_core, small_tree +from cugraph.testing import UNDIRECTED_DATASETS +from cugraph.datasets import email_Eu_core, small_tree +from pylibcugraph.testing.utils import gen_fixture_params_product # ============================================================================= @@ -34,7 +35,7 @@ def setup_function(): # ============================================================================= IS_DIRECTED = [True, False] -datasets = DATASETS_UNDIRECTED + [email_Eu_core] +datasets = UNDIRECTED_DATASETS + [email_Eu_core] fixture_params = gen_fixture_params_product( (datasets, "graph_file"), diff --git a/python/cugraph/cugraph/tests/sampling/test_uniform_neighbor_sample_mg.py b/python/cugraph/cugraph/tests/sampling/test_uniform_neighbor_sample_mg.py index f1003a8a75b..9d87c097287 100644 --- a/python/cugraph/cugraph/tests/sampling/test_uniform_neighbor_sample_mg.py +++ b/python/cugraph/cugraph/tests/sampling/test_uniform_neighbor_sample_mg.py @@ -10,22 +10,23 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import gc import random import os import pytest + import cupy import cudf +import cugraph import dask_cudf -from pylibcugraph.testing.utils import gen_fixture_params_product -from cugraph.dask.common.mg_utils import is_single_gpu - import cugraph.dask as dcg -import cugraph - +from cugraph.testing import UNDIRECTED_DATASETS from cugraph.dask import uniform_neighbor_sample -from cugraph.experimental.datasets import DATASETS_UNDIRECTED, email_Eu_core, small_tree +from cugraph.dask.common.mg_utils import is_single_gpu +from cugraph.datasets import email_Eu_core, small_tree +from pylibcugraph.testing.utils import gen_fixture_params_product # If the rapids-pytest-benchmark plugin is installed, the "gpubenchmark" # fixture will be available automatically. Check that this fixture is available @@ -53,7 +54,7 @@ def setup_function(): # ============================================================================= IS_DIRECTED = [True, False] -datasets = DATASETS_UNDIRECTED + [email_Eu_core] +datasets = UNDIRECTED_DATASETS + [email_Eu_core] fixture_params = gen_fixture_params_product( (datasets, "graph_file"), diff --git a/python/cugraph/cugraph/tests/structure/test_convert_matrix.py b/python/cugraph/cugraph/tests/structure/test_convert_matrix.py index cc044d774af..2158cae3ab2 100644 --- a/python/cugraph/cugraph/tests/structure/test_convert_matrix.py +++ b/python/cugraph/cugraph/tests/structure/test_convert_matrix.py @@ -12,21 +12,13 @@ # limitations under the License. import gc + import pytest -import cugraph -from cugraph.testing import utils import numpy as np +import networkx as nx -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx +import cugraph +from cugraph.testing import utils # ============================================================================= diff --git a/python/cugraph/cugraph/tests/structure/test_graph.py b/python/cugraph/cugraph/tests/structure/test_graph.py index 1b883b91e92..a80c47662e2 100644 --- a/python/cugraph/cugraph/tests/structure/test_graph.py +++ b/python/cugraph/cugraph/tests/structure/test_graph.py @@ -12,43 +12,29 @@ # limitations under the License. import gc - import time -import pandas as pd import pytest - +import pandas as pd import scipy +import networkx as nx + +import cupy import cudf -from cudf.testing.testing import assert_frame_equal import cugraph from cugraph.testing import utils from cudf.testing import assert_series_equal - -import cupy +from cudf.testing.testing import assert_frame_equal # MG +import dask_cudf import cugraph.dask as dcg -from cugraph.dask.common.mg_utils import is_single_gpu -from dask_cuda import LocalCUDACluster from dask.distributed import Client -import dask_cudf - -from pylibcugraph import bfs as pylibcugraph_bfs +from dask_cuda import LocalCUDACluster from pylibcugraph import ResourceHandle - +from pylibcugraph import bfs as pylibcugraph_bfs from cugraph.dask.traversal.bfs import convert_to_cudf - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx +from cugraph.dask.common.mg_utils import is_single_gpu # ============================================================================= diff --git a/python/cugraph/cugraph/tests/structure/test_graph_mg.py b/python/cugraph/cugraph/tests/structure/test_graph_mg.py index ebaae38a8a4..707b195dfa8 100644 --- a/python/cugraph/cugraph/tests/structure/test_graph_mg.py +++ b/python/cugraph/cugraph/tests/structure/test_graph_mg.py @@ -12,23 +12,24 @@ # limitations under the License. import gc import random -import copy + import pytest +import copy + import cupy -from dask.distributed import wait import cudf -import dask_cudf -from pylibcugraph import bfs as pylibcugraph_bfs -from pylibcugraph import ResourceHandle -from pylibcugraph.testing.utils import gen_fixture_params_product -from cudf.testing.testing import assert_frame_equal - import cugraph +import dask_cudf import cugraph.dask as dcg +import cugraph.dask.comms.comms as Comms from cugraph.testing import utils +from dask.distributed import wait +from pylibcugraph import ResourceHandle +from pylibcugraph import bfs as pylibcugraph_bfs +from cudf.testing.testing import assert_frame_equal from cugraph.dask.traversal.bfs import convert_to_cudf -import cugraph.dask.comms.comms as Comms from cugraph.dask.common.input_utils import get_distributed_data +from pylibcugraph.testing.utils import gen_fixture_params_product # ============================================================================= diff --git a/python/cugraph/cugraph/tests/structure/test_multigraph.py b/python/cugraph/cugraph/tests/structure/test_multigraph.py index e317a935cfc..af78c238d4e 100644 --- a/python/cugraph/cugraph/tests/structure/test_multigraph.py +++ b/python/cugraph/cugraph/tests/structure/test_multigraph.py @@ -14,12 +14,11 @@ import gc import pytest -import networkx as nx import numpy as np +import networkx as nx import cugraph -from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS +from cugraph.testing import utils, DEFAULT_DATASETS # ============================================================================= @@ -30,7 +29,7 @@ def setup_function(): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_multigraph(graph_file): # FIXME: Migrate to new test fixtures for Graph setup once available G = graph_file.get_graph(create_using=cugraph.MultiGraph(directed=True)) @@ -61,7 +60,7 @@ def test_multigraph(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_Graph_from_MultiGraph(graph_file): # FIXME: Migrate to new test fixtures for Graph setup once available GM = graph_file.get_graph(create_using=cugraph.MultiGraph()) @@ -92,7 +91,7 @@ def test_Graph_from_MultiGraph(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) def test_multigraph_sssp(graph_file): # FIXME: Migrate to new test fixtures for Graph setup once available G = graph_file.get_graph(create_using=cugraph.MultiGraph(directed=True)) diff --git a/python/cugraph/cugraph/tests/traversal/test_bfs.py b/python/cugraph/cugraph/tests/traversal/test_bfs.py index 7446b32ee5d..89b00e66baa 100644 --- a/python/cugraph/cugraph/tests/traversal/test_bfs.py +++ b/python/cugraph/cugraph/tests/traversal/test_bfs.py @@ -15,33 +15,22 @@ import random import pytest -import pandas as pd import cupy as cp import numpy as np -from cupyx.scipy.sparse import coo_matrix as cp_coo_matrix -from cupyx.scipy.sparse import csr_matrix as cp_csr_matrix -from cupyx.scipy.sparse import csc_matrix as cp_csc_matrix +import pandas as pd +import networkx as nx +import networkx.algorithms.centrality.betweenness as nxacb from scipy.sparse import coo_matrix as sp_coo_matrix from scipy.sparse import csr_matrix as sp_csr_matrix from scipy.sparse import csc_matrix as sp_csc_matrix -import cudf -from pylibcugraph.testing.utils import gen_fixture_params_product +import cudf import cugraph -from cugraph.testing import utils -from cugraph.experimental import datasets - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx - import networkx.algorithms.centrality.betweenness as nxacb +from cupyx.scipy.sparse import coo_matrix as cp_coo_matrix +from cupyx.scipy.sparse import csr_matrix as cp_csr_matrix +from cupyx.scipy.sparse import csc_matrix as cp_csc_matrix +from pylibcugraph.testing.utils import gen_fixture_params_product +from cugraph.testing import utils, DEFAULT_DATASETS, SMALL_DATASETS # ============================================================================= @@ -291,8 +280,8 @@ def get_cu_graph_nx_results_and_params(seed, depth_limit, G, dataset, directed, # ============================================================================= SEEDS = [pytest.param(s) for s in SUBSET_SEED_OPTIONS] DIRECTED = [pytest.param(d) for d in DIRECTED_GRAPH_OPTIONS] -DATASETS = [pytest.param(d) for d in datasets.DATASETS] -DATASETS_SMALL = [pytest.param(d) for d in datasets.DATASETS_SMALL] +DATASETS = [pytest.param(d) for d in DEFAULT_DATASETS] +SMALL_DATASETS = [pytest.param(d) for d in SMALL_DATASETS] DEPTH_LIMIT = [pytest.param(d) for d in DEPTH_LIMITS] # Call gen_fixture_params_product() to caluculate the cartesian product of @@ -309,7 +298,7 @@ def get_cu_graph_nx_results_and_params(seed, depth_limit, G, dataset, directed, ) small_graph_fixture_params = gen_fixture_params_product( - (DATASETS_SMALL, "ds"), (DIRECTED, "dirctd") + (SMALL_DATASETS, "ds"), (DIRECTED, "dirctd") ) # The single param list variants are used when only 1 param combination is @@ -320,7 +309,7 @@ def get_cu_graph_nx_results_and_params(seed, depth_limit, G, dataset, directed, ) single_small_graph_fixture_params = gen_fixture_params_product( - ([DATASETS_SMALL[0]], "ds"), (DIRECTED, "dirctd") + ([SMALL_DATASETS[0]], "ds"), (DIRECTED, "dirctd") ) @@ -449,7 +438,7 @@ def test_bfs_invalid_start( @pytest.mark.sg def test_scipy_api_compat(): - graph_file = datasets.DATASETS[0] + graph_file = DEFAULT_DATASETS[0] dataset_path = graph_file.get_path() input_cugraph_graph = graph_file.get_graph(ignore_weights=True) diff --git a/python/cugraph/cugraph/tests/traversal/test_bfs_mg.py b/python/cugraph/cugraph/tests/traversal/test_bfs_mg.py index 4b5c270034f..38b5a2734d6 100644 --- a/python/cugraph/cugraph/tests/traversal/test_bfs_mg.py +++ b/python/cugraph/cugraph/tests/traversal/test_bfs_mg.py @@ -11,16 +11,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pytest -import cugraph.dask as dcg import gc -# import pytest +import pytest + +import cudf import cugraph import dask_cudf -import cudf - -# from cugraph.dask.common.mg_utils import is_single_gpu +import cugraph.dask as dcg from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH # ============================================================================= diff --git a/python/cugraph/cugraph/tests/traversal/test_filter_unreachable.py b/python/cugraph/cugraph/tests/traversal/test_filter_unreachable.py index 495e1a4ec11..c9a44eea1e6 100644 --- a/python/cugraph/cugraph/tests/traversal/test_filter_unreachable.py +++ b/python/cugraph/cugraph/tests/traversal/test_filter_unreachable.py @@ -13,18 +13,13 @@ import gc import time + import pytest import numpy as np +import networkx as nx import cugraph -from cugraph.experimental.datasets import DATASETS - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings +from cugraph.testing import DEFAULT_DATASETS # ============================================================================= @@ -34,18 +29,13 @@ def setup_function(): gc.collect() -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx - - print("Networkx version : {} ".format(nx.__version__)) SOURCES = [1] @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS) +@pytest.mark.parametrize("graph_file", DEFAULT_DATASETS) @pytest.mark.parametrize("source", SOURCES) def test_filter_unreachable(graph_file, source): G = graph_file.get_graph(create_using=cugraph.Graph(directed=True)) diff --git a/python/cugraph/cugraph/tests/traversal/test_paths.py b/python/cugraph/cugraph/tests/traversal/test_paths.py index 8938ae74553..8a751ba8840 100644 --- a/python/cugraph/cugraph/tests/traversal/test_paths.py +++ b/python/cugraph/cugraph/tests/traversal/test_paths.py @@ -15,13 +15,13 @@ from tempfile import NamedTemporaryFile import math -import cudf -from cupyx.scipy.sparse import coo_matrix as cupy_coo_matrix -import cupy -import networkx as nx import pytest +import networkx as nx +import cudf +import cupy import cugraph +from cupyx.scipy.sparse import coo_matrix as cupy_coo_matrix CONNECTED_GRAPH = """1,5,3 diff --git a/python/cugraph/cugraph/tests/traversal/test_sssp.py b/python/cugraph/cugraph/tests/traversal/test_sssp.py index 1c99123f866..0d2646b29be 100644 --- a/python/cugraph/cugraph/tests/traversal/test_sssp.py +++ b/python/cugraph/cugraph/tests/traversal/test_sssp.py @@ -14,36 +14,24 @@ import gc import time -import numpy as np import pytest +import numpy as np import pandas as pd -import cupy as cp +import networkx as nx + +import cudf import cupyx +import cugraph +import cupy as cp from cupyx.scipy.sparse import coo_matrix as cp_coo_matrix from cupyx.scipy.sparse import csr_matrix as cp_csr_matrix from cupyx.scipy.sparse import csc_matrix as cp_csc_matrix from scipy.sparse import coo_matrix as sp_coo_matrix from scipy.sparse import csr_matrix as sp_csr_matrix from scipy.sparse import csc_matrix as sp_csc_matrix -import cudf from pylibcugraph.testing.utils import gen_fixture_params_product -from cugraph.experimental.datasets import DATASETS_UNDIRECTED - -import cugraph -from cugraph.testing import utils -from cugraph.experimental import datasets - - -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings +from cugraph.testing import utils, UNDIRECTED_DATASETS, SMALL_DATASETS -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx print("Networkx version : {} ".format(nx.__version__)) @@ -186,7 +174,7 @@ def networkx_call(graph_file, source, edgevals=True): # FIXME: tests with datasets like 'netscience' which has a weight column different # than than 1's fail because it looks like netwokX doesn't consider weights during # the computation. -DATASETS = [pytest.param(d) for d in datasets.DATASETS_SMALL] +DATASETS = [pytest.param(d) for d in SMALL_DATASETS] SOURCES = [pytest.param(1)] fixture_params = gen_fixture_params_product((DATASETS, "ds"), (SOURCES, "src")) fixture_params_single_dataset = gen_fixture_params_product( @@ -396,7 +384,7 @@ def test_sssp_networkx_edge_attr(): @pytest.mark.sg def test_scipy_api_compat(): - graph_file = datasets.DATASETS[0] + graph_file = SMALL_DATASETS[0] dataset_path = graph_file.get_path() input_cugraph_graph = graph_file.get_graph() input_coo_matrix = utils.create_obj_from_csv( @@ -465,7 +453,7 @@ def test_scipy_api_compat(): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED) +@pytest.mark.parametrize("graph_file", UNDIRECTED_DATASETS) def test_sssp_csr_graph(graph_file): df = graph_file.get_edgelist() @@ -507,7 +495,7 @@ def test_sssp_csr_graph(graph_file): @pytest.mark.sg def test_sssp_unweighted_graph(): - karate = DATASETS_UNDIRECTED[0] + karate = SMALL_DATASETS[0] G = karate.get_graph(ignore_weights=True) error_msg = ( diff --git a/python/cugraph/cugraph/tests/traversal/test_sssp_mg.py b/python/cugraph/cugraph/tests/traversal/test_sssp_mg.py index 867f125ea6f..1720a051ee7 100644 --- a/python/cugraph/cugraph/tests/traversal/test_sssp_mg.py +++ b/python/cugraph/cugraph/tests/traversal/test_sssp_mg.py @@ -11,18 +11,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pytest -import cugraph.dask as dcg import gc -# import pytest +import pytest + +import cudf import cugraph import dask_cudf -import cudf - -# from cugraph.dask.common.mg_utils import is_single_gpu +import cugraph.dask as dcg from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH + # ============================================================================= # Pytest Setup / Teardown - called for each test function # ============================================================================= diff --git a/python/cugraph/cugraph/tests/tree/test_maximum_spanning_tree.py b/python/cugraph/cugraph/tests/tree/test_maximum_spanning_tree.py index 8a3852595fc..824239dfea7 100644 --- a/python/cugraph/cugraph/tests/tree/test_maximum_spanning_tree.py +++ b/python/cugraph/cugraph/tests/tree/test_maximum_spanning_tree.py @@ -14,33 +14,26 @@ import time import gc +import rmm import pytest import numpy as np -import rmm -import cudf +import networkx as nx +import cudf import cugraph from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED_WEIGHTS +from cugraph.datasets import netscience -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx - print("Networkx version : {} ".format(nx.__version__)) +UNDIRECTED_WEIGHTED_DATASET = [netscience] # ============================================================================= # Pytest Setup / Teardown - called for each test function # ============================================================================= + + def setup_function(): gc.collect() @@ -55,7 +48,7 @@ def _get_param_args(param_name, param_values): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED_WEIGHTS) +@pytest.mark.parametrize("graph_file", UNDIRECTED_WEIGHTED_DATASET) def test_maximum_spanning_tree_nx(graph_file): # cugraph G = graph_file.get_graph() @@ -86,7 +79,7 @@ def test_maximum_spanning_tree_nx(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED_WEIGHTS) +@pytest.mark.parametrize("graph_file", UNDIRECTED_WEIGHTED_DATASET) @pytest.mark.parametrize(*_get_param_args("use_adjlist", [True, False])) def test_maximum_spanning_tree_graph_repr_compat(graph_file, use_adjlist): G = graph_file.get_graph() diff --git a/python/cugraph/cugraph/tests/tree/test_minimum_spanning_tree.py b/python/cugraph/cugraph/tests/tree/test_minimum_spanning_tree.py index 6f36864f552..cef963af445 100644 --- a/python/cugraph/cugraph/tests/tree/test_minimum_spanning_tree.py +++ b/python/cugraph/cugraph/tests/tree/test_minimum_spanning_tree.py @@ -14,32 +14,26 @@ import time import gc -import pytest -import numpy as np import rmm import cudf +import pytest +import numpy as np +import networkx as nx import cugraph from cugraph.testing import utils -from cugraph.experimental.datasets import DATASETS_UNDIRECTED_WEIGHTS +from cugraph.datasets import netscience -# Temporarily suppress warnings till networkX fixes deprecation warnings -# (Using or importing the ABCs from 'collections' instead of from -# 'collections.abc' is deprecated, and in 3.8 it will stop working) for -# python 3.7. Also, this import networkx needs to be relocated in the -# third-party group once this gets fixed. -import warnings - -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - import networkx as nx print("Networkx version : {} ".format(nx.__version__)) +UNDIRECTED_WEIGHTED_DATASET = [netscience] # ============================================================================= # Pytest Setup / Teardown - called for each test function # ============================================================================= + + def setup_function(): gc.collect() @@ -54,7 +48,7 @@ def _get_param_args(param_name, param_values): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED_WEIGHTS) +@pytest.mark.parametrize("graph_file", UNDIRECTED_WEIGHTED_DATASET) def test_minimum_spanning_tree_nx(graph_file): # cugraph G = graph_file.get_graph() @@ -83,7 +77,7 @@ def test_minimum_spanning_tree_nx(graph_file): @pytest.mark.sg -@pytest.mark.parametrize("graph_file", DATASETS_UNDIRECTED_WEIGHTS) +@pytest.mark.parametrize("graph_file", UNDIRECTED_WEIGHTED_DATASET) @pytest.mark.parametrize(*_get_param_args("use_adjlist", [True, False])) def test_minimum_spanning_tree_graph_repr_compat(graph_file, use_adjlist): G = graph_file.get_graph() diff --git a/python/cugraph/cugraph/tests/utils/mg_context.py b/python/cugraph/cugraph/tests/utils/mg_context.py index 25ad4ee5e15..af147c7633d 100644 --- a/python/cugraph/cugraph/tests/utils/mg_context.py +++ b/python/cugraph/cugraph/tests/utils/mg_context.py @@ -16,11 +16,10 @@ import pytest +import cugraph.dask.comms as Comms from dask.distributed import Client - -from cugraph.dask.common.mg_utils import get_visible_devices from dask_cuda import LocalCUDACluster as CUDACluster -import cugraph.dask.comms as Comms +from cugraph.dask.common.mg_utils import get_visible_devices # Maximal number of verifications of the number of workers diff --git a/python/cugraph/cugraph/tests/utils/test_dataset.py b/python/cugraph/cugraph/tests/utils/test_dataset.py index e72de2ecf8a..643d0468d46 100644 --- a/python/cugraph/cugraph/tests/utils/test_dataset.py +++ b/python/cugraph/cugraph/tests/utils/test_dataset.py @@ -11,22 +11,24 @@ # See the License for the specific language governing permissions and # limitations under the License. - import os +import gc +import sys +import warnings from pathlib import Path from tempfile import TemporaryDirectory -import gc import pytest +import cudf from cugraph.structure import Graph -from cugraph.testing import RAPIDS_DATASET_ROOT_DIR_PATH -from cugraph.experimental.datasets import ( +from cugraph.testing import ( + RAPIDS_DATASET_ROOT_DIR_PATH, ALL_DATASETS, - ALL_DATASETS_WGT, + WEIGHTED_DATASETS, SMALL_DATASETS, ) -from cugraph.experimental import datasets +from cugraph import datasets # Add the sg marker to all tests in this module. pytestmark = pytest.mark.sg @@ -72,6 +74,51 @@ def setup(tmpdir): gc.collect() +@pytest.fixture() +def setup_deprecation_warning_tests(): + """ + Fixture used to set warning filters to 'default' and reload + experimental.datasets module if it has been previously + imported. Tests that import this fixture are expected to + import cugraph.experimental.datasets + """ + warnings.filterwarnings("default") + + if "cugraph.experimental.datasets" in sys.modules: + del sys.modules["cugraph.experimental.datasets"] + + yield + + +############################################################################### +# Helpers + +# check if there is a row where src == dst +def has_loop(df): + df.rename(columns={df.columns[0]: "src", df.columns[1]: "dst"}, inplace=True) + res = df.where(df["src"] == df["dst"]) + + return res.notnull().values.any() + + +# check if dataset object is symmetric +def is_symmetric(dataset): + # undirected graphs are symmetric + if not dataset.metadata["is_directed"]: + return True + else: + df = dataset.get_edgelist(download=True) + df_a = df.sort_values("src") + df_b = df_a[["dst", "src", "wgt"]] + df_b.rename(columns={"dst": "src", "src": "dst"}, inplace=True) + # created a df by appending the two + res = cudf.concat([df_a, df_b]) + # sort/unique + res = res.drop_duplicates().sort_values("src") + + return len(df_a) == len(res) + + ############################################################################### # Tests @@ -103,8 +150,8 @@ def test_set_download_dir(): @pytest.mark.parametrize("dataset", ALL_DATASETS) -def test_fetch(dataset): - E = dataset.get_edgelist(fetch=True) +def test_download(dataset): + E = dataset.get_edgelist(download=True) assert E is not None assert dataset.get_path().is_file() @@ -112,13 +159,13 @@ def test_fetch(dataset): @pytest.mark.parametrize("dataset", ALL_DATASETS) def test_get_edgelist(dataset): - E = dataset.get_edgelist(fetch=True) + E = dataset.get_edgelist(download=True) assert E is not None @pytest.mark.parametrize("dataset", ALL_DATASETS) def test_get_graph(dataset): - G = dataset.get_graph(fetch=True) + G = dataset.get_graph(download=True) assert G is not None @@ -133,32 +180,32 @@ def test_metadata(dataset): def test_get_path(dataset): tmpd = TemporaryDirectory() datasets.set_download_dir(tmpd.name) - dataset.get_edgelist(fetch=True) + dataset.get_edgelist(download=True) assert dataset.get_path().is_file() tmpd.cleanup() -@pytest.mark.parametrize("dataset", ALL_DATASETS_WGT) +@pytest.mark.parametrize("dataset", WEIGHTED_DATASETS) def test_weights(dataset): - G = dataset.get_graph(fetch=True) + G = dataset.get_graph(download=True) assert G.is_weighted() - G = dataset.get_graph(fetch=True, ignore_weights=True) + G = dataset.get_graph(download=True, ignore_weights=True) assert not G.is_weighted() @pytest.mark.parametrize("dataset", SMALL_DATASETS) def test_create_using(dataset): - G = dataset.get_graph(fetch=True) + G = dataset.get_graph(download=True) assert not G.is_directed() - G = dataset.get_graph(fetch=True, create_using=Graph) + G = dataset.get_graph(download=True, create_using=Graph) assert not G.is_directed() - G = dataset.get_graph(fetch=True, create_using=Graph(directed=True)) + G = dataset.get_graph(download=True, create_using=Graph(directed=True)) assert G.is_directed() def test_ctor_with_datafile(): - from cugraph.experimental.datasets import karate + from cugraph.datasets import karate karate_csv = RAPIDS_DATASET_ROOT_DIR_PATH / "karate.csv" @@ -185,9 +232,9 @@ def test_ctor_with_datafile(): csv_col_dtypes=["int32", "int32", "float32"], ) - expected_karate_edgelist = karate.get_edgelist(fetch=True) + expected_karate_edgelist = karate.get_edgelist(download=True) - # test with file path as string, ensure fetch=True does not break + # test with file path as string, ensure download=True does not break ds = datasets.Dataset( csv_file=karate_csv.as_posix(), csv_col_names=["src", "dst", "wgt"], @@ -239,3 +286,72 @@ def test_unload(): assert ds._edgelist is not None ds.unload() assert ds._edgelist is None + + +@pytest.mark.parametrize("dataset", ALL_DATASETS) +def test_node_and_edge_count(dataset): + dataset_is_directed = dataset.metadata["is_directed"] + G = dataset.get_graph( + download=True, create_using=Graph(directed=dataset_is_directed) + ) + + assert G.number_of_nodes() == dataset.metadata["number_of_nodes"] + assert G.number_of_edges() == dataset.metadata["number_of_edges"] + + +@pytest.mark.parametrize("dataset", ALL_DATASETS) +def test_is_directed(dataset): + dataset_is_directed = dataset.metadata["is_directed"] + G = dataset.get_graph( + download=True, create_using=Graph(directed=dataset_is_directed) + ) + + assert G.is_directed() == dataset.metadata["is_directed"] + + +@pytest.mark.parametrize("dataset", ALL_DATASETS) +def test_has_loop(dataset): + df = dataset.get_edgelist(download=True) + + assert has_loop(df) == dataset.metadata["has_loop"] + + +@pytest.mark.parametrize("dataset", ALL_DATASETS) +def test_is_symmetric(dataset): + assert is_symmetric(dataset) == dataset.metadata["is_symmetric"] + + +@pytest.mark.parametrize("dataset", ALL_DATASETS) +def test_is_multigraph(dataset): + G = dataset.get_graph(download=True) + + assert G.is_multigraph() == dataset.metadata["is_multigraph"] + + +# +# Test experimental for DeprecationWarnings +# +def test_experimental_dataset_import(setup_deprecation_warning_tests): + with pytest.deprecated_call(): + from cugraph.experimental.datasets import karate + + # unload() is called to pass flake8 + karate.unload() + + +def test_experimental_method_warnings(setup_deprecation_warning_tests): + from cugraph.experimental.datasets import ( + load_all, + set_download_dir, + get_download_dir, + ) + + warnings.filterwarnings("default") + tmpd = TemporaryDirectory() + + with pytest.deprecated_call(): + set_download_dir(tmpd.name) + get_download_dir() + load_all() + + tmpd.cleanup() diff --git a/python/cugraph/cugraph/tests/utils/test_replication_mg.py b/python/cugraph/cugraph/tests/utils/test_replication_mg.py index 95e7c1c7dbd..2f9c0d0189b 100644 --- a/python/cugraph/cugraph/tests/utils/test_replication_mg.py +++ b/python/cugraph/cugraph/tests/utils/test_replication_mg.py @@ -11,16 +11,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pytest import gc +import pytest -import cudf -from cudf.testing import assert_series_equal, assert_frame_equal +import cudf import cugraph +import cugraph.testing.utils as utils import cugraph.dask.structure.replication as replication from cugraph.dask.common.mg_utils import is_single_gpu -import cugraph.testing.utils as utils +from cudf.testing import assert_series_equal, assert_frame_equal + DATASETS_OPTIONS = utils.DATASETS_SMALL DIRECTED_GRAPH_OPTIONS = [False, True] diff --git a/python/cugraph/cugraph/tests/utils/test_utils.py b/python/cugraph/cugraph/tests/utils/test_utils.py index c6956cfbfcf..9d35b326f6d 100644 --- a/python/cugraph/cugraph/tests/utils/test_utils.py +++ b/python/cugraph/cugraph/tests/utils/test_utils.py @@ -14,12 +14,12 @@ import gc import pytest +import numpy as np -import cugraph import cudf +import cugraph from cugraph.testing import utils -from cugraph.experimental.datasets import karate -import numpy as np +from cugraph.datasets import karate @pytest.mark.sg diff --git a/python/cugraph/cugraph/tests/utils/test_utils_mg.py b/python/cugraph/cugraph/tests/utils/test_utils_mg.py index 68e76302616..23ff17aa00b 100644 --- a/python/cugraph/cugraph/tests/utils/test_utils_mg.py +++ b/python/cugraph/cugraph/tests/utils/test_utils_mg.py @@ -11,21 +11,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cugraph.dask as dcg -from dask.distributed import default_client, futures_of, wait import gc -import cugraph -import dask_cudf -import pytest -from cugraph.dask.common.part_utils import concat_within_workers -from cugraph.dask.common.read_utils import get_n_workers -from cugraph.dask.common.mg_utils import is_single_gpu -from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH - import os import time + +import pytest import numpy as np + +import cugraph +import dask_cudf +import cugraph.dask as dcg from cugraph.testing import utils +from cugraph.dask.common.mg_utils import is_single_gpu +from cugraph.dask.common.read_utils import get_n_workers +from dask.distributed import default_client, futures_of, wait +from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH +from cugraph.dask.common.part_utils import concat_within_workers # ============================================================================= diff --git a/python/cugraph/cugraph/traversal/bfs.py b/python/cugraph/cugraph/traversal/bfs.py index f2c1f5c5662..cad96947f8b 100644 --- a/python/cugraph/cugraph/traversal/bfs.py +++ b/python/cugraph/cugraph/traversal/bfs.py @@ -197,8 +197,8 @@ def bfs( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.bfs(G, 0) """ @@ -315,8 +315,8 @@ def bfs_edges(G, source, reverse=False, depth_limit=None, sort_neighbors=None): Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=True) >>> df = cugraph.bfs_edges(G, 0) """ diff --git a/python/cugraph/cugraph/traversal/sssp.py b/python/cugraph/cugraph/traversal/sssp.py index c2705b70383..5ab97e60390 100644 --- a/python/cugraph/cugraph/traversal/sssp.py +++ b/python/cugraph/cugraph/traversal/sssp.py @@ -198,8 +198,8 @@ def sssp( Examples -------- - >>> from cugraph.experimental.datasets import karate - >>> G = karate.get_graph(fetch=True) + >>> from cugraph.datasets import karate + >>> G = karate.get_graph(download=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 821e5b38fec..b297042f199 100644 --- a/python/cugraph/cugraph/tree/minimum_spanning_tree.py +++ b/python/cugraph/cugraph/tree/minimum_spanning_tree.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2022, NVIDIA CORPORATION. +# Copyright (c) 2019-2023, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -91,8 +91,8 @@ def minimum_spanning_tree(G, weight=None, algorithm="boruvka", ignore_nan=False) Examples -------- - >>> from cugraph.experimental.datasets import netscience - >>> G = netscience.get_graph(fetch=True) + >>> from cugraph.datasets import netscience + >>> G = netscience.get_graph(download=True) >>> G_mst = cugraph.minimum_spanning_tree(G) """ @@ -134,8 +134,8 @@ def maximum_spanning_tree(G, weight=None, algorithm="boruvka", ignore_nan=False) Examples -------- - >>> from cugraph.experimental.datasets import netscience - >>> G = netscience.get_graph(fetch=True) + >>> from cugraph.datasets import netscience + >>> G = netscience.get_graph(download=True) >>> G_mst = cugraph.maximum_spanning_tree(G) """