Skip to content

Commit

Permalink
node activation: only draw an edge if in window
Browse files Browse the repository at this point in the history
  • Loading branch information
arashbm committed Jun 30, 2024
1 parent a39cefe commit 1367f53
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/random_networks/activation_temporal.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,10 @@ namespace reticula {
for (const auto& v: base_net.vertices()) {
auto links = base_net.out_edges();
if (links.empty()) continue;

std::uniform_int_distribution<std::size_t> idx(0, links.size() - 1);
for (auto t = res_dist(generator); t < max_t; t += iet_dist(generator)) {
auto e = links[idx(generator)];
edges.emplace_back(e, t);
}
for (auto t = res_dist(generator); t < max_t; t += iet_dist(generator))
edges.emplace_back(links[idx(generator)], t);
}

return network<EdgeT>(edges, base_net.vertices());
Expand Down Expand Up @@ -149,11 +148,10 @@ namespace reticula {
for (const auto& v: base_net.vertices()) {
auto links = base_net.out_edges();
if (links.empty()) continue;

std::uniform_int_distribution<std::size_t> idx(0, links.size() - 1);
for (typename EdgeT::TimeType t{}; t < max_t*2; t += iet_dist(generator)) {
auto e = links[idx(generator)];
if (t >= max_t) edges.emplace_back(e, t - max_t);
}
for (typename EdgeT::TimeType t{}; t < max_t*2; t += iet_dist(generator))
if (t >= max_t) edges.emplace_back(links[idx(generator)], t - max_t);
}

return network<EdgeT>(edges, base_net.vertices());
Expand Down

0 comments on commit 1367f53

Please sign in to comment.