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

[FEA] Support getting all the neighboring edges for the uniform_neighbor_sample #2425

Closed
VibhuJawa opened this issue Jul 19, 2022 · 1 comment · Fixed by #2435
Closed

[FEA] Support getting all the neighboring edges for the uniform_neighbor_sample #2425

VibhuJawa opened this issue Jul 19, 2022 · 1 comment · Fixed by #2435
Milestone

Comments

@VibhuJawa
Copy link
Member

Describe the solution you'd like and any additional context

For GNN workflows when running on validation/test we need to sample all the neighboring edges . I think we should support uniform_neighbor_sample to allow an option to return that.

If we want to match DGL behavior we can probably return all neighbors for Fan-Out=-1 .

See related DGL documentation here

Please note that currently below fails with CUGRAPH_UNKNOWN_ERROR , we should probably raise an informative error as -1 is the default value for DGL library and users may end up trying it on their own.

import cudf
import cugraph
import numpy as np

df = cudf.DataFrame({'source':[1,2,3,4],
                     'destination':[2,3,4,1]
                    })
df = df.astype(np.int32)
df['weight']=1.0

G = cugraph.Graph(directed=True)
G.from_cudf_edgelist(df,edge_attr='weight')

sample_df = cugraph.uniform_neighbor_sample(
    G,
    cudf.Series([1,2]),
    fanout_vals=[-1]
)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [6], in <cell line: 14>()
     11 G = cugraph.Graph(directed=True)
     12 G.from_cudf_edgelist(df,edge_attr='weight')
---> 14 sample_df = cugraph.uniform_neighbor_sample(
     15     G,
     16     cudf.Series([1,2]),
     17     fanout_vals=[-1]
     18 )

File ~/dgl/cugraph/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py:113, in uniform_neighbor_sample(G, start_list, fanout_vals, with_replacement, is_edge_ids)
    107 do_expensive_check = False
    109 sg = SGGraph(resource_handle, graph_props, srcs, dsts, weights,
    110              store_transposed, renumber, do_expensive_check)
    112 sources, destinations, indices = \
--> 113     pylibcugraph_uniform_neighbor_sample(resource_handle, sg, start_list,
    114                                          fanout_vals, with_replacement,
    115                                          do_expensive_check)
    117 df = cudf.DataFrame()
    118 df["sources"] = sources

File pylibcugraph/uniform_neighbor_sample.pyx:142, in pylibcugraph.uniform_neighbor_sample.uniform_neighbor_sample()

File pylibcugraph/utils.pyx:51, in pylibcugraph.utils.assert_success()

RuntimeError: non-success value returned from cugraph_uniform_neighbor_sample: CUGRAPH_UNKNOWN_ERROR
@VibhuJawa VibhuJawa added the ? - Needs Triage Need team to review and classify label Jul 19, 2022
@ChuckHastings
Copy link
Collaborator

I believe that this should work. The fact that it fails is likely a bug.

There is a more detailed error message. We need to refactor the cuGraph python layer (or perhaps the python layer, not sure which) to expose the most detailed message. I will try and reproduce this specific example to isolate what is going on.

rapids-bot bot pushed a commit that referenced this issue Jul 22, 2022
Uniform neighbor sampling isn't working properly with fanout specifying -1.

The `partially_decompress_edge_partition_to_fill_edgelist` function didn't handle SG properly.

closes #2425

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

Approvers:
  - Seunghwa Kang (https://github.com/seunghwak)

URL: #2435
@kingmesal kingmesal removed the ? - Needs Triage Need team to review and classify label Feb 10, 2023
@kingmesal kingmesal added this to the 22.08 milestone Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants