Skip to content

Commit b3e2f6f

Browse files
committed
updates based on PR review
1 parent 96fcdf5 commit b3e2f6f

File tree

8 files changed

+25
-25
lines changed

8 files changed

+25
-25
lines changed

python/cugraph/cugraph/components/connectivity.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ def _ensure_args(api_name, G, directed, connection, return_labels):
3131
args with proper defaults if not specified, or raises TypeError or
3232
ValueError if incorrectly specified.
3333
"""
34-
G_type = type(G)
3534
# Check for Graph-type inputs and set defaults if unset
36-
if G_type == Graph:
35+
if isinstance(G, Graph):
3736
exc_value = "'%s' cannot be specified for a Graph-type input"
3837
if directed is not None:
3938
raise TypeError(exc_value % "directed")

python/cugraph/cugraph/link_prediction/cosine.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def cosine(
102102

103103
if isinstance(vertex_pair, cudf.DataFrame):
104104
vertex_pair = renumber_vertex_pair(input_graph, vertex_pair)
105-
vertex_pair = ensure_valid_dtype(input_graph, vertex_pair, "Cosine")
105+
vertex_pair = ensure_valid_dtype(input_graph, vertex_pair)
106106
src_col_name = vertex_pair.columns[0]
107107
dst_col_name = vertex_pair.columns[1]
108108
first = vertex_pair[src_col_name]
@@ -186,9 +186,9 @@ def cosine_coefficient(
186186
187187
"""
188188
warnings.warn(
189-
"deprecated as of 25.10. This function was to match "
190-
"NetworkX which is no longer needed, use networkx directly with"
191-
"the ``nx-cugraph`` backend. See: https://rapids.ai/nx-cugraph/",
189+
"deprecated as of 25.10. Use `cosine()` instead. "
190+
"If calling with a NetworkX Graph object, use networkx with the "
191+
"nx-cugraph backend. See: https://rapids.ai/nx-cugraph",
192192
DeprecationWarning,
193193
)
194194

python/cugraph/cugraph/link_prediction/jaccard.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def jaccard(
105105

106106
if isinstance(vertex_pair, cudf.DataFrame):
107107
vertex_pair = renumber_vertex_pair(input_graph, vertex_pair)
108-
vertex_pair = ensure_valid_dtype(input_graph, vertex_pair, "Jaccard")
108+
vertex_pair = ensure_valid_dtype(input_graph, vertex_pair)
109109
src_col_name = vertex_pair.columns[0]
110110
dst_col_name = vertex_pair.columns[1]
111111
first = vertex_pair[src_col_name]
@@ -191,9 +191,9 @@ def jaccard_coefficient(
191191
192192
"""
193193
warnings.warn(
194-
"deprecated as of 25.10. This function was to match "
195-
"NetworkX which is no longer needed, use networkx directly with"
196-
"the ``nx-cugraph`` backend. See: https://rapids.ai/nx-cugraph/",
194+
"deprecated as of 25.10. Use `jaccard()` instead. "
195+
"If calling with a NetworkX Graph object, use networkx with the "
196+
"nx-cugraph backend. See: https://rapids.ai/nx-cugraph",
197197
DeprecationWarning,
198198
)
199199

python/cugraph/cugraph/link_prediction/overlap.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ def overlap_coefficient(
8686
>>> df = overlap_coefficient(G)
8787
"""
8888
warnings.warn(
89-
"deprecated as of 25.10. This function was to match "
90-
"NetworkX which is no longer needed, use networkx directly with"
91-
"the ``nx-cugraph`` backend. See: https://rapids.ai/nx-cugraph/",
89+
"deprecated as of 25.10. Use `overlap()` instead. "
90+
"If calling with a NetworkX Graph object, use networkx with the "
91+
"nx-cugraph backend. See: https://rapids.ai/nx-cugraph",
9292
DeprecationWarning,
9393
)
9494

@@ -185,7 +185,7 @@ def overlap(
185185

186186
if isinstance(vertex_pair, cudf.DataFrame):
187187
vertex_pair = renumber_vertex_pair(input_graph, vertex_pair)
188-
vertex_pair = ensure_valid_dtype(input_graph, vertex_pair, "Overlap")
188+
vertex_pair = ensure_valid_dtype(input_graph, vertex_pair)
189189
src_col_name = vertex_pair.columns[0]
190190
dst_col_name = vertex_pair.columns[1]
191191
first = vertex_pair[src_col_name]

python/cugraph/cugraph/link_prediction/sorensen.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def sorensen(
104104

105105
if isinstance(vertex_pair, cudf.DataFrame):
106106
vertex_pair = renumber_vertex_pair(input_graph, vertex_pair)
107-
vertex_pair = ensure_valid_dtype(input_graph, vertex_pair, "Sorensen")
107+
vertex_pair = ensure_valid_dtype(input_graph, vertex_pair)
108108
src_col_name = vertex_pair.columns[0]
109109
dst_col_name = vertex_pair.columns[1]
110110
first = vertex_pair[src_col_name]
@@ -193,9 +193,9 @@ def sorensen_coefficient(
193193
194194
"""
195195
warnings.warn(
196-
"deprecated as of 25.10. This function was to match "
197-
"NetworkX which is no longer needed, use networkx directly with"
198-
"the ``nx-cugraph`` backend. See: https://rapids.ai/nx-cugraph/",
196+
"deprecated as of 25.10. Use `sorensen()` instead. "
197+
"If calling with a NetworkX Graph object, use networkx with the "
198+
"nx-cugraph backend. See: https://rapids.ai/nx-cugraph",
199199
DeprecationWarning,
200200
)
201201

python/cugraph/cugraph/traversal/bfs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ def _ensure_args(G, start, i_start, directed):
4040

4141
start = start if start is not None else i_start
4242

43-
G_type = type(G)
44-
4543
# Check for Graph-type inputs
46-
if G_type is Graph:
44+
if isinstance(G, Graph):
4745
if directed is not None:
4846
raise TypeError("'directed' cannot be specified for a " "Graph-type input")
4947

python/cugraph/cugraph/traversal/sssp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,9 @@ def shortest_path(
285285
for details.
286286
"""
287287
warnings.warn(
288-
"deprecated as of 25.10. This function was to match "
289-
"NetworkX which is no longer needed, use networkx directly with"
290-
"the ``nx-cugraph`` backend. See: https://rapids.ai/nx-cugraph/",
288+
"deprecated as of 25.10. Use `sssp()` instead. "
289+
"If calling with a NetworkX Graph object, use networkx with the "
290+
"nx-cugraph backend. See: https://rapids.ai/nx-cugraph",
291291
DeprecationWarning,
292292
)
293293

python/cugraph/cugraph/utilities/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ def get_traversed_path_list(df, id):
195195
return answer
196196

197197

198-
def ensure_valid_dtype(input_graph, vertex_pair, func_name):
198+
def ensure_valid_dtype(input_graph, vertex_pair):
199+
import inspect
200+
func_name = inspect.stack()[1].function
201+
199202
vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0]
200203
vertex_pair_dtypes = vertex_pair.dtypes
201204

0 commit comments

Comments
 (0)