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

Add DeprecationWarning to batched_ego_graphs #4209

Merged
merged 6 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions python/cugraph/cugraph/community/egonet.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.
# You may obtain a copy of the License at
Expand All @@ -11,18 +11,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.


import warnings

import cudf
from cugraph.utilities import (
ensure_cugraph_obj,
is_nx_graph_type,
)
from cugraph.utilities import cugraph_to_nx

import cudf

from pylibcugraph import ego_graph as pylibcugraph_ego_graph

from pylibcugraph import ResourceHandle
import warnings


def _convert_graph_to_output_type(G, input_type):
Expand All @@ -49,6 +49,7 @@ def _convert_df_series_to_output_type(df, offsets, input_type):
return df, offsets


# TODO: add support for a 'batch-mode' option.
def ego_graph(G, n, radius=1, center=True, undirected=None, distance=None):
"""
Compute the induced subgraph of neighbors centered at node n,
Expand Down Expand Up @@ -118,6 +119,7 @@ def ego_graph(G, n, radius=1, center=True, undirected=None, distance=None):

# Match the seed to the vertex dtype
n_type = G.edgelist.edgelist_df["src"].dtype
# FIXME: 'n' should represent a single vertex, but is not being verified
n = n.astype(n_type)
do_expensive_check = False

Expand Down Expand Up @@ -154,6 +156,11 @@ def ego_graph(G, n, radius=1, center=True, undirected=None, distance=None):

def batched_ego_graphs(G, seeds, radius=1, center=True, undirected=None, distance=None):
"""
This function is deprecated.

Deprecated since 24.04. Batched support for multiple seeds will be added
to `ego_graph`.

Compute the induced subgraph of neighbors for each node in seeds
within a given radius.

Expand Down Expand Up @@ -196,6 +203,9 @@ def batched_ego_graphs(G, seeds, radius=1, center=True, undirected=None, distanc
... radius=2)

"""
warning_msg = "This function is deprecated. Batched support for multiple vertices \
will be added to `ego_graph`"
warnings.warn(warning_msg, DeprecationWarning)

(G, input_type) = ensure_cugraph_obj(G, nx_weight_attr="weight")

Expand Down
6 changes: 3 additions & 3 deletions python/cugraph/cugraph/dask/community/egonet.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 @@ -129,9 +129,9 @@ def ego_graph(input_graph, n, radius=1, center=True):
# renumbered, the node ID must also be renumbered.
if input_graph.renumbered:
n = input_graph.lookup_internal_vertex_id(n)
n_type = input_graph.edgelist.edgelist_df.dtypes[0]
n_type = input_graph.edgelist.edgelist_df.dtypes.iloc[0]
else:
n_type = input_graph.input_df.dtypes[0]
n_type = input_graph.input_df.dtypes.iloc[0]

if isinstance(n, (cudf.Series, cudf.DataFrame)):
n = dask_cudf.from_cudf(n, npartitions=min(input_graph._npartitions, len(n)))
Expand Down
Loading