diff --git a/python/nx-cugraph/nx_cugraph/algorithms/link_analysis/hits_alg.py b/python/nx-cugraph/nx_cugraph/algorithms/link_analysis/hits_alg.py index c780ccfb80e..5adfff71928 100644 --- a/python/nx-cugraph/nx_cugraph/algorithms/link_analysis/hits_alg.py +++ b/python/nx-cugraph/nx_cugraph/algorithms/link_analysis/hits_alg.py @@ -30,6 +30,10 @@ def hits(G, max_iter=100, tol=1.0e-8, nstart=None, normalized=True): return {}, {} if nstart is not None: nstart = G._dict_to_nodearray(nstart, 0, np.float32) + if max_iter <= 0: + if nx.__version__[:3] <= "3.2": + raise ValueError("`maxiter` must be a positive integer.") + raise nx.PowerIterationFailedConvergence(max_iter) try: node_ids, hubs, authorities = plc.hits( resource_handle=plc.ResourceHandle(), diff --git a/python/nx-cugraph/nx_cugraph/interface.py b/python/nx-cugraph/nx_cugraph/interface.py index f30acb47356..e2a2a1c0872 100644 --- a/python/nx-cugraph/nx_cugraph/interface.py +++ b/python/nx-cugraph/nx_cugraph/interface.py @@ -66,9 +66,6 @@ def key(testpath): no_multigraph = "multigraphs not currently supported" louvain_different = "Louvain may be different due to RNG" no_string_dtype = "string edge values not currently supported" - different_power_iteration = ( - "different behavior of power iteration convergence and/or exception" - ) xfail = { key( @@ -76,7 +73,7 @@ def key(testpath): ): "Power iteration failed (don't know why; networkx converges in 8 steps)", key( "test_hits.py:TestHITS.test_hits_not_convergent" - ): different_power_iteration, + ): "HITS doesn't raise after failing to converge after max_iter iterations", } from packaging.version import parse