Skip to content

Commit

Permalink
interface: re-add NULL default value for the weights parameter of…
Browse files Browse the repository at this point in the history
… widest path functions

This parameter is not optional in C, but it still needs a default in R to signify that weights should be taken from attributes.
  • Loading branch information
szhorvat committed Nov 8, 2024
1 parent 26f0dfa commit c1d0791
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/aaa-auto.R
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ get_k_shortest_paths_impl <- function(graph, from, to, ..., k, weights=NULL, mod
res
}

get_widest_path_impl <- function(graph, from, to, weights, mode=c("out", "in", "all", "total")) {
get_widest_path_impl <- function(graph, from, to, weights=NULL, mode=c("out", "in", "all", "total")) {
# Argument checks
ensure_igraph(graph)
from <- as_igraph_vs(graph, from)
Expand Down Expand Up @@ -826,7 +826,7 @@ get_widest_path_impl <- function(graph, from, to, weights, mode=c("out", "in", "
res
}

get_widest_paths_impl <- function(graph, from, to=V(graph), weights, mode=c("out", "in", "all", "total")) {
get_widest_paths_impl <- function(graph, from, to=V(graph), weights=NULL, mode=c("out", "in", "all", "total")) {
# Argument checks
ensure_igraph(graph)
from <- as_igraph_vs(graph, from)
Expand Down Expand Up @@ -856,7 +856,7 @@ get_widest_paths_impl <- function(graph, from, to=V(graph), weights, mode=c("out
res
}

widest_path_widths_dijkstra_impl <- function(graph, from=V(graph), to=V(graph), weights, mode=c("out", "in", "all", "total")) {
widest_path_widths_dijkstra_impl <- function(graph, from=V(graph), to=V(graph), weights=NULL, mode=c("out", "in", "all", "total")) {
# Argument checks
ensure_igraph(graph)
from <- as_igraph_vs(graph, from)
Expand All @@ -878,7 +878,7 @@ widest_path_widths_dijkstra_impl <- function(graph, from=V(graph), to=V(graph),
res
}

widest_path_widths_floyd_warshall_impl <- function(graph, from=V(graph), to=V(graph), weights, mode=c("out", "in", "all", "total")) {
widest_path_widths_floyd_warshall_impl <- function(graph, from=V(graph), to=V(graph), weights=NULL, mode=c("out", "in", "all", "total")) {
# Argument checks
ensure_igraph(graph)
from <- as_igraph_vs(graph, from)
Expand Down
23 changes: 23 additions & 0 deletions tools/stimulus/functions-R.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,35 @@ igraph_get_k_shortest_paths:
edge_paths: epaths

igraph_get_widest_path:
PARAMS: |-
GRAPH graph,
OPTIONAL OUT VERTEX_INDICES vertices, OPTIONAL OUT EDGE_INDICES edges,
VERTEX from, VERTEX to, EDGEWEIGHTS weights=NULL, NEIMODE mode=OUT
DEPS: |-
from ON graph, to ON graph, weights ON graph, vertices ON graph, edges ON graph
igraph_get_widest_paths:
PARAMS: |-
GRAPH graph,
OPTIONAL OUT VERTEXSET_LIST vertices, OPTIONAL OUT EDGESET_LIST edges,
VERTEX from, VERTEX_SELECTOR to=ALL, EDGEWEIGHTS weights=NULL,
NEIMODE mode=OUT, OPTIONAL OUT VECTOR_INT parents,
OPTIONAL OUT VECTOR_INT inbound_edges
DEPS: |-
from ON graph, to ON graph, weights ON graph, vertices ON graph,
edges ON graph
igraph_widest_path_widths_dijkstra:
PARAMS: |-
GRAPH graph, OUT MATRIX res, VERTEX_SELECTOR from=ALL,
VERTEX_SELECTOR to=ALL, EDGEWEIGHTS weights=NULL, NEIMODE mode=OUT
DEPS: from ON graph, to ON graph, weights ON graph

igraph_widest_path_widths_floyd_warshall:
PARAMS: |-
GRAPH graph, OUT MATRIX res, VERTEX_SELECTOR from=ALL,
VERTEX_SELECTOR to=ALL, EDGEWEIGHTS weights=NULL, NEIMODE mode=OUT
DEPS: from ON graph, to ON graph, weights ON graph

igraph_spanner:
DEPS: weights ON graph, spanner ON graph
Expand Down

0 comments on commit c1d0791

Please sign in to comment.