Skip to content

Commit 4321fc3

Browse files
committed
chore: Fix call in all_shortest_paths()
1 parent 4c6b7d5 commit 4321fc3

1 file changed

Lines changed: 10 additions & 19 deletions

File tree

R/structural-properties.R

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,38 +1363,29 @@ all_shortest_paths <- function(
13631363
weights = NULL
13641364
) {
13651365
ensure_igraph(graph)
1366+
13661367
mode <- igraph.match.arg(mode)
1367-
mode <- switch(mode, "out" = 1, "in" = 2, "all" = 3)
13681368

13691369
if (is.null(weights)) {
13701370
if ("weight" %in% edge_attr_names(graph)) {
13711371
weights <- as.numeric(E(graph)$weight)
13721372
}
1373-
} else {
1374-
if (length(weights) == 1 && is.na(weights)) {
1375-
weights <- NULL
1376-
} else {
1377-
weights <- as.numeric(weights)
1378-
}
13791373
}
13801374

1381-
on.exit(.Call(R_igraph_finalizer))
13821375
if (is.null(weights)) {
1383-
res <- .Call(
1384-
R_igraph_get_all_shortest_paths,
1376+
res <- get_all_shortest_paths_impl(
13851377
graph,
1386-
as_igraph_vs(graph, from) - 1,
1387-
as_igraph_vs(graph, to) - 1,
1388-
as.numeric(mode)
1378+
from = from,
1379+
to = to,
1380+
mode = mode
13891381
)
13901382
} else {
1391-
res <- .Call(
1392-
R_igraph_get_all_shortest_paths_dijkstra,
1383+
res <- get_all_shortest_paths_dijkstra_impl(
13931384
graph,
1394-
as_igraph_vs(graph, from) - 1,
1395-
as_igraph_vs(graph, to) - 1,
1396-
weights,
1397-
as.numeric(mode)
1385+
from = from,
1386+
to = to,
1387+
weights = weights,
1388+
mode = mode
13981389
)
13991390
}
14001391

0 commit comments

Comments
 (0)