Unverified Commit ae22058a authored by Dong Wang's avatar Dong Wang Committed by GitHub
Browse files

make graph sample deterministic when iterate different type (#265)


Co-authored-by: default avatarDong Wang <d@dongs-mbp.lan>
parent 7f6379aa
......@@ -192,13 +192,18 @@ hetero_sample(const vector<node_t> &node_types,
for (const auto &kv : samples_dict)
slice_dict[kv.first] = {0, kv.second.size()};
vector<rel_t> all_rel_types;
for (const auto &kv : num_neighbors_dict) {
all_rel_types.push_back(kv.key());
}
std::sort(all_rel_types.begin(), all_rel_types.end());
for (int64_t ell = 0; ell < num_hops; ell++) {
for (const auto &kv : num_neighbors_dict) {
const auto &rel_type = kv.key();
for (const auto &rel_type : all_rel_types) {
const auto &edge_type = to_edge_type[rel_type];
const auto &src_node_type = get<0>(edge_type);
const auto &dst_node_type = get<2>(edge_type);
const auto num_samples = kv.value()[ell];
const auto num_samples = num_neighbors_dict.at(rel_type)[ell];
const auto &dst_samples = samples_dict.at(dst_node_type);
auto &src_samples = samples_dict.at(src_node_type);
auto &to_local_src_node = to_local_node_dict.at(src_node_type);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment