Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable FutureWarnings and DeprecationWarnings as errors in cugraph #4271

Closed
4 changes: 2 additions & 2 deletions python/cugraph/cugraph/community/egonet.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ def batched_ego_graphs(G, seeds, radius=1, center=True, undirected=None, distanc
--------
>>> from cugraph.datasets import karate
>>> G = karate.get_graph(download=True)
>>> b_ego_graph, offsets = cugraph.batched_ego_graphs(G, seeds=[1,5],
>>> b_ego_graph, offsets = cugraph.batched_ego_graphs(G, seeds=[1,5], # doctest: +SKIP
... radius=2)

"""
""" # noqa:E501
warning_msg = "This function is deprecated. Batched support for multiple vertices \
will be added to `ego_graph`"
warnings.warn(warning_msg, DeprecationWarning)
Expand Down
8 changes: 4 additions & 4 deletions python/cugraph/cugraph/community/ktruss_subgraph.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2024, 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
Expand Down Expand Up @@ -95,11 +95,11 @@ def k_truss(
G, isNx = ensure_cugraph_obj_for_nx(G)

if isNx is True:
k_sub = ktruss_subgraph(G, k)
k_sub = ktruss_subgraph(G, k, use_weights=False)
S = cugraph_to_nx(k_sub)
return S
else:
return ktruss_subgraph(G, k)
return ktruss_subgraph(G, k, use_weights=False)


# FIXME: merge this function with k_truss
Expand Down Expand Up @@ -174,7 +174,7 @@ def ktruss_subgraph(
--------
>>> from cugraph.datasets import karate
>>> G = karate.get_graph(download=True)
>>> k_subgraph = cugraph.ktruss_subgraph(G, 3)
>>> k_subgraph = cugraph.ktruss_subgraph(G, 3, use_weights=False)

"""

Expand Down
4 changes: 2 additions & 2 deletions python/cugraph/cugraph/community/subgraph_extraction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2024, 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
Expand Down Expand Up @@ -64,7 +64,7 @@ def subgraph(
>>> verts[1] = 1
>>> verts[2] = 2
>>> sverts = cudf.Series(verts)
>>> Sg = cugraph.subgraph(G, sverts)
>>> Sg = cugraph.subgraph(G, sverts) # doctest: +SKIP

"""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -204,7 +204,7 @@ def betweenness_centrality(
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph(directed=True)
Expand Down Expand Up @@ -362,7 +362,7 @@ def edge_betweenness_centrality(
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph(directed=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -104,7 +104,7 @@ def eigenvector_centrality(input_graph, max_iter=100, tol=1.0e-6):
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph()
Expand Down
4 changes: 2 additions & 2 deletions python/cugraph/cugraph/dask/centrality/katz_centrality.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -133,7 +133,7 @@ def katz_centrality(
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph(directed=True)
Expand Down
2 changes: 1 addition & 1 deletion python/cugraph/cugraph/dask/community/leiden.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def leiden(
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph()
Expand Down
2 changes: 1 addition & 1 deletion python/cugraph/cugraph/dask/community/louvain.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def louvain(
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph()
Expand Down
4 changes: 2 additions & 2 deletions python/cugraph/cugraph/dask/components/connectivity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2023, NVIDIA CORPORATION.
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -78,7 +78,7 @@ def weakly_connected_components(input_graph):
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph(directed=False)
Expand Down
4 changes: 2 additions & 2 deletions python/cugraph/cugraph/dask/cores/k_core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -109,7 +109,7 @@ def k_core(input_graph, k=None, core_number=None, degree_type="bidirectional"):
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph(directed=False)
Expand Down
4 changes: 2 additions & 2 deletions python/cugraph/cugraph/dask/link_analysis/hits.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -118,7 +118,7 @@ def hits(input_graph, tol=1.0e-5, max_iter=100, nstart=None, normalized=True):
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph(directed=True)
Expand Down
2 changes: 1 addition & 1 deletion python/cugraph/cugraph/dask/link_analysis/pagerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def pagerank(
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph(directed=True)
Expand Down
4 changes: 2 additions & 2 deletions python/cugraph/cugraph/dask/traversal/bfs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -106,7 +106,7 @@ def bfs(input_graph, start, depth_limit=None, return_distances=True, check_start
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph(directed=True)
Expand Down
4 changes: 2 additions & 2 deletions python/cugraph/cugraph/dask/traversal/sssp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -89,7 +89,7 @@ def sssp(input_graph, source, cutoff=None, check_source=True):
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
... chunksize=chunksize, delimiter=" ",
... blocksize=chunksize, delimiter=" ",
... names=["src", "dst", "value"],
... dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph(directed=True)
Expand Down
32 changes: 19 additions & 13 deletions python/cugraph/cugraph/gnn/data_loading/bulk_sampler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2023-2024, 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
Expand Down Expand Up @@ -259,18 +259,24 @@ def flush(self) -> None:
start_time_sample_call = time.perf_counter()

# Call uniform neighbor sample
output = sample_fn(
self.__graph,
**self.__sample_call_args,
start_list=self.__batches[[self.start_col_name, self.batch_col_name]][
batch_id_filter
],
with_batch_ids=True,
with_edge_properties=True,
return_offsets=True,
renumber=self.__renumber,
# use_legacy_names=False,
)
with warnings.catch_warnings():
# TODO: Address the following uniform_neighbor_sample deprecations
# with_edge_properties
# include_hop_column
# use_legacy_names
warnings.simplefilter("ignore", FutureWarning)
output = sample_fn(
self.__graph,
**self.__sample_call_args,
start_list=self.__batches[[self.start_col_name, self.batch_col_name]][
batch_id_filter
],
with_batch_ids=True,
with_edge_properties=True,
return_offsets=True,
renumber=self.__renumber,
# use_legacy_names=False,
)

if self.__renumber:
samples, offsets, renumber_map = output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __from_edgelist(
edge_id=None,
edge_type=None,
renumber=True,
legacy_renum_only=True,
legacy_renum_only=False,
store_transposed=False,
):
if legacy_renum_only:
Expand Down Expand Up @@ -261,14 +261,16 @@ def __from_edgelist(
# will be dropped unless the graph is a MultiGraph(Not Implemented yet)
# TODO: Update Symmetrize to work on Graph and/or DataFrame
if edge_attr is not None:
source_col, dest_col, value_col = symmetrize(
elist,
source,
destination,
edge_attr,
multi=self.properties.multi_edge, # Deprecated parameter
symmetrize=not self.properties.directed,
)
with warnings.catch_warnings():
warnings.filterwarnings("ignore", "Multi is deprecated", FutureWarning)
source_col, dest_col, value_col = symmetrize(
elist,
source,
destination,
edge_attr,
multi=self.properties.multi_edge, # Deprecated parameter
symmetrize=not self.properties.directed,
)

if isinstance(value_col, cudf.DataFrame):
value_dict = {}
Expand All @@ -277,13 +279,15 @@ def __from_edgelist(
value_col = value_dict
else:
value_col = None
source_col, dest_col = symmetrize(
elist,
source,
destination,
multi=self.properties.multi_edge, # Deprecated parameter
symmetrize=not self.properties.directed,
)
with warnings.catch_warnings():
warnings.filterwarnings("ignore", "Multi is deprecated", FutureWarning)
source_col, dest_col = symmetrize(
elist,
source,
destination,
multi=self.properties.multi_edge, # Deprecated parameter
symmetrize=not self.properties.directed,
)

if isinstance(value_col, dict):
value_col = {
Expand Down
6 changes: 3 additions & 3 deletions python/cugraph/cugraph/structure/symmetrize.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def symmetrize_df(
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ',
... dtype=['int32', 'int32', 'float32'], header=None)
>>> sym_df = symmetrize_df(M, '0', '1')
>>> sym_df = symmetrize_df(M, '0', '1', multi=True)

"""
if not isinstance(src_name, list):
Expand Down Expand Up @@ -159,7 +159,7 @@ def symmetrize_ddf(
>>> # Init a DASK Cluster
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> # chunksize = dcg.get_chunksize(datasets / 'karate.csv')
>>> # ddf = dask_cudf.read_csv(datasets/'karate.csv', chunksize=chunksize,
>>> # ddf = dask_cudf.read_csv(datasets/'karate.csv', blocksize=chunksize,
>>> # delimiter=' ',
>>> # names=['src', 'dst', 'weight'],
>>> # dtype=['int32', 'int32', 'float32'])
Expand Down Expand Up @@ -256,7 +256,7 @@ def symmetrize(
>>> df['sources'] = cudf.Series(M['0'])
>>> df['destinations'] = cudf.Series(M['1'])
>>> df['values'] = cudf.Series(M['2'])
>>> src, dst, val = symmetrize(df, 'sources', 'destinations', 'values')
>>> src, dst, val = symmetrize(df, 'sources', 'destinations', 'values', multi=True)

"""

Expand Down
6 changes: 3 additions & 3 deletions python/cugraph/cugraph/testing/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, 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
Expand Down Expand Up @@ -245,7 +245,7 @@ def read_dask_cudf_csv_file(csv_file, read_weights_in_sp=True, single_partition=
chunksize = os.path.getsize(csv_file)
return dask_cudf.read_csv(
csv_file,
chunksize=chunksize,
blocksize=chunksize,
delimiter=" ",
names=["src", "dst", "weight"],
dtype=["int32", "int32", "float32"],
Expand All @@ -264,7 +264,7 @@ def read_dask_cudf_csv_file(csv_file, read_weights_in_sp=True, single_partition=
chunksize = os.path.getsize(csv_file)
return dask_cudf.read_csv(
csv_file,
chunksize=chunksize,
blocksize=chunksize,
delimiter=" ",
names=["src", "dst", "weight"],
dtype=["int32", "int32", "float32"],
Expand Down
6 changes: 3 additions & 3 deletions python/cugraph/cugraph/tests/comms/test_comms_mg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, 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
Expand Down Expand Up @@ -53,7 +53,7 @@ def test_dask_mg_pagerank(dask_client, directed):

ddf1 = dask_cudf.read_csv(
input_data_path1,
chunksize=chunksize1,
blocksize=chunksize1,
delimiter=" ",
names=["src", "dst", "value"],
dtype=["int32", "int32", "float32"],
Expand All @@ -66,7 +66,7 @@ def test_dask_mg_pagerank(dask_client, directed):

ddf2 = dask_cudf.read_csv(
input_data_path2,
chunksize=chunksize2,
blocksize=chunksize2,
delimiter=" ",
names=["src", "dst", "value"],
dtype=["int32", "int32", "float32"],
Expand Down
Loading
Loading