Skip to content

Commit

Permalink
fix OnePropThreshold to aggregate only at terminal vertices
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Oct 3, 2021
1 parent 73c8457 commit cee3a4b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dodgr
Title: Distances on Directed Graphs
Version: 0.2.10.009
Version: 0.2.10.010
Authors@R: c(
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre")),
person("Andreas", "Petutschnig", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"codeRepository": "https://github.com/ATFutures/dodgr",
"issueTracker": "https://github.com/ATFutures/dodgr/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.2.10.009",
"version": "0.2.10.010",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
21 changes: 13 additions & 8 deletions src/run_sp_proportional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,22 @@ struct OnePropThreshold : public RcppParallel::Worker
if (w [j] < INFINITE_DOUBLE)
{
size_t st_prev = static_cast <size_t> (prev [j]);

bool is_terminal =
terminal_verts.find (j) != terminal_verts.end () ||
(d [j] > dlimit && d [st_prev] < dlimit);
for (size_t k = 0; k <= num_edge_types; k++)
{
const double dto = d [j + k * nverts];
if (dto < INFINITE_DOUBLE) {
if (Rcpp::NumericMatrix::is_na (dout (i, k)))
dout (i, k) = dto;
else
dout (i, k) += dto;

if (is_terminal) {

for (size_t k = 0; k <= num_edge_types; k++)
{
const double dto = d [j + k * nverts];
if (dto < INFINITE_DOUBLE) {
if (Rcpp::NumericMatrix::is_na (dout (i, k)))
dout (i, k) = dto;
else
dout (i, k) += dto;
}
}
}
}
Expand Down

0 comments on commit cee3a4b

Please sign in to comment.