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

[BUG]: plc.eigenvector_centrality fails to converge on simple graph #3971

Closed
eriknw opened this issue Nov 2, 2023 · 2 comments · Fixed by #3979
Closed

[BUG]: plc.eigenvector_centrality fails to converge on simple graph #3971

eriknw opened this issue Nov 2, 2023 · 2 comments · Fixed by #3979
Assignees
Labels
bug Something isn't working

Comments

@eriknw
Copy link
Contributor

eriknw commented Nov 2, 2023

Version

23.12 dev

Which installation method(s) does this occur on?

Source

Describe the bug.

plc.eigenvector_centrality fails to converge on a simple graph. NetworkX converges in a few iterations.

The adjacency matrix of this graph is:

[[0 1 0]
 [1 0 1]
 [0 1 0]]

The expected result is [0.5, 0.5**0.5, 0.5].

Minimum reproducible example

import cupy as cp
import numpy as np
import pylibcugraph as plc

src_indices = cp.array([0, 1, 1, 2], dtype=np.int32)
dst_indices = cp.array([1, 0, 2, 1], dtype=np.int32)

G = plc.SGGraph(
    resource_handle=plc.ResourceHandle(),
    graph_properties=plc.GraphProperties(
        is_multigraph=False,
        is_symmetric=True,
    ),
    src_or_offset_array=src_indices,
    dst_or_index_array=dst_indices,
    weight_array=None,  # Also fails with array of all 1s
    store_transposed=True,
    renumber=False,
    do_expensive_check=False,
)
# cpp/src/centrality/eigenvector_centrality_impl.cuh line=151: Eigenvector Centrality failed to converge.
node_ids, values = plc.eigenvector_centrality(
    resource_handle=plc.ResourceHandle(),
    graph=G,
    epsilon=0.1,  # This is really high!
    max_iterations=1000,  # This is super high! We should converge in a few steps
    do_expensive_check=False,
)


### Relevant log output

_No response_

### Environment details

_No response_

### Other/Misc.

_No response_

### Code of Conduct

- [X] I agree to follow cuGraph's Code of Conduct
- [X] I have searched the [open bugs](https://github.com/rapidsai/cugraph/issues?q=is%3Aopen+is%3Aissue+label%3Abug) and have found no duplicates for this bug report
@eriknw eriknw added bug Something isn't working ? - Needs Triage Need team to review and classify labels Nov 2, 2023
@ChuckHastings
Copy link
Collaborator

I was able to reproduce this in the C API. I will investigate further.

@ChuckHastings
Copy link
Collaborator

I have a bug fix for this. Will push a PR later today, perhaps with a few other bug fixes.

@rapids-bot rapids-bot bot closed this as completed in #3979 Nov 7, 2023
rapids-bot bot pushed a commit that referenced this issue Nov 7, 2023
Address a couple of bugs discovered in nx-cugraph testing.

HITS should raise an exception if it fails to converge.

Eigenvector computation was not quite right, nx-cugraph testing discovered an edge condition where it was obvious.

Closes #3971
Closes #3972

Authors:
  - Chuck Hastings (https://github.com/ChuckHastings)

Approvers:
  - Naim (https://github.com/naimnv)
  - Seunghwa Kang (https://github.com/seunghwak)
  - Rick Ratzel (https://github.com/rlratzel)

URL: #3979
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants