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] Maximum spanning tree fails when loading data from an edgelist #2251

Closed
betochimas opened this issue Apr 27, 2022 · 0 comments · Fixed by #2256
Closed

[BUG] Maximum spanning tree fails when loading data from an edgelist #2251

betochimas opened this issue Apr 27, 2022 · 0 comments · Fixed by #2256
Assignees
Labels
? - Needs Triage Need team to review and classify bug Something isn't working
Milestone

Comments

@betochimas
Copy link
Contributor

betochimas commented Apr 27, 2022

maximum_spanning_tree shares the same signature as minimum_spanning_tree, and yet when a graph with only edgelist data is passed into maximum_spanning_tree, an AttributeError is raised because G.adjlist is required to be not None:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cugraph-22.6.0a0+65.g2956d563.dirty-py3.8-linux-x86_64.egg/cugraph/tree/minimum_spanning_tree.py", line 155, in maximum_spanning_tree
    return _maximum_spanning_tree_subgraph(G)
  File "/opt/conda/envs/rapids/lib/python3.8/site-packages/cugraph-22.6.0a0+65.g2956d563.dirty-py3.8-linux-x86_64.egg/cugraph/tree/minimum_spanning_tree.py", line 41, in _maximum_spanning_tree_subgraph
    if G.adjlist.weights is not None:
AttributeError: 'NoneType' object has no attribute 'weights'
>>> G.adjlist.weights
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'weights'

Steps/Code to reproduce bug

>>> M = cudf.read_csv('datasets/netscience.csv', delimiter=' ', dtype=['int32', 'int32', 'float32'], header=None)
>>> G = cugraph.Graph()
>>> G.from_cudf_edgelist(M, source='0', destination='1', edge_attr='2')
>>> G_mst = cugraph.maximum_spanning_tree(G)

Expected behavior
Expected to assign G_mst a cuGraph.Graph object with mst data

Using Docker container rapidsai/rapidsai-core-dev-nightly:22.04-cuda11.5-devel-ubuntu18.04-py3.8

@betochimas betochimas added bug Something isn't working ? - Needs Triage Need team to review and classify labels Apr 27, 2022
@rlratzel rlratzel added this to the 22.06 milestone Apr 29, 2022
@rapids-bot rapids-bot bot closed this as completed in #2256 May 5, 2022
rapids-bot bot pushed a commit that referenced this issue May 5, 2022
…list (#2256)

This PR resolves #2251 , where minimum spanning tree and maximum spanning tree had different behaviors when using edge list data versus adjacency list data, specifically that a call to compute the adjacency list had to be made before running maximum spanning tree because of how weights were calculated. After adding a check to verify that the adjacency list was computed, examples for both mst algorithms were uncommented.

Authors:
  - https://github.com/betochimas

Approvers:
  - Rick Ratzel (https://github.com/rlratzel)

URL: #2256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - Needs Triage Need team to review and classify bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants