Skip to content

Conversation

jnke2016
Copy link
Contributor

@jnke2016 jnke2016 commented Apr 22, 2025

This PR adds the C, PLC and python API for Minimum Spanning Tree

closes #4882

namespace c_api {

struct cugraph_layout_result_t {
cugraph_type_erased_device_array_t* vertices_{nullptr};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using cugraph_induced_subgraph_result_t as the return type... as that has a COO of edges.

We should probably think of a better name, but perhaps a FIXME on that for now. I have a branch where I've been working on C API updates in graph creation that I think will create a better name for this structure.

@jnke2016 jnke2016 requested a review from a team as a code owner April 23, 2025 13:17
@jnke2016 jnke2016 requested review from rlratzel and nv-rliu April 29, 2025 17:21

const size_t num_edges = result_legacy_coo_graph->view().number_of_edges;

rmm::device_uvector<vertex_t> result_src(num_edges, handle_.get_stream());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a FIXME here.

These copies could be unnecessary. src_indices, dst_indices and edge_data within the result_legacy_coo_graph are already rmm::device_buffer instances. If we made a new constructor for cugraph_type_erased_host_array_t that took an rmm::device_buffer we could skip these copies.

We can do that optimization later.

@@ -0,0 +1,227 @@
/*
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just be 2025

d_distances.end(),
static_cast<vertex_t>(0));
ASSERT_TRUE(ref_sum > 0);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this update in this PR? Seems out of place.

Is this just a matter of merging the MSBFS PR first?

@ChuckHastings ChuckHastings added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 2, 2025

def minimum_spanning_tree(ResourceHandle resource_handle,
_GPUGraph graph,
bool_t do_expensive_check):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this have a default value of False?

Comment on lines 102 to 108
[0 1 2 3 4 5 1 1 1 4]
>>> destinations
[1 0 1 1 1 4 2 3 4 5]
>>> edge_weights
[0.1 0.1 3.1 2.1 1.1 3.2 3.1 2.1 1.1 3.2]
>>> subgraph_offsets
[0 10]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the actual output of running the example code? These don't look like device array reprs.

Copy link
Contributor Author

@jnke2016 jnke2016 May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right
Screenshot 2025-05-14 at 10 56 37 AM

else:
cupy_edge_weights = None

# FIXME: Should we keep the offsets array or just drop it from the final
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we resolve this in this PR?

@rlratzel rlratzel added this to the 25.06 milestone May 20, 2025
@ChuckHastings
Copy link
Collaborator

/merge

@rapids-bot rapids-bot bot merged commit d660a6d into rapidsai:branch-25.06 May 21, 2025
93 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake cuGraph improvement Improvement / enhancement to an existing function non-breaking Non-breaking change python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose MST through PLC
3 participants