-
Notifications
You must be signed in to change notification settings - Fork 310
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
nx-cugraph: add eigenvector_centrality
, katz_centrality
, hits
, pagerank
#3968
Conversation
eigenvector_centrality
and katz_centrality
eigenvector_centrality
, katz_centrality
, and hits
eigenvector_centrality
, katz_centrality
, and hits
eigenvector_centrality
, katz_centrality
, hits
, pagerank
python/nx-cugraph/nx_cugraph/algorithms/link_analysis/pagerank_alg.py
Outdated
Show resolved
Hide resolved
This is ready for review. There is nothing more I plan to add. |
python/nx-cugraph/nx_cugraph/algorithms/link_analysis/pagerank_alg.py
Outdated
Show resolved
Hide resolved
if nstart is None | ||
else cp.arange(N, dtype=index_dtype), # Why is this necessary? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it strange that we need to provide node indices here (and 12 lines below). I think other places in PLC assume 0, 1, ..., N-1
if indices aren't given.
Idea: perhaps we could add |
@networkx_algorithm( | ||
extra_params={ | ||
'weight : string or None, optional (default="weight")': ( | ||
"The edge attribute to use as the edge weight." | ||
) | ||
} | ||
) | ||
def hits(G, max_iter=100, tol=1.0e-8, nstart=None, normalized=True, *, weight="weight"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XREF: networkx/networkx#7081
weight=
argument may be added to networkx soon.
if max_iter <= 0: | ||
if nx.__version__[:3] <= "3.2": | ||
raise ValueError("`maxiter` must be a positive integer.") | ||
raise nx.PowerIterationFailedConvergence(max_iter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XREF: this (and PowerIterationFailedConvergence
below) presumes this gets merged: networkx/networkx#7084
python/nx-cugraph/nx_cugraph/algorithms/centrality/eigenvector.py
Outdated
Show resolved
Hide resolved
python/nx-cugraph/nx_cugraph/algorithms/link_analysis/hits_alg.py
Outdated
Show resolved
Hide resolved
key( | ||
"test_eigenvector_centrality.py:TestEigenvectorCentrality.test_P3" | ||
): "Power iteration failed (don't know why; networkx converges in 8 steps)", | ||
key( | ||
"test_hits.py:TestHITS.test_hits_not_convergent" | ||
): "HITS doesn't raise after failing to converge after max_iter iterations", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to remove the eigenvector_centrality
xfail, but we still need the hits
xfail for NX versions <= 3.2.1 that don't have your NX update.
/merge |
Add
eigenvector_centrality
,katz_centrality
, andhits
. I may add pagerank next.