Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.
This repository was archived by the owner on May 20, 2026. It is now read-only.

Unable to remove duplicated edges in batchUpdate #64

Description

@ax7e

Thanks for your great work!
I read throw the batchUpdate functions.
I'm confused about the following facts:

  1. Does hornet keeps the nodes inside each chunk sorted? If so, why batch update will finish with out furthur sorting?

template <typename... EdgeMetaTypes,
typename vid_t, typename degree_t>
void
BATCH_UPDATE::
print(bool sort) noexcept {
auto ptr = in_edge().get_soa_ptr();
std::cout<<"src, dst : "<<size()<<"\n";
rmm::device_vector<vid_t> src(size());
rmm::device_vector<vid_t> dst(size());
thrust::copy(ptr.template get<0>(), ptr.template get<0>() + size(), src.begin());
thrust::copy(ptr.template get<1>(), ptr.template get<1>() + size(), dst.begin());
if (!sort) {
thrust::copy(src.begin(), src.end(), std::ostream_iterator<vid_t>(std::cout, " "));
std::cout<<"\n";
thrust::copy(dst.begin(), dst.end(), std::ostream_iterator<vid_t>(std::cout, " "));
std::cout<<"\n";
} else {
thrust::host_vector<vid_t> hSrc = src;
thrust::host_vector<vid_t> hDst = dst;
std::vector<std::pair<vid_t, vid_t>> e;
for (int i = 0; i < size(); ++i) {
e.push_back(std::make_pair(hSrc[i], hDst[i]));
}
std::sort(e.begin(), e.end());
for (unsigned i = 0; i < e.size(); ++i) { std::cout<<e[i].first<<" "; }
std::cout<<"\n";
for (unsigned i = 0; i < e.size(); ++i) { std::cout<<e[i].second<<" "; }
std::cout<<"\n";
}
}

In the above code, the writer seems to assume that the edges are not sorted.

https://github.com/rapidsai/cuhornet/blob/ab70d14a562bdaa950e820b412fe827c570c0ca3/hornet/include/Core/HornetOperations/HornetInsert.i.cuh#LL12C1-L27C2

The code do don't sort the edges after batch update.
2. If the edges are don't sorted, actually the remove_graph_duplicates function is wrong.

int found = xlib::lower_bound_left(
batch_dst_ids + start,
end - start,
dst);

It uses xlib::lower_bound_left, which requires the array to be sorted.

  1. More Importantly, the delete function also assumes the chunks are sorted, but they are not.

https://github.com/rapidsai/cuhornet/blob/ab70d14a562bdaa950e820b412fe827c570c0ca3/hornet/include/Core/BatchUpdate/BatchUpdateKernels.cuh#L293-L296C6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions