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

Edgelist Returned from dataset.get_edgelist() is global #3421

Closed
alexbarghi-nv opened this issue Apr 5, 2023 · 1 comment · Fixed by #3777
Closed

Edgelist Returned from dataset.get_edgelist() is global #3421

alexbarghi-nv opened this issue Apr 5, 2023 · 1 comment · Fixed by #3777
Assignees
Labels
bug Something isn't working

Comments

@alexbarghi-nv
Copy link
Member

Currently, when calling get_edgelist(), a global edgelist is returned. This causes issues when performing operations such as:

df_unweighted = datasets.karate.get_edgelist()
df.drop('wgt', axis=1, inplace=True)
...
df_weighted = datasets.karate.get_edgelist()
print(df_weighted)

Expected:

src  dst  wgt
...

Actual:

src  dst
...

To fix this issue, datasets should return a copy of the global edgelist so the edgelist can be used in multiple places without affecting the original object.

@BradReesWork BradReesWork added the bug Something isn't working label Aug 3, 2023
@BradReesWork BradReesWork changed the title [BUG] Edgelist Returned from dataset.get_edgelist() is global Edgelist Returned from dataset.get_edgelist() is global Aug 3, 2023
@rlratzel
Copy link
Contributor

rlratzel commented Aug 7, 2023

We can also address this with documentation stating that a reference is being returned and that the caller should make a copy if needed. This makes it more of a documentation bug.

rapids-bot bot pushed a commit that referenced this issue Aug 16, 2023
…ad of global (#3777)

Closes #3421

This PR fixes a bug where `get_edgelist()` would return a global edge list, which causes any changes made to the first returned edge list to be reflected in subsequent calls to `get_edgelist()`.

Now, `get_edgelist()` returns a copy of the dataframe stored by the `Dataset` object.

Authors:
  - ralph (https://github.com/nv-rliu)

Approvers:
  - Alex Barghi (https://github.com/alexbarghi-nv)

URL: #3777
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
4 participants