Skip to content

Commit

Permalink
looping!
Browse files Browse the repository at this point in the history
  • Loading branch information
afender committed Oct 27, 2020
1 parent 01c671a commit 1f547dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 43 deletions.
52 changes: 10 additions & 42 deletions cpp/include/raft/sparse/mst/detail/mst_solver_inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,52 +57,19 @@ void MST_solver<vertex_t, edge_t, weight_t>::solve() {
RAFT_EXPECTS(indices != nullptr, "Null indices.");
RAFT_EXPECTS(weights != nullptr, "Null weights.");

min_edge_per_vertex();

detail::printv(successor);

label_prop();

detail::printv(color);

// Theorem : the minimum incident edge to any vertex has to be in the MST
// This is a segmented min scan/reduce
// cub::KeyValuePair<vertex_t, weight_t>* d_out = nullptr;
// void* cub_temp_storage = nullptr;
// size_t cub_temp_storage_bytes = 0;
// cub::DeviceSegmentedReduce::ArgMin(cub_temp_storage, cub_temp_storage_bytes,
// weights, d_out, v, offsets, offsets + 1);
// // FIXME RMM Allocate temporary storage
// cudaMalloc(&cub_temp_storage, cub_temp_storage_bytes);
// // Run argmin-reduction
// cub::DeviceSegmentedReduce::ArgMin(cub_temp_storage, cub_temp_storage_bytes,
// weights, d_out, v, offsets, offsets + 1);
//
// TODO: mst[offset[i]+key[i]]=true; (thrust)?
// Extract MST edge list by just filtering with the mask generated above?

// bool mst_edge_found = true;
// Boruvka original formulation says "while more than 1 supervertex remains"
// Here we adjust it to support disconnected components (spanning forest)
// track completion with mst_edge_found status.
// should have max_iter ensure it always exits.
// for (auto i = 0; i < v; i++) {
// {
// updates colors of supervertices by propagating the lower color to the higher
// TODO

// Finds the minimum outgoing edge from each supervertex to the lowest outgoing color
// by working at each vertex of the supervertex
// TODO
// segmented min with an extra check to discard edges leading to the same color

// filter internal edges / remove cycles
// TODO

// done
// if (!mst_edge_found) break;
// }
// }
for (auto i = 0; i < 2; i++) {
// Finds the minimum outgoing edge from each supervertex to the lowest outgoing color
// by working at each vertex of the supervertex
min_edge_per_vertex();
detail::printv(successor);
// updates colors of supervertices by propagating the lower color to the higher
label_prop();
detail::printv(color);
}
}

template <typename vertex_t, typename edge_t, typename weight_t>
Expand Down Expand Up @@ -133,6 +100,7 @@ void MST_solver<vertex_t, edge_t, weight_t>::label_prop() {
i++;
}
std::cout << "Label prop iterations : " << i << std::endl;
std::cout << "==================" << std::endl;
}

template <typename vertex_t, typename edge_t, typename weight_t>
Expand Down
2 changes: 1 addition & 1 deletion cpp/test/mst.cu
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ TEST_P(MSTTestSequential, Sequential) {
}

INSTANTIATE_TEST_SUITE_P(MSTTests, MSTTestSequential,
::testing::ValuesIn(csr_in_h));
::testing::ValuesIn(csr_in2_h));

} // namespace mst
} // namespace raft

0 comments on commit 1f547dc

Please sign in to comment.