From 0c35fa4cb19505be03af149c4ac902bf0b6539a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 1 Nov 2025 18:59:06 +0000 Subject: [PATCH 1/6] Initial plan From 847b4cc390c842c22752544573895292aa1b1186 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 1 Nov 2025 19:23:11 +0000 Subject: [PATCH 2/6] feat: change constructors to use explicit arguments Update constructor functions to accept explicit arguments instead of just `...`, matching their corresponding `make_*` and `sample_*` function signatures. This improves IDE autocomplete and makes the API clearer. Exceptions: - `directed_graph()` and `undirected_graph()` kept as `...` since they work with `make_()` where arguments can be passed in various orders - `tree()` and `from_literal()` kept as `...` with .lazy = TRUE due to their special lazy evaluation behavior Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- R/adjacency.R | 5 ++- R/conversion.R | 10 +++--- R/games.R | 89 +++++++++++++++++++++++++++++++------------------ R/make.R | 90 ++++++++++++++++++++++++++++---------------------- 4 files changed, 114 insertions(+), 80 deletions(-) diff --git a/R/adjacency.R b/R/adjacency.R index 32eda29084..25e6cc4fb2 100644 --- a/R/adjacency.R +++ b/R/adjacency.R @@ -388,11 +388,10 @@ is_symmetric <- function(x) { } #' @rdname graph_from_adjacency_matrix -#' @param ... Passed to `graph_from_adjacency_matrix()`. #' @family adjacency #' @export -from_adjacency <- function(...) { - constructor_spec(graph_from_adjacency_matrix, ...) +from_adjacency <- function(adjmatrix, mode = c("directed", "undirected", "max", "min", "upper", "lower", "plus"), weighted = NULL, diag = TRUE, add.colnames = NULL, add.rownames = NA) { + constructor_spec(graph_from_adjacency_matrix, adjmatrix, mode = mode, weighted = weighted, diag = diag, add.colnames = add.colnames, add.rownames = add.rownames) } graph.adjacency.dense <- function( diff --git a/R/conversion.R b/R/conversion.R index e2a9755411..7b5f86b3eb 100644 --- a/R/conversion.R +++ b/R/conversion.R @@ -1671,9 +1671,10 @@ graph_from_data_frame <- function(d, directed = TRUE, vertices = NULL) { } #' @rdname graph_from_data_frame -#' @param ... Passed to `graph_from_data_frame()`. #' @export -from_data_frame <- function(...) constructor_spec(graph_from_data_frame, ...) +from_data_frame <- function(d, directed = TRUE, vertices = NULL) { + constructor_spec(graph_from_data_frame, d, directed = directed, vertices = vertices) +} ## ----------------------------------------------------------------- @@ -1726,6 +1727,7 @@ graph_from_edgelist <- function(el, directed = TRUE) { } #' @rdname graph_from_edgelist -#' @param ... Passed to `graph_from_edgelist()`. #' @export -from_edgelist <- function(...) constructor_spec(graph_from_edgelist, ...) +from_edgelist <- function(el, directed = TRUE) { + constructor_spec(graph_from_edgelist, el, directed = directed) +} diff --git a/R/games.R b/R/games.R index 78e782d796..3ea7d257af 100644 --- a/R/games.R +++ b/R/games.R @@ -976,9 +976,10 @@ sample_pa <- function( } #' @rdname sample_pa -#' @param ... Passed to `sample_pa()`. #' @export -pa <- function(...) constructor_spec(sample_pa, ...) +pa <- function(n, power = 1, m = NULL, out.dist = NULL, out.seq = NULL, out.pref = FALSE, zero.appeal = 1, directed = TRUE, algorithm = c("psumtree", "psumtree-multiple", "bag"), start.graph = NULL) { + constructor_spec(sample_pa, n, power = power, m = m, out.dist = out.dist, out.seq = out.seq, out.pref = out.pref, zero.appeal = zero.appeal, directed = directed, algorithm = algorithm, start.graph = start.graph) +} ## ----------------------------------------------------------------- @@ -1039,9 +1040,10 @@ sample_gnp <- function(n, p, directed = FALSE, loops = FALSE) { } #' @rdname sample_gnp -#' @param ... Passed to `sample_gnp()`. #' @export -gnp <- function(...) constructor_spec(sample_gnp, ...) +gnp <- function(n, p, directed = FALSE, loops = FALSE) { + constructor_spec(sample_gnp, n, p, directed = directed, loops = loops) +} ## ----------------------------------------------------------------- @@ -1092,9 +1094,10 @@ sample_gnm <- function(n, m, directed = FALSE, loops = FALSE) { } #' @rdname sample_gnm -#' @param ... Passed to `sample_gnm()`. #' @export -gnm <- function(...) constructor_spec(sample_gnm, ...) +gnm <- function(n, m, directed = FALSE, loops = FALSE) { + constructor_spec(sample_gnm, n, m, directed = directed, loops = loops) +} ## ----------------------------------------------------------------- @@ -1473,9 +1476,10 @@ sample_growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { } #' @rdname sample_growing -#' @param ... Passed to `sample_growing()`. #' @export -growing <- function(...) constructor_spec(sample_growing, ...) +growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { + constructor_spec(sample_growing, n, m = m, ..., directed = directed, citation = citation) +} ## ----------------------------------------------------------------- @@ -1704,9 +1708,10 @@ sample_pa_age <- function( } #' @rdname sample_pa_age -#' @param ... Passed to `sample_pa_age()`. #' @export -pa_age <- function(...) constructor_spec(sample_pa_age, ...) +pa_age <- function(n, pa.exp, aging.exp, m = NULL, aging.bin = 300, out.dist = NULL, out.seq = NULL, out.pref = FALSE, directed = TRUE, zero.deg.appeal = 1, zero.age.appeal = 0, deg.coef = 1, age.coef = 1, time.window = NULL) { + constructor_spec(sample_pa_age, n, pa.exp, aging.exp, m = m, aging.bin = aging.bin, out.dist = out.dist, out.seq = out.seq, out.pref = out.pref, directed = directed, zero.deg.appeal = zero.deg.appeal, zero.age.appeal = zero.age.appeal, deg.coef = deg.coef, age.coef = age.coef, time.window = time.window) +} ## ----------------------------------------------------------------- @@ -1784,7 +1789,9 @@ sample_traits_callaway <- function( #' @param ... Passed to the constructor, `sample_traits()` or #' `sample_traits_callaway()`. #' @export -traits_callaway <- function(...) constructor_spec(sample_traits_callaway, ...) +traits_callaway <- function(nodes, types, edge.per.step = 1, type.dist = rep(1, types), pref.matrix = matrix(1, types, types), directed = FALSE) { + constructor_spec(sample_traits_callaway, nodes, types, edge.per.step = edge.per.step, type.dist = type.dist, pref.matrix = pref.matrix, directed = directed) +} #' @rdname sample_traits_callaway #' @export @@ -1818,7 +1825,9 @@ sample_traits <- function( #' @rdname sample_traits_callaway #' @export -traits <- function(...) constructor_spec(sample_traits, ...) +traits <- function(nodes, types, k = 1, type.dist = rep(1, types), pref.matrix = matrix(1, types, types), directed = FALSE) { + constructor_spec(sample_traits, nodes, types, k = k, type.dist = type.dist, pref.matrix = pref.matrix, directed = directed) +} ## ----------------------------------------------------------------- @@ -1873,9 +1882,10 @@ sample_grg <- function(nodes, radius, torus = FALSE, coords = FALSE) { } #' @rdname sample_grg -#' @param ... Passed to `sample_grg()`. #' @export -grg <- function(...) constructor_spec(sample_grg, ...) +grg <- function(nodes, radius, torus = FALSE, coords = FALSE) { + constructor_spec(sample_grg, nodes, radius, torus = torus, coords = coords) +} ## ----------------------------------------------------------------- @@ -1980,7 +1990,9 @@ sample_pref <- function( #' @param ... Passed to the constructor, `sample_pref()` or #' `sample_asym_pref()`. #' @export -pref <- function(...) constructor_spec(sample_pref, ...) +pref <- function(nodes, types, type.dist = rep(1, types), fixed.sizes = FALSE, pref.matrix = matrix(1, types, types), directed = FALSE, loops = FALSE) { + constructor_spec(sample_pref, nodes, types, type.dist = type.dist, fixed.sizes = fixed.sizes, pref.matrix = pref.matrix, directed = directed, loops = loops) +} #' @rdname sample_pref #' @export @@ -2029,7 +2041,9 @@ sample_asym_pref <- function( #' @rdname sample_pref #' @export -asym_pref <- function(...) constructor_spec(sample_asym_pref, ...) +asym_pref <- function(nodes, types, type.dist.matrix = matrix(1, types, types), pref.matrix = matrix(1, types, types), loops = FALSE) { + constructor_spec(sample_asym_pref, nodes, types, type.dist.matrix = type.dist.matrix, pref.matrix = pref.matrix, loops = loops) +} ## ----------------------------------------------------------------- @@ -2127,9 +2141,10 @@ sample_smallworld <- function( } #' @rdname sample_smallworld -#' @param ... Passed to `sample_smallworld()`. #' @export -smallworld <- function(...) constructor_spec(sample_smallworld, ...) +smallworld <- function(dim, size, nei, p, loops = FALSE, multiple = FALSE) { + constructor_spec(sample_smallworld, dim, size, nei, p, loops = loops, multiple = multiple) +} ## ----------------------------------------------------------------- @@ -2187,9 +2202,10 @@ sample_last_cit <- function( } #' @rdname sample_last_cit -#' @param ... Passed to the actual constructor. #' @export -last_cit <- function(...) constructor_spec(sample_last_cit, ...) +last_cit <- function(n, edges = 1, agebins = n / 7100, pref = (1:(agebins + 1))^-3, directed = TRUE) { + constructor_spec(sample_last_cit, n, edges = edges, agebins = agebins, pref = pref, directed = directed) +} #' @rdname sample_last_cit #' @export @@ -2222,7 +2238,9 @@ sample_cit_types <- function( #' @rdname sample_last_cit #' @export -cit_types <- function(...) constructor_spec(sample_cit_types, ...) +cit_types <- function(n, edges = 1, types = rep(0, n), pref = rep(1, length(types)), directed = TRUE, attr = TRUE) { + constructor_spec(sample_cit_types, n, edges = edges, types = types, pref = pref, directed = directed, attr = attr) +} #' @rdname sample_last_cit #' @export @@ -2256,7 +2274,9 @@ sample_cit_cit_types <- function( #' @rdname sample_last_cit #' @export -cit_cit_types <- function(...) constructor_spec(sample_cit_cit_types, ...) +cit_cit_types <- function(n, edges = 1, types = rep(0, n), pref = matrix(1, nrow = length(types), ncol = length(types)), directed = TRUE, attr = TRUE) { + constructor_spec(sample_cit_cit_types, n, edges = edges, types = types, pref = pref, directed = directed, attr = attr) +} ## ----------------------------------------------------------------- @@ -2359,14 +2379,16 @@ bipartite <- function(..., type = NULL) { } #' @rdname sample_bipartite_gnm -#' @param ... Passed to `sample_bipartite_gnm()`. #' @export -bipartite_gnm <- function(...) constructor_spec(sample_bipartite_gnm, ...) +bipartite_gnm <- function(n1, n2, m, ..., directed = FALSE, mode = c("out", "in", "all")) { + constructor_spec(sample_bipartite_gnm, n1, n2, m, ..., directed = directed, mode = mode) +} #' @rdname sample_bipartite_gnm -#' @param ... Passed to `sample_bipartite_gnp()`. #' @export -bipartite_gnp <- function(...) constructor_spec(sample_bipartite_gnp, ...) +bipartite_gnp <- function(n1, n2, p, ..., directed = FALSE, mode = c("out", "in", "all")) { + constructor_spec(sample_bipartite_gnp, n1, n2, p, ..., directed = directed, mode = mode) +} #' Bipartite random graphs #' @@ -2517,9 +2539,10 @@ sample_sbm <- function( } #' @rdname sample_sbm -#' @param ... Passed to `sample_sbm()`. #' @export -sbm <- function(...) constructor_spec(sample_sbm, ...) +sbm <- function(n, pref.matrix, block.sizes, directed = FALSE, loops = FALSE) { + constructor_spec(sample_sbm, n, pref.matrix, block.sizes, directed = directed, loops = loops) +} ## ----------------------------------------------------------------- @@ -2607,10 +2630,9 @@ sample_hierarchical_sbm <- function(n, m, rho, C, p) { } #' @rdname sample_hierarchical_sbm -#' @param ... Passed to `sample_hierarchical_sbm()`. #' @export -hierarchical_sbm <- function(...) { - constructor_spec(sample_hierarchical_sbm, ...) +hierarchical_sbm <- function(n, m, rho, C, p) { + constructor_spec(sample_hierarchical_sbm, n, m, rho, C, p) } ## ----------------------------------------------------------------- @@ -2663,9 +2685,10 @@ sample_dot_product <- function(vecs, directed = FALSE) { } #' @rdname sample_dot_product -#' @param ... Passed to `sample_dot_product()`. #' @export -dot_product <- function(...) constructor_spec(sample_dot_product, ...) +dot_product <- function(vecs, directed = FALSE) { + constructor_spec(sample_dot_product, vecs, directed = directed) +} #' A graph with subgraphs that are each a random graph. diff --git a/R/make.R b/R/make.R index 5c47c56d76..0b7f384aae 100644 --- a/R/make.R +++ b/R/make.R @@ -1619,9 +1619,10 @@ make_empty_graph <- function(n = 0, directed = TRUE) { } #' @rdname make_empty_graph -#' @param ... Passed to `make_graph_empty`. #' @export -empty_graph <- function(...) constructor_spec(make_empty_graph, ...) +empty_graph <- function(n = 0, directed = TRUE) { + constructor_spec(make_empty_graph, n = n, directed = directed) +} ## ----------------------------------------------------------------- @@ -1898,9 +1899,10 @@ make_star <- function( } #' @rdname make_star -#' @param ... Passed to `make_star()`. #' @export -star <- function(...) constructor_spec(make_star, ...) +star <- function(n, mode = c("in", "out", "mutual", "undirected"), center = 1) { + constructor_spec(make_star, n, mode = mode, center = center) +} ## ----------------------------------------------------------------- @@ -1933,9 +1935,10 @@ make_full_graph <- function(n, directed = FALSE, loops = FALSE) { } #' @rdname make_full_graph -#' @param ... Passed to `make_full_graph()`. #' @export -full_graph <- function(...) constructor_spec(make_full_graph, ...) +full_graph <- function(n, directed = FALSE, loops = FALSE) { + constructor_spec(make_full_graph, n, directed = directed, loops = loops) +} ## ----------------------------------------------------------------- @@ -2022,9 +2025,10 @@ make_lattice <- function( } #' @rdname make_lattice -#' @param ... Passed to `make_lattice()`. #' @export -lattice <- function(...) constructor_spec(make_lattice, ...) +lattice <- function(dimvector = NULL, length = NULL, dim = NULL, nei = 1, directed = FALSE, mutual = FALSE, periodic = FALSE, circular = deprecated()) { + constructor_spec(make_lattice, dimvector = dimvector, length = length, dim = dim, nei = nei, directed = directed, mutual = mutual, periodic = periodic, circular = circular) +} ## ----------------------------------------------------------------- @@ -2065,9 +2069,10 @@ make_ring <- function(n, directed = FALSE, mutual = FALSE, circular = TRUE) { } #' @rdname make_ring -#' @param ... Passed to `make_ring()`. #' @export -ring <- function(...) constructor_spec(make_ring, ...) +ring <- function(n, directed = FALSE, mutual = FALSE, circular = TRUE) { + constructor_spec(make_ring, n, directed = directed, mutual = mutual, circular = circular) +} ## ----------------------------------------------------------------- @@ -2129,9 +2134,10 @@ make_wheel <- function( } #' @rdname make_wheel -#' @param ... Passed to `make_wheel()`. #' @export -wheel <- function(...) constructor_spec(make_wheel, ...) +wheel <- function(n, ..., mode = c("in", "out", "mutual", "undirected"), center = 1) { + constructor_spec(make_wheel, n, ..., mode = mode, center = center) +} ## ----------------------------------------------------------------- @@ -2250,9 +2256,10 @@ make_from_prufer <- function(prufer) { } #' @rdname make_from_prufer -#' @param ... Passed to `make_from_prufer()` #' @export -from_prufer <- function(...) constructor_spec(make_from_prufer, ...) +from_prufer <- function(prufer) { + constructor_spec(make_from_prufer, prufer) +} ## ----------------------------------------------------------------- @@ -2295,9 +2302,10 @@ graph_from_atlas <- function(n) { } #' @rdname graph_from_atlas -#' @param ... Passed to `graph_from_atlas()`. #' @export -atlas <- function(...) constructor_spec(graph_from_atlas, ...) +atlas <- function(n) { + constructor_spec(graph_from_atlas, n) +} ## ----------------------------------------------------------------- @@ -2344,9 +2352,10 @@ make_chordal_ring <- function(n, w, directed = FALSE) { } #' @rdname make_chordal_ring -#' @param ... Passed to `make_chordal_ring()`. #' @export -chordal_ring <- function(...) constructor_spec(make_chordal_ring, ...) +chordal_ring <- function(n, w, directed = FALSE) { + constructor_spec(make_chordal_ring, n, w, directed = directed) +} ## ----------------------------------------------------------------- @@ -2383,9 +2392,10 @@ make_circulant <- function(n, shifts, directed = FALSE) { } #' @rdname make_circulant -#' @param ... Passed to `make_circulant()`. #' @export -circulant <- function(...) constructor_spec(make_circulant, ...) +circulant <- function(n, shifts, directed = FALSE) { + constructor_spec(make_circulant, n, shifts, directed = directed) +} ## ----------------------------------------------------------------- @@ -2431,9 +2441,10 @@ make_line_graph <- function(graph) { } #' @rdname make_line_graph -#' @param ... Passed to `make_line_graph()`. #' @export -line_graph <- function(...) constructor_spec(make_line_graph, ...) +line_graph <- function(graph) { + constructor_spec(make_line_graph, graph) +} ## ----------------------------------------------------------------- @@ -2482,9 +2493,10 @@ make_de_bruijn_graph <- function(m, n) { } #' @rdname make_de_bruijn_graph -#' @param ... Passed to `make_de_bruijn_graph()`. #' @export -de_bruijn_graph <- function(...) constructor_spec(make_de_bruijn_graph, ...) +de_bruijn_graph <- function(m, n) { + constructor_spec(make_de_bruijn_graph, m, n) +} ## ----------------------------------------------------------------- @@ -2529,9 +2541,10 @@ make_kautz_graph <- function(m, n) { } #' @rdname make_kautz_graph -#' @param ... Passed to `make_kautz_graph()`. #' @export -kautz_graph <- function(...) constructor_spec(make_kautz_graph, ...) +kautz_graph <- function(m, n) { + constructor_spec(make_kautz_graph, m, n) +} ## ----------------------------------------------------------------- @@ -2597,10 +2610,9 @@ make_full_bipartite_graph <- function( } #' @rdname make_full_bipartite_graph -#' @param ... Passed to `make_full_bipartite_graph()`. #' @export -full_bipartite_graph <- function(...) { - constructor_spec(make_full_bipartite_graph, ...) +full_bipartite_graph <- function(n1, n2, directed = FALSE, mode = c("all", "out", "in")) { + constructor_spec(make_full_bipartite_graph, n1, n2, directed = directed, mode = mode) } ## ----------------------------------------------------------------- @@ -2679,9 +2691,10 @@ make_bipartite_graph <- function(types, edges, directed = FALSE) { } #' @rdname make_bipartite_graph -#' @param ... Passed to `make_bipartite_graph()`. #' @export -bipartite_graph <- function(...) constructor_spec(make_bipartite_graph, ...) +bipartite_graph <- function(types, edges, directed = FALSE) { + constructor_spec(make_bipartite_graph, types, edges, directed = directed) +} ## ----------------------------------------------------------------- @@ -2739,10 +2752,9 @@ make_full_multipartite <- function( } #' @rdname make_full_multipartite -#' @param ... Passed to `make_full_multipartite()`. #' @export -full_multipartite <- function(...) { - constructor_spec(make_full_multipartite, ...) +full_multipartite <- function(n, directed = FALSE, mode = c("all", "out", "in")) { + constructor_spec(make_full_multipartite, n, directed = directed, mode = mode) } ## ----------------------------------------------------------------- @@ -2795,10 +2807,9 @@ make_turan <- function(n, r) { } #' @rdname make_turan -#' @param ... Passed to `make_turan()`. #' @export -turan <- function(...) { - constructor_spec(make_turan, ...) +turan <- function(n, r) { + constructor_spec(make_turan, n, r) } ## ----------------------------------------------------------------- @@ -2829,10 +2840,9 @@ make_full_citation_graph <- function(n, directed = TRUE) { } #' @rdname make_full_citation_graph -#' @param ... Passed to `make_full_citation_graph()`. #' @export -full_citation_graph <- function(...) { - constructor_spec(make_full_citation_graph, ...) +full_citation_graph <- function(n, directed = TRUE) { + constructor_spec(make_full_citation_graph, n, directed = directed) } ## ----------------------------------------------------------------- From c6c42d57483313f732a15007e6c231b3fd713c84 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 1 Nov 2025 19:26:18 +0000 Subject: [PATCH 3/6] docs: update documentation for constructor changes Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- R/adjacency.R | 19 ++- R/conversion.R | 7 +- R/games.R | 259 ++++++++++++++++++++++++++--- R/make.R | 59 ++++++- man/graph_from_adjacency_matrix.Rd | 11 +- man/graph_from_atlas.Rd | 4 +- man/graph_from_data_frame.Rd | 4 +- man/graph_from_edgelist.Rd | 4 +- man/make_bipartite_graph.Rd | 4 +- man/make_chordal_ring.Rd | 4 +- man/make_circulant.Rd | 4 +- man/make_de_bruijn_graph.Rd | 4 +- man/make_empty_graph.Rd | 4 +- man/make_from_prufer.Rd | 4 +- man/make_full_bipartite_graph.Rd | 4 +- man/make_full_citation_graph.Rd | 4 +- man/make_full_graph.Rd | 4 +- man/make_full_multipartite.Rd | 4 +- man/make_kautz_graph.Rd | 4 +- man/make_lattice.Rd | 13 +- man/make_line_graph.Rd | 4 +- man/make_ring.Rd | 4 +- man/make_star.Rd | 4 +- man/make_turan.Rd | 4 +- man/make_wheel.Rd | 4 +- man/sample_bipartite_gnm.Rd | 6 +- man/sample_dot_product.Rd | 4 +- man/sample_gnm.Rd | 4 +- man/sample_gnp.Rd | 4 +- man/sample_grg.Rd | 4 +- man/sample_growing.Rd | 4 +- man/sample_hierarchical_sbm.Rd | 4 +- man/sample_last_cit.Rd | 28 +++- man/sample_pa.Rd | 15 +- man/sample_pa_age.Rd | 19 ++- man/sample_pref.Rd | 24 ++- man/sample_sbm.Rd | 4 +- man/sample_smallworld.Rd | 4 +- man/sample_traits_callaway.Rd | 22 ++- 39 files changed, 445 insertions(+), 145 deletions(-) diff --git a/R/adjacency.R b/R/adjacency.R index 25e6cc4fb2..15681a20db 100644 --- a/R/adjacency.R +++ b/R/adjacency.R @@ -390,8 +390,23 @@ is_symmetric <- function(x) { #' @rdname graph_from_adjacency_matrix #' @family adjacency #' @export -from_adjacency <- function(adjmatrix, mode = c("directed", "undirected", "max", "min", "upper", "lower", "plus"), weighted = NULL, diag = TRUE, add.colnames = NULL, add.rownames = NA) { - constructor_spec(graph_from_adjacency_matrix, adjmatrix, mode = mode, weighted = weighted, diag = diag, add.colnames = add.colnames, add.rownames = add.rownames) +from_adjacency <- function( + adjmatrix, + mode = c("directed", "undirected", "max", "min", "upper", "lower", "plus"), + weighted = NULL, + diag = TRUE, + add.colnames = NULL, + add.rownames = NA +) { + constructor_spec( + graph_from_adjacency_matrix, + adjmatrix, + mode = mode, + weighted = weighted, + diag = diag, + add.colnames = add.colnames, + add.rownames = add.rownames + ) } graph.adjacency.dense <- function( diff --git a/R/conversion.R b/R/conversion.R index 7b5f86b3eb..aeb128b7e8 100644 --- a/R/conversion.R +++ b/R/conversion.R @@ -1673,7 +1673,12 @@ graph_from_data_frame <- function(d, directed = TRUE, vertices = NULL) { #' @rdname graph_from_data_frame #' @export from_data_frame <- function(d, directed = TRUE, vertices = NULL) { - constructor_spec(graph_from_data_frame, d, directed = directed, vertices = vertices) + constructor_spec( + graph_from_data_frame, + d, + directed = directed, + vertices = vertices + ) } ## ----------------------------------------------------------------- diff --git a/R/games.R b/R/games.R index 3ea7d257af..77aa6e916c 100644 --- a/R/games.R +++ b/R/games.R @@ -977,8 +977,31 @@ sample_pa <- function( #' @rdname sample_pa #' @export -pa <- function(n, power = 1, m = NULL, out.dist = NULL, out.seq = NULL, out.pref = FALSE, zero.appeal = 1, directed = TRUE, algorithm = c("psumtree", "psumtree-multiple", "bag"), start.graph = NULL) { - constructor_spec(sample_pa, n, power = power, m = m, out.dist = out.dist, out.seq = out.seq, out.pref = out.pref, zero.appeal = zero.appeal, directed = directed, algorithm = algorithm, start.graph = start.graph) +pa <- function( + n, + power = 1, + m = NULL, + out.dist = NULL, + out.seq = NULL, + out.pref = FALSE, + zero.appeal = 1, + directed = TRUE, + algorithm = c("psumtree", "psumtree-multiple", "bag"), + start.graph = NULL +) { + constructor_spec( + sample_pa, + n, + power = power, + m = m, + out.dist = out.dist, + out.seq = out.seq, + out.pref = out.pref, + zero.appeal = zero.appeal, + directed = directed, + algorithm = algorithm, + start.graph = start.graph + ) } @@ -1478,7 +1501,14 @@ sample_growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { #' @rdname sample_growing #' @export growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { - constructor_spec(sample_growing, n, m = m, ..., directed = directed, citation = citation) + constructor_spec( + sample_growing, + n, + m = m, + ..., + directed = directed, + citation = citation + ) } ## ----------------------------------------------------------------- @@ -1709,8 +1739,39 @@ sample_pa_age <- function( #' @rdname sample_pa_age #' @export -pa_age <- function(n, pa.exp, aging.exp, m = NULL, aging.bin = 300, out.dist = NULL, out.seq = NULL, out.pref = FALSE, directed = TRUE, zero.deg.appeal = 1, zero.age.appeal = 0, deg.coef = 1, age.coef = 1, time.window = NULL) { - constructor_spec(sample_pa_age, n, pa.exp, aging.exp, m = m, aging.bin = aging.bin, out.dist = out.dist, out.seq = out.seq, out.pref = out.pref, directed = directed, zero.deg.appeal = zero.deg.appeal, zero.age.appeal = zero.age.appeal, deg.coef = deg.coef, age.coef = age.coef, time.window = time.window) +pa_age <- function( + n, + pa.exp, + aging.exp, + m = NULL, + aging.bin = 300, + out.dist = NULL, + out.seq = NULL, + out.pref = FALSE, + directed = TRUE, + zero.deg.appeal = 1, + zero.age.appeal = 0, + deg.coef = 1, + age.coef = 1, + time.window = NULL +) { + constructor_spec( + sample_pa_age, + n, + pa.exp, + aging.exp, + m = m, + aging.bin = aging.bin, + out.dist = out.dist, + out.seq = out.seq, + out.pref = out.pref, + directed = directed, + zero.deg.appeal = zero.deg.appeal, + zero.age.appeal = zero.age.appeal, + deg.coef = deg.coef, + age.coef = age.coef, + time.window = time.window + ) } ## ----------------------------------------------------------------- @@ -1789,8 +1850,23 @@ sample_traits_callaway <- function( #' @param ... Passed to the constructor, `sample_traits()` or #' `sample_traits_callaway()`. #' @export -traits_callaway <- function(nodes, types, edge.per.step = 1, type.dist = rep(1, types), pref.matrix = matrix(1, types, types), directed = FALSE) { - constructor_spec(sample_traits_callaway, nodes, types, edge.per.step = edge.per.step, type.dist = type.dist, pref.matrix = pref.matrix, directed = directed) +traits_callaway <- function( + nodes, + types, + edge.per.step = 1, + type.dist = rep(1, types), + pref.matrix = matrix(1, types, types), + directed = FALSE +) { + constructor_spec( + sample_traits_callaway, + nodes, + types, + edge.per.step = edge.per.step, + type.dist = type.dist, + pref.matrix = pref.matrix, + directed = directed + ) } #' @rdname sample_traits_callaway @@ -1825,8 +1901,23 @@ sample_traits <- function( #' @rdname sample_traits_callaway #' @export -traits <- function(nodes, types, k = 1, type.dist = rep(1, types), pref.matrix = matrix(1, types, types), directed = FALSE) { - constructor_spec(sample_traits, nodes, types, k = k, type.dist = type.dist, pref.matrix = pref.matrix, directed = directed) +traits <- function( + nodes, + types, + k = 1, + type.dist = rep(1, types), + pref.matrix = matrix(1, types, types), + directed = FALSE +) { + constructor_spec( + sample_traits, + nodes, + types, + k = k, + type.dist = type.dist, + pref.matrix = pref.matrix, + directed = directed + ) } ## ----------------------------------------------------------------- @@ -1990,8 +2081,25 @@ sample_pref <- function( #' @param ... Passed to the constructor, `sample_pref()` or #' `sample_asym_pref()`. #' @export -pref <- function(nodes, types, type.dist = rep(1, types), fixed.sizes = FALSE, pref.matrix = matrix(1, types, types), directed = FALSE, loops = FALSE) { - constructor_spec(sample_pref, nodes, types, type.dist = type.dist, fixed.sizes = fixed.sizes, pref.matrix = pref.matrix, directed = directed, loops = loops) +pref <- function( + nodes, + types, + type.dist = rep(1, types), + fixed.sizes = FALSE, + pref.matrix = matrix(1, types, types), + directed = FALSE, + loops = FALSE +) { + constructor_spec( + sample_pref, + nodes, + types, + type.dist = type.dist, + fixed.sizes = fixed.sizes, + pref.matrix = pref.matrix, + directed = directed, + loops = loops + ) } #' @rdname sample_pref @@ -2041,8 +2149,21 @@ sample_asym_pref <- function( #' @rdname sample_pref #' @export -asym_pref <- function(nodes, types, type.dist.matrix = matrix(1, types, types), pref.matrix = matrix(1, types, types), loops = FALSE) { - constructor_spec(sample_asym_pref, nodes, types, type.dist.matrix = type.dist.matrix, pref.matrix = pref.matrix, loops = loops) +asym_pref <- function( + nodes, + types, + type.dist.matrix = matrix(1, types, types), + pref.matrix = matrix(1, types, types), + loops = FALSE +) { + constructor_spec( + sample_asym_pref, + nodes, + types, + type.dist.matrix = type.dist.matrix, + pref.matrix = pref.matrix, + loops = loops + ) } ## ----------------------------------------------------------------- @@ -2143,7 +2264,15 @@ sample_smallworld <- function( #' @rdname sample_smallworld #' @export smallworld <- function(dim, size, nei, p, loops = FALSE, multiple = FALSE) { - constructor_spec(sample_smallworld, dim, size, nei, p, loops = loops, multiple = multiple) + constructor_spec( + sample_smallworld, + dim, + size, + nei, + p, + loops = loops, + multiple = multiple + ) } ## ----------------------------------------------------------------- @@ -2203,8 +2332,21 @@ sample_last_cit <- function( #' @rdname sample_last_cit #' @export -last_cit <- function(n, edges = 1, agebins = n / 7100, pref = (1:(agebins + 1))^-3, directed = TRUE) { - constructor_spec(sample_last_cit, n, edges = edges, agebins = agebins, pref = pref, directed = directed) +last_cit <- function( + n, + edges = 1, + agebins = n / 7100, + pref = (1:(agebins + 1))^-3, + directed = TRUE +) { + constructor_spec( + sample_last_cit, + n, + edges = edges, + agebins = agebins, + pref = pref, + directed = directed + ) } #' @rdname sample_last_cit @@ -2238,8 +2380,23 @@ sample_cit_types <- function( #' @rdname sample_last_cit #' @export -cit_types <- function(n, edges = 1, types = rep(0, n), pref = rep(1, length(types)), directed = TRUE, attr = TRUE) { - constructor_spec(sample_cit_types, n, edges = edges, types = types, pref = pref, directed = directed, attr = attr) +cit_types <- function( + n, + edges = 1, + types = rep(0, n), + pref = rep(1, length(types)), + directed = TRUE, + attr = TRUE +) { + constructor_spec( + sample_cit_types, + n, + edges = edges, + types = types, + pref = pref, + directed = directed, + attr = attr + ) } #' @rdname sample_last_cit @@ -2274,8 +2431,23 @@ sample_cit_cit_types <- function( #' @rdname sample_last_cit #' @export -cit_cit_types <- function(n, edges = 1, types = rep(0, n), pref = matrix(1, nrow = length(types), ncol = length(types)), directed = TRUE, attr = TRUE) { - constructor_spec(sample_cit_cit_types, n, edges = edges, types = types, pref = pref, directed = directed, attr = attr) +cit_cit_types <- function( + n, + edges = 1, + types = rep(0, n), + pref = matrix(1, nrow = length(types), ncol = length(types)), + directed = TRUE, + attr = TRUE +) { + constructor_spec( + sample_cit_cit_types, + n, + edges = edges, + types = types, + pref = pref, + directed = directed, + attr = attr + ) } ## ----------------------------------------------------------------- @@ -2380,14 +2552,44 @@ bipartite <- function(..., type = NULL) { #' @rdname sample_bipartite_gnm #' @export -bipartite_gnm <- function(n1, n2, m, ..., directed = FALSE, mode = c("out", "in", "all")) { - constructor_spec(sample_bipartite_gnm, n1, n2, m, ..., directed = directed, mode = mode) +bipartite_gnm <- function( + n1, + n2, + m, + ..., + directed = FALSE, + mode = c("out", "in", "all") +) { + constructor_spec( + sample_bipartite_gnm, + n1, + n2, + m, + ..., + directed = directed, + mode = mode + ) } #' @rdname sample_bipartite_gnm #' @export -bipartite_gnp <- function(n1, n2, p, ..., directed = FALSE, mode = c("out", "in", "all")) { - constructor_spec(sample_bipartite_gnp, n1, n2, p, ..., directed = directed, mode = mode) +bipartite_gnp <- function( + n1, + n2, + p, + ..., + directed = FALSE, + mode = c("out", "in", "all") +) { + constructor_spec( + sample_bipartite_gnp, + n1, + n2, + p, + ..., + directed = directed, + mode = mode + ) } #' Bipartite random graphs @@ -2541,7 +2743,14 @@ sample_sbm <- function( #' @rdname sample_sbm #' @export sbm <- function(n, pref.matrix, block.sizes, directed = FALSE, loops = FALSE) { - constructor_spec(sample_sbm, n, pref.matrix, block.sizes, directed = directed, loops = loops) + constructor_spec( + sample_sbm, + n, + pref.matrix, + block.sizes, + directed = directed, + loops = loops + ) } ## ----------------------------------------------------------------- diff --git a/R/make.R b/R/make.R index 0b7f384aae..67a7a7af45 100644 --- a/R/make.R +++ b/R/make.R @@ -2026,8 +2026,27 @@ make_lattice <- function( #' @rdname make_lattice #' @export -lattice <- function(dimvector = NULL, length = NULL, dim = NULL, nei = 1, directed = FALSE, mutual = FALSE, periodic = FALSE, circular = deprecated()) { - constructor_spec(make_lattice, dimvector = dimvector, length = length, dim = dim, nei = nei, directed = directed, mutual = mutual, periodic = periodic, circular = circular) +lattice <- function( + dimvector = NULL, + length = NULL, + dim = NULL, + nei = 1, + directed = FALSE, + mutual = FALSE, + periodic = FALSE, + circular = deprecated() +) { + constructor_spec( + make_lattice, + dimvector = dimvector, + length = length, + dim = dim, + nei = nei, + directed = directed, + mutual = mutual, + periodic = periodic, + circular = circular + ) } ## ----------------------------------------------------------------- @@ -2071,7 +2090,13 @@ make_ring <- function(n, directed = FALSE, mutual = FALSE, circular = TRUE) { #' @rdname make_ring #' @export ring <- function(n, directed = FALSE, mutual = FALSE, circular = TRUE) { - constructor_spec(make_ring, n, directed = directed, mutual = mutual, circular = circular) + constructor_spec( + make_ring, + n, + directed = directed, + mutual = mutual, + circular = circular + ) } ## ----------------------------------------------------------------- @@ -2135,7 +2160,12 @@ make_wheel <- function( #' @rdname make_wheel #' @export -wheel <- function(n, ..., mode = c("in", "out", "mutual", "undirected"), center = 1) { +wheel <- function( + n, + ..., + mode = c("in", "out", "mutual", "undirected"), + center = 1 +) { constructor_spec(make_wheel, n, ..., mode = mode, center = center) } @@ -2611,8 +2641,19 @@ make_full_bipartite_graph <- function( #' @rdname make_full_bipartite_graph #' @export -full_bipartite_graph <- function(n1, n2, directed = FALSE, mode = c("all", "out", "in")) { - constructor_spec(make_full_bipartite_graph, n1, n2, directed = directed, mode = mode) +full_bipartite_graph <- function( + n1, + n2, + directed = FALSE, + mode = c("all", "out", "in") +) { + constructor_spec( + make_full_bipartite_graph, + n1, + n2, + directed = directed, + mode = mode + ) } ## ----------------------------------------------------------------- @@ -2753,7 +2794,11 @@ make_full_multipartite <- function( #' @rdname make_full_multipartite #' @export -full_multipartite <- function(n, directed = FALSE, mode = c("all", "out", "in")) { +full_multipartite <- function( + n, + directed = FALSE, + mode = c("all", "out", "in") +) { constructor_spec(make_full_multipartite, n, directed = directed, mode = mode) } diff --git a/man/graph_from_adjacency_matrix.Rd b/man/graph_from_adjacency_matrix.Rd index 6765ff056b..80d48def26 100644 --- a/man/graph_from_adjacency_matrix.Rd +++ b/man/graph_from_adjacency_matrix.Rd @@ -14,7 +14,14 @@ graph_from_adjacency_matrix( add.rownames = NA ) -from_adjacency(...) +from_adjacency( + adjmatrix, + mode = c("directed", "undirected", "max", "min", "upper", "lower", "plus"), + weighted = NULL, + diag = TRUE, + add.colnames = NULL, + add.rownames = NA +) } \arguments{ \item{adjmatrix}{A square adjacency matrix. From igraph version 0.5.1 this @@ -50,8 +57,6 @@ attributes. Possible values the same as the previous argument. By default row names are not added. If \sQuote{\code{add.rownames}} and \sQuote{\code{add.colnames}} specify the same vertex attribute, then the former is ignored.} - -\item{...}{Passed to \code{graph_from_adjacency_matrix()}.} } \value{ An igraph graph object. diff --git a/man/graph_from_atlas.Rd b/man/graph_from_atlas.Rd index f550a38992..6e38a69252 100644 --- a/man/graph_from_atlas.Rd +++ b/man/graph_from_atlas.Rd @@ -7,12 +7,10 @@ \usage{ graph_from_atlas(n) -atlas(...) +atlas(n) } \arguments{ \item{n}{The id of the graph to create.} - -\item{...}{Passed to \code{graph_from_atlas()}.} } \value{ An igraph graph. diff --git a/man/graph_from_data_frame.Rd b/man/graph_from_data_frame.Rd index 6aa7caeddb..527310dbea 100644 --- a/man/graph_from_data_frame.Rd +++ b/man/graph_from_data_frame.Rd @@ -10,7 +10,7 @@ as_data_frame(x, what = c("edges", "vertices", "both")) graph_from_data_frame(d, directed = TRUE, vertices = NULL) -from_data_frame(...) +from_data_frame(d, directed = TRUE, vertices = NULL) } \arguments{ \item{x}{An igraph object.} @@ -28,8 +28,6 @@ version 0.7 this argument is coerced to a data frame with \item{vertices}{A data frame with vertex metadata, or \code{NULL}. See details below. Since version 0.7 this argument is coerced to a data frame with \code{as.data.frame}, if not \code{NULL}.} - -\item{...}{Passed to \code{graph_from_data_frame()}.} } \value{ An igraph graph object for \code{graph_from_data_frame()}, and either a diff --git a/man/graph_from_edgelist.Rd b/man/graph_from_edgelist.Rd index d9a783cbb0..611552698f 100644 --- a/man/graph_from_edgelist.Rd +++ b/man/graph_from_edgelist.Rd @@ -7,14 +7,12 @@ \usage{ graph_from_edgelist(el, directed = TRUE) -from_edgelist(...) +from_edgelist(el, directed = TRUE) } \arguments{ \item{el}{The edge list, a two column matrix, character or numeric.} \item{directed}{Whether to create a directed graph.} - -\item{...}{Passed to \code{graph_from_edgelist()}.} } \value{ An igraph graph. diff --git a/man/make_bipartite_graph.Rd b/man/make_bipartite_graph.Rd index 174caec11e..370fc49392 100644 --- a/man/make_bipartite_graph.Rd +++ b/man/make_bipartite_graph.Rd @@ -7,7 +7,7 @@ \usage{ make_bipartite_graph(types, edges, directed = FALSE) -bipartite_graph(...) +bipartite_graph(types, edges, directed = FALSE) } \arguments{ \item{types}{A vector giving the vertex types. It will be coerced into @@ -23,8 +23,6 @@ vector. The vector may be a string vector if \code{types} is a named vector.} \item{directed}{Whether to create a directed graph, boolean constant. Note that by default undirected graphs are created, as this is more common for bipartite graphs.} - -\item{...}{Passed to \code{make_bipartite_graph()}.} } \value{ \code{make_bipartite_graph()} returns a bipartite igraph graph. In other diff --git a/man/make_chordal_ring.Rd b/man/make_chordal_ring.Rd index d32907ec3f..35272853ac 100644 --- a/man/make_chordal_ring.Rd +++ b/man/make_chordal_ring.Rd @@ -7,7 +7,7 @@ \usage{ make_chordal_ring(n, w, directed = FALSE) -chordal_ring(...) +chordal_ring(n, w, directed = FALSE) } \arguments{ \item{n}{The number of vertices.} @@ -16,8 +16,6 @@ chordal_ring(...) details below.} \item{directed}{Logical scalar, whether or not to create a directed graph.} - -\item{...}{Passed to \code{make_chordal_ring()}.} } \value{ An igraph graph. diff --git a/man/make_circulant.Rd b/man/make_circulant.Rd index 7d0502cd72..e07ee680f6 100644 --- a/man/make_circulant.Rd +++ b/man/make_circulant.Rd @@ -7,7 +7,7 @@ \usage{ make_circulant(n, shifts, directed = FALSE) -circulant(...) +circulant(n, shifts, directed = FALSE) } \arguments{ \item{n}{Integer, the number of vertices in the circulant graph.} @@ -15,8 +15,6 @@ circulant(...) \item{shifts}{Integer vector, a list of the offsets within the circulant graph.} \item{directed}{Boolean, whether to create a directed graph.} - -\item{...}{Passed to \code{make_circulant()}.} } \value{ An igraph graph. diff --git a/man/make_de_bruijn_graph.Rd b/man/make_de_bruijn_graph.Rd index 346a225f3c..97de3e31c1 100644 --- a/man/make_de_bruijn_graph.Rd +++ b/man/make_de_bruijn_graph.Rd @@ -7,14 +7,12 @@ \usage{ make_de_bruijn_graph(m, n) -de_bruijn_graph(...) +de_bruijn_graph(m, n) } \arguments{ \item{m}{Integer scalar, the size of the alphabet. See details below.} \item{n}{Integer scalar, the length of the labels. See details below.} - -\item{...}{Passed to \code{make_de_bruijn_graph()}.} } \value{ A graph object. diff --git a/man/make_empty_graph.Rd b/man/make_empty_graph.Rd index 9ad6b1a352..a4772ce95d 100644 --- a/man/make_empty_graph.Rd +++ b/man/make_empty_graph.Rd @@ -7,14 +7,12 @@ \usage{ make_empty_graph(n = 0, directed = TRUE) -empty_graph(...) +empty_graph(n = 0, directed = TRUE) } \arguments{ \item{n}{Number of vertices.} \item{directed}{Whether to create a directed graph.} - -\item{...}{Passed to \code{make_graph_empty}.} } \value{ An igraph graph. diff --git a/man/make_from_prufer.Rd b/man/make_from_prufer.Rd index 6a1680bc05..cb06510bf0 100644 --- a/man/make_from_prufer.Rd +++ b/man/make_from_prufer.Rd @@ -7,12 +7,10 @@ \usage{ make_from_prufer(prufer) -from_prufer(...) +from_prufer(prufer) } \arguments{ \item{prufer}{The Prüfer sequence to convert into a graph} - -\item{...}{Passed to \code{make_from_prufer()}} } \value{ A graph object. diff --git a/man/make_full_bipartite_graph.Rd b/man/make_full_bipartite_graph.Rd index 6ea70f55e8..709aa2a08a 100644 --- a/man/make_full_bipartite_graph.Rd +++ b/man/make_full_bipartite_graph.Rd @@ -12,7 +12,7 @@ make_full_bipartite_graph( mode = c("all", "out", "in") ) -full_bipartite_graph(...) +full_bipartite_graph(n1, n2, directed = FALSE, mode = c("all", "out", "in")) } \arguments{ \item{n1}{The number of vertices of the first kind.} @@ -26,8 +26,6 @@ If this is \sQuote{\code{out}} then all vertices of the first kind are connected to the others; \sQuote{\verb{in}} specifies the opposite direction; \sQuote{\code{all}} creates mutual edges. This argument is ignored for undirected graphs.x} - -\item{...}{Passed to \code{make_full_bipartite_graph()}.} } \value{ An igraph graph, with the \sQuote{\code{type}} vertex attribute set. diff --git a/man/make_full_citation_graph.Rd b/man/make_full_citation_graph.Rd index af783232dc..062f9aca97 100644 --- a/man/make_full_citation_graph.Rd +++ b/man/make_full_citation_graph.Rd @@ -7,14 +7,12 @@ \usage{ make_full_citation_graph(n, directed = TRUE) -full_citation_graph(...) +full_citation_graph(n, directed = TRUE) } \arguments{ \item{n}{The number of vertices.} \item{directed}{Whether to create a directed graph.} - -\item{...}{Passed to \code{make_full_citation_graph()}.} } \value{ An igraph graph. diff --git a/man/make_full_graph.Rd b/man/make_full_graph.Rd index f34c0f8323..161f9d3cad 100644 --- a/man/make_full_graph.Rd +++ b/man/make_full_graph.Rd @@ -7,7 +7,7 @@ \usage{ make_full_graph(n, directed = FALSE, loops = FALSE) -full_graph(...) +full_graph(n, directed = FALSE, loops = FALSE) } \arguments{ \item{n}{Number of vertices.} @@ -15,8 +15,6 @@ full_graph(...) \item{directed}{Whether to create a directed graph.} \item{loops}{Whether to add self-loops to the graph.} - -\item{...}{Passed to \code{make_full_graph()}.} } \value{ An igraph graph diff --git a/man/make_full_multipartite.Rd b/man/make_full_multipartite.Rd index f04e6c8e38..8d226ff1fb 100644 --- a/man/make_full_multipartite.Rd +++ b/man/make_full_multipartite.Rd @@ -7,7 +7,7 @@ \usage{ make_full_multipartite(n, directed = FALSE, mode = c("all", "out", "in")) -full_multipartite(...) +full_multipartite(n, directed = FALSE, mode = c("all", "out", "in")) } \arguments{ \item{n}{A numeric vector giving the number of vertices in each partition.} @@ -19,8 +19,6 @@ If \code{"out"}, then edges point from vertices of partitions with lower indices to partitions with higher indices; if \code{"in"}, then the opposite direction is realized; \code{"all"} creates mutual edges. This parameter is ignored for undirected graphs.} - -\item{...}{Passed to \code{make_full_multipartite()}.} } \value{ An igraph graph with a vertex attribute \code{type} storing the diff --git a/man/make_kautz_graph.Rd b/man/make_kautz_graph.Rd index ab90013507..6f1f9c2d2a 100644 --- a/man/make_kautz_graph.Rd +++ b/man/make_kautz_graph.Rd @@ -7,14 +7,12 @@ \usage{ make_kautz_graph(m, n) -kautz_graph(...) +kautz_graph(m, n) } \arguments{ \item{m}{Integer scalar, the size of the alphabet. See details below.} \item{n}{Integer scalar, the length of the labels. See details below.} - -\item{...}{Passed to \code{make_kautz_graph()}.} } \value{ A graph object. diff --git a/man/make_lattice.Rd b/man/make_lattice.Rd index 833f8878bb..8bc9a7aafc 100644 --- a/man/make_lattice.Rd +++ b/man/make_lattice.Rd @@ -16,7 +16,16 @@ make_lattice( circular = deprecated() ) -lattice(...) +lattice( + dimvector = NULL, + length = NULL, + dim = NULL, + nei = 1, + directed = FALSE, + mutual = FALSE, + periodic = FALSE, + circular = deprecated() +) } \arguments{ \item{dimvector}{A vector giving the size of the lattice in each @@ -40,8 +49,6 @@ periodic along each dimension. This parameter may also be scalar boolen value wh be extended to boolean vector with dimvector length.} \item{circular}{Deprecated, use \code{periodic} instead.} - -\item{...}{Passed to \code{make_lattice()}.} } \value{ An igraph graph. diff --git a/man/make_line_graph.Rd b/man/make_line_graph.Rd index bec671be3d..63e1a62e78 100644 --- a/man/make_line_graph.Rd +++ b/man/make_line_graph.Rd @@ -7,12 +7,10 @@ \usage{ make_line_graph(graph) -line_graph(...) +line_graph(graph) } \arguments{ \item{graph}{The input graph, it can be directed or undirected.} - -\item{...}{Passed to \code{make_line_graph()}.} } \value{ A new graph object. diff --git a/man/make_ring.Rd b/man/make_ring.Rd index e73f45fc0a..49fc1674a2 100644 --- a/man/make_ring.Rd +++ b/man/make_ring.Rd @@ -7,7 +7,7 @@ \usage{ make_ring(n, directed = FALSE, mutual = FALSE, circular = TRUE) -ring(...) +ring(n, directed = FALSE, mutual = FALSE, circular = TRUE) } \arguments{ \item{n}{Number of vertices.} @@ -20,8 +20,6 @@ undirected graphs.} \item{circular}{Whether to create a circular ring. A non-circular ring is essentially a \dQuote{line}: a tree where every non-leaf vertex has one child.} - -\item{...}{Passed to \code{make_ring()}.} } \value{ An igraph graph. diff --git a/man/make_star.Rd b/man/make_star.Rd index 86af42795e..504aea358d 100644 --- a/man/make_star.Rd +++ b/man/make_star.Rd @@ -7,7 +7,7 @@ \usage{ make_star(n, mode = c("in", "out", "mutual", "undirected"), center = 1) -star(...) +star(n, mode = c("in", "out", "mutual", "undirected"), center = 1) } \arguments{ \item{n}{Number of vertices.} @@ -19,8 +19,6 @@ star is created with mutual edges, \code{undirected}: the edges are undirected.} \item{center}{ID of the center vertex.} - -\item{...}{Passed to \code{make_star()}.} } \value{ An igraph graph. diff --git a/man/make_turan.Rd b/man/make_turan.Rd index 451c31b887..a0b6e4ae25 100644 --- a/man/make_turan.Rd +++ b/man/make_turan.Rd @@ -7,14 +7,12 @@ \usage{ make_turan(n, r) -turan(...) +turan(n, r) } \arguments{ \item{n}{Integer, the number of vertices in the graph.} \item{r}{Integer, the number of partitions in the graph, must be positive.} - -\item{...}{Passed to \code{make_turan()}.} } \value{ An igraph graph with a vertex attribute \code{type} storing the diff --git a/man/make_wheel.Rd b/man/make_wheel.Rd index f31f1cfb89..e1c832e2ba 100644 --- a/man/make_wheel.Rd +++ b/man/make_wheel.Rd @@ -7,12 +7,12 @@ \usage{ make_wheel(n, ..., mode = c("in", "out", "mutual", "undirected"), center = 1) -wheel(...) +wheel(n, ..., mode = c("in", "out", "mutual", "undirected"), center = 1) } \arguments{ \item{n}{Number of vertices.} -\item{...}{Passed to \code{make_wheel()}.} +\item{...}{These dots are for future extensions and must be empty.} \item{mode}{It defines the direction of the edges. \verb{in}: the edges point \emph{to} the center, \code{out}: the edges point \emph{from} the diff --git a/man/sample_bipartite_gnm.Rd b/man/sample_bipartite_gnm.Rd index a6ec63a4d2..7850990176 100644 --- a/man/sample_bipartite_gnm.Rd +++ b/man/sample_bipartite_gnm.Rd @@ -7,9 +7,9 @@ \alias{sample_bipartite_gnp} \title{Bipartite random graphs} \usage{ -bipartite_gnm(...) +bipartite_gnm(n1, n2, m, ..., directed = FALSE, mode = c("out", "in", "all")) -bipartite_gnp(...) +bipartite_gnp(n1, n2, p, ..., directed = FALSE, mode = c("out", "in", "all")) sample_bipartite_gnm( n1, @@ -30,8 +30,6 @@ sample_bipartite_gnp( ) } \arguments{ -\item{...}{Passed to \code{sample_bipartite_gnp()}.} - \item{n1}{Integer scalar, the number of bottom vertices.} \item{n2}{Integer scalar, the number of top vertices.} diff --git a/man/sample_dot_product.Rd b/man/sample_dot_product.Rd index 44e6f018a5..a49e895d29 100644 --- a/man/sample_dot_product.Rd +++ b/man/sample_dot_product.Rd @@ -7,7 +7,7 @@ \usage{ sample_dot_product(vecs, directed = FALSE) -dot_product(...) +dot_product(vecs, directed = FALSE) } \arguments{ \item{vecs}{A numeric matrix in which each latent position vector is a @@ -15,8 +15,6 @@ column.} \item{directed}{A logical scalar, TRUE if the generated graph should be directed.} - -\item{...}{Passed to \code{sample_dot_product()}.} } \value{ An igraph graph object which is the generated random dot product diff --git a/man/sample_gnm.Rd b/man/sample_gnm.Rd index aaf6353a42..f0663c0702 100644 --- a/man/sample_gnm.Rd +++ b/man/sample_gnm.Rd @@ -7,7 +7,7 @@ \usage{ sample_gnm(n, m, directed = FALSE, loops = FALSE) -gnm(...) +gnm(n, m, directed = FALSE, loops = FALSE) } \arguments{ \item{n}{The number of vertices in the graph.} @@ -18,8 +18,6 @@ gnm(...) \code{FALSE}.} \item{loops}{Logical, whether to add loop edges, defaults to \code{FALSE}.} - -\item{...}{Passed to \code{sample_gnm()}.} } \value{ A graph object. diff --git a/man/sample_gnp.Rd b/man/sample_gnp.Rd index 77d1347526..0db7ea0681 100644 --- a/man/sample_gnp.Rd +++ b/man/sample_gnp.Rd @@ -7,7 +7,7 @@ \usage{ sample_gnp(n, p, directed = FALSE, loops = FALSE) -gnp(...) +gnp(n, p, directed = FALSE, loops = FALSE) } \arguments{ \item{n}{The number of vertices in the graph.} @@ -19,8 +19,6 @@ arbitrary vertices (\eqn{G(n,p)} graph).} \code{FALSE}.} \item{loops}{Logical, whether to add loop edges, defaults to \code{FALSE}.} - -\item{...}{Passed to \code{sample_gnp()}.} } \value{ A graph object. diff --git a/man/sample_grg.Rd b/man/sample_grg.Rd index 009fcf6f65..c698c3771e 100644 --- a/man/sample_grg.Rd +++ b/man/sample_grg.Rd @@ -7,7 +7,7 @@ \usage{ sample_grg(nodes, radius, torus = FALSE, coords = FALSE) -grg(...) +grg(nodes, radius, torus = FALSE, coords = FALSE) } \arguments{ \item{nodes}{The number of vertices in the graph.} @@ -19,8 +19,6 @@ edge.} \item{coords}{Logical scalar, whether to add the positions of the vertices as vertex attributes called \sQuote{\code{x}} and \sQuote{\code{y}}.} - -\item{...}{Passed to \code{sample_grg()}.} } \value{ A graph object. If \code{coords} is \code{TRUE} then with vertex diff --git a/man/sample_growing.Rd b/man/sample_growing.Rd index 6423905fb7..db8418bc2d 100644 --- a/man/sample_growing.Rd +++ b/man/sample_growing.Rd @@ -7,15 +7,13 @@ \usage{ sample_growing(n, m = 1, ..., directed = TRUE, citation = FALSE) -growing(...) +growing(n, m = 1, ..., directed = TRUE, citation = FALSE) } \arguments{ \item{n}{Numeric constant, number of vertices in the graph.} \item{m}{Numeric constant, number of edges added in each time step.} -\item{...}{Passed to \code{sample_growing()}.} - \item{directed}{Logical, whether to create a directed graph.} \item{citation}{Logical. If \code{TRUE} a citation graph is created, i.e. in diff --git a/man/sample_hierarchical_sbm.Rd b/man/sample_hierarchical_sbm.Rd index 9f7e79f906..0419070eb0 100644 --- a/man/sample_hierarchical_sbm.Rd +++ b/man/sample_hierarchical_sbm.Rd @@ -7,7 +7,7 @@ \usage{ sample_hierarchical_sbm(n, m, rho, C, p) -hierarchical_sbm(...) +hierarchical_sbm(n, m, rho, C, p) } \arguments{ \item{n}{Integer scalar, the number of vertices.} @@ -28,8 +28,6 @@ differ in different blocks.} \item{p}{Numeric scalar, the Bernoulli rate of connections between vertices in different blocks.} - -\item{...}{Passed to \code{sample_hierarchical_sbm()}.} } \value{ An igraph graph. diff --git a/man/sample_last_cit.Rd b/man/sample_last_cit.Rd index a5a55001a9..579c00865e 100644 --- a/man/sample_last_cit.Rd +++ b/man/sample_last_cit.Rd @@ -17,7 +17,13 @@ sample_last_cit( directed = TRUE ) -last_cit(...) +last_cit( + n, + edges = 1, + agebins = n/7100, + pref = (1:(agebins + 1))^-3, + directed = TRUE +) sample_cit_types( n, @@ -28,7 +34,14 @@ sample_cit_types( attr = TRUE ) -cit_types(...) +cit_types( + n, + edges = 1, + types = rep(0, n), + pref = rep(1, length(types)), + directed = TRUE, + attr = TRUE +) sample_cit_cit_types( n, @@ -39,7 +52,14 @@ sample_cit_cit_types( attr = TRUE ) -cit_cit_types(...) +cit_cit_types( + n, + edges = 1, + types = rep(0, n), + pref = matrix(1, nrow = length(types), ncol = length(types)), + directed = TRUE, + attr = TRUE +) } \arguments{ \item{n}{Number of vertices.} @@ -54,8 +74,6 @@ probabilities for the different vertex types.} \item{directed}{Logical scalar, whether to generate directed networks.} -\item{...}{Passed to the actual constructor.} - \item{types}{Vector of length \sQuote{\code{n}}, the types of the vertices. Types are numbered from zero.} diff --git a/man/sample_pa.Rd b/man/sample_pa.Rd index ec8c4f8ada..c7c6608bcd 100644 --- a/man/sample_pa.Rd +++ b/man/sample_pa.Rd @@ -18,7 +18,18 @@ sample_pa( start.graph = NULL ) -pa(...) +pa( + n, + power = 1, + m = NULL, + out.dist = NULL, + out.seq = NULL, + out.pref = FALSE, + zero.appeal = 1, + directed = TRUE, + algorithm = c("psumtree", "psumtree-multiple", "bag"), + start.graph = NULL +) } \arguments{ \item{n}{Number of vertices.} @@ -66,8 +77,6 @@ algorithm. The graph should have at least one vertex. If a graph is supplied here and the \code{out.seq} argument is not \code{NULL}, then it should contain the out degrees of the new vertices only, not the ones in the \code{start.graph}.} - -\item{...}{Passed to \code{sample_pa()}.} } \value{ A graph object. diff --git a/man/sample_pa_age.Rd b/man/sample_pa_age.Rd index 598cb93af4..7d4d3ec2db 100644 --- a/man/sample_pa_age.Rd +++ b/man/sample_pa_age.Rd @@ -22,7 +22,22 @@ sample_pa_age( time.window = NULL ) -pa_age(...) +pa_age( + n, + pa.exp, + aging.exp, + m = NULL, + aging.bin = 300, + out.dist = NULL, + out.seq = NULL, + out.pref = FALSE, + directed = TRUE, + zero.deg.appeal = 1, + zero.age.appeal = 0, + deg.coef = 1, + age.coef = 1, + time.window = NULL +) } \arguments{ \item{n}{The number of vertices in the graph.} @@ -67,8 +82,6 @@ of the vertices with age zero. It is usually zero, see details below.} \item{time.window}{Integer constant, if NULL only adjacent added in the last \code{time.windows} time steps are counted as a basis of the preferential attachment. See also details below.} - -\item{...}{Passed to \code{sample_pa_age()}.} } \value{ A new graph. diff --git a/man/sample_pref.Rd b/man/sample_pref.Rd index 43aadaa2fa..e1df729409 100644 --- a/man/sample_pref.Rd +++ b/man/sample_pref.Rd @@ -17,7 +17,15 @@ sample_pref( loops = FALSE ) -pref(...) +pref( + nodes, + types, + type.dist = rep(1, types), + fixed.sizes = FALSE, + pref.matrix = matrix(1, types, types), + directed = FALSE, + loops = FALSE +) sample_asym_pref( nodes, @@ -27,7 +35,13 @@ sample_asym_pref( loops = FALSE ) -asym_pref(...) +asym_pref( + nodes, + types, + type.dist.matrix = matrix(1, types, types), + pref.matrix = matrix(1, types, types), + loops = FALSE +) } \arguments{ \item{nodes}{The number of vertices in the graphs.} @@ -50,11 +64,11 @@ an undirected graph, it must be symmetric.} \item{loops}{Logical constant, whether self-loops are allowed in the graph.} -\item{...}{Passed to the constructor, \code{sample_pref()} or -\code{sample_asym_pref()}.} - \item{type.dist.matrix}{The joint distribution of the in- and out-vertex types.} + +\item{...}{Passed to the constructor, \code{sample_pref()} or +\code{sample_asym_pref()}.} } \value{ An igraph graph. diff --git a/man/sample_sbm.Rd b/man/sample_sbm.Rd index e11e2c4315..0a90aa6f7b 100644 --- a/man/sample_sbm.Rd +++ b/man/sample_sbm.Rd @@ -7,7 +7,7 @@ \usage{ sample_sbm(n, pref.matrix, block.sizes, directed = FALSE, loops = FALSE) -sbm(...) +sbm(n, pref.matrix, block.sizes, directed = FALSE, loops = FALSE) } \arguments{ \item{n}{Number of vertices in the graph.} @@ -24,8 +24,6 @@ group. The sum of the vector must match the number of vertices.} \item{directed}{Logical scalar, whether to generate a directed graph.} \item{loops}{Logical scalar, whether self-loops are allowed in the graph.} - -\item{...}{Passed to \code{sample_sbm()}.} } \value{ An igraph graph. diff --git a/man/sample_smallworld.Rd b/man/sample_smallworld.Rd index 28f9adc0b4..05d672ea30 100644 --- a/man/sample_smallworld.Rd +++ b/man/sample_smallworld.Rd @@ -7,7 +7,7 @@ \usage{ sample_smallworld(dim, size, nei, p, loops = FALSE, multiple = FALSE) -smallworld(...) +smallworld(dim, size, nei, p, loops = FALSE, multiple = FALSE) } \arguments{ \item{dim}{Integer constant, the dimension of the starting lattice.} @@ -24,8 +24,6 @@ generated graph.} \item{multiple}{Logical scalar, whether multiple edges are allowed int the generated graph.} - -\item{...}{Passed to \code{sample_smallworld()}.} } \value{ A graph object. diff --git a/man/sample_traits_callaway.Rd b/man/sample_traits_callaway.Rd index 7d7886783e..846c779695 100644 --- a/man/sample_traits_callaway.Rd +++ b/man/sample_traits_callaway.Rd @@ -16,7 +16,14 @@ sample_traits_callaway( directed = FALSE ) -traits_callaway(...) +traits_callaway( + nodes, + types, + edge.per.step = 1, + type.dist = rep(1, types), + pref.matrix = matrix(1, types, types), + directed = FALSE +) sample_traits( nodes, @@ -27,7 +34,14 @@ sample_traits( directed = FALSE ) -traits(...) +traits( + nodes, + types, + k = 1, + type.dist = rep(1, types), + pref.matrix = matrix(1, types, types), + directed = FALSE +) } \arguments{ \item{nodes}{The number of vertices in the graph.} @@ -44,10 +58,10 @@ types. These should be probabilities, i.e. numbers between zero and one.} \item{directed}{Logical constant, whether to generate directed graphs.} +\item{k}{The number of trials per time step, see details below.} + \item{...}{Passed to the constructor, \code{sample_traits()} or \code{sample_traits_callaway()}.} - -\item{k}{The number of trials per time step, see details below.} } \value{ A new graph object. From c246631e506f93930d00dfd3f1963452da463ee9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 1 Nov 2025 22:32:35 +0000 Subject: [PATCH 4/6] fix: apply feedback from code review - Add check_dots_empty() to constructors with ... parameter (wheel, growing, bipartite_gnm, bipartite_gnp) - Revert from_edgelist() and from_data_frame() to use ... for flexibility with graph_() - Fix documentation warnings by adding @inheritParams rlang::args_dots_empty - Remove @param ... from constructors that no longer have ... parameter - Update sample_() example to remove pattern that no longer works Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- R/conversion.R | 15 ++++---------- R/games.R | 38 ++++++++--------------------------- R/make.R | 7 ++----- man/graph_from_data_frame.Rd | 4 +++- man/graph_from_edgelist.Rd | 4 +++- man/sample_.Rd | 4 ---- man/sample_bipartite_gnm.Rd | 2 ++ man/sample_growing.Rd | 2 ++ man/sample_pref.Rd | 3 --- man/sample_traits_callaway.Rd | 3 --- 10 files changed, 24 insertions(+), 58 deletions(-) diff --git a/R/conversion.R b/R/conversion.R index aeb128b7e8..e2a9755411 100644 --- a/R/conversion.R +++ b/R/conversion.R @@ -1671,15 +1671,9 @@ graph_from_data_frame <- function(d, directed = TRUE, vertices = NULL) { } #' @rdname graph_from_data_frame +#' @param ... Passed to `graph_from_data_frame()`. #' @export -from_data_frame <- function(d, directed = TRUE, vertices = NULL) { - constructor_spec( - graph_from_data_frame, - d, - directed = directed, - vertices = vertices - ) -} +from_data_frame <- function(...) constructor_spec(graph_from_data_frame, ...) ## ----------------------------------------------------------------- @@ -1732,7 +1726,6 @@ graph_from_edgelist <- function(el, directed = TRUE) { } #' @rdname graph_from_edgelist +#' @param ... Passed to `graph_from_edgelist()`. #' @export -from_edgelist <- function(el, directed = TRUE) { - constructor_spec(graph_from_edgelist, el, directed = directed) -} +from_edgelist <- function(...) constructor_spec(graph_from_edgelist, ...) diff --git a/R/games.R b/R/games.R index 77aa6e916c..6c230de21c 100644 --- a/R/games.R +++ b/R/games.R @@ -1475,6 +1475,7 @@ degseq <- function(..., deterministic = FALSE) { #' #' @param n Numeric constant, number of vertices in the graph. #' @param m Numeric constant, number of edges added in each time step. +#' @inheritParams rlang::args_dots_empty #' @param directed Logical, whether to create a directed graph. #' @param citation Logical. If `TRUE` a citation graph is created, i.e. in #' each time step the added edges are originating from the new vertex. @@ -1501,14 +1502,8 @@ sample_growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { #' @rdname sample_growing #' @export growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { - constructor_spec( - sample_growing, - n, - m = m, - ..., - directed = directed, - citation = citation - ) + check_dots_empty() + constructor_spec(sample_growing, n, m = m, directed = directed, citation = citation) } ## ----------------------------------------------------------------- @@ -1847,8 +1842,6 @@ sample_traits_callaway <- function( } #' @rdname sample_traits_callaway -#' @param ... Passed to the constructor, `sample_traits()` or -#' `sample_traits_callaway()`. #' @export traits_callaway <- function( nodes, @@ -2078,8 +2071,6 @@ sample_pref <- function( } #' @rdname sample_pref -#' @param ... Passed to the constructor, `sample_pref()` or -#' `sample_asym_pref()`. #' @export pref <- function( nodes, @@ -2560,15 +2551,8 @@ bipartite_gnm <- function( directed = FALSE, mode = c("out", "in", "all") ) { - constructor_spec( - sample_bipartite_gnm, - n1, - n2, - m, - ..., - directed = directed, - mode = mode - ) + check_dots_empty() + constructor_spec(sample_bipartite_gnm, n1, n2, m, directed = directed, mode = mode) } #' @rdname sample_bipartite_gnm @@ -2581,15 +2565,8 @@ bipartite_gnp <- function( directed = FALSE, mode = c("out", "in", "all") ) { - constructor_spec( - sample_bipartite_gnp, - n1, - n2, - p, - ..., - directed = directed, - mode = mode - ) + check_dots_empty() + constructor_spec(sample_bipartite_gnp, n1, n2, p, directed = directed, mode = mode) } #' Bipartite random graphs @@ -2607,6 +2584,7 @@ bipartite_gnp <- function( #' @param n2 Integer scalar, the number of top vertices. #' @param p Real scalar, connection probability for \eqn{G(n,p)} graphs. #' @param m Integer scalar, the number of edges for \eqn{G(n,m)} graphs. +#' @inheritParams rlang::args_dots_empty #' @param directed Logical scalar, whether to create a directed graph. See also #' the `mode` argument. #' @param mode Character scalar, specifies how to direct the edges in directed diff --git a/R/make.R b/R/make.R index 67a7a7af45..ddb9a5b254 100644 --- a/R/make.R +++ b/R/make.R @@ -1002,10 +1002,6 @@ make_ <- function(...) { #' #' blocky2 <- pref_matrix %>% #' sample_sbm(n = 20, block.sizes = c(10, 10)) -#' -#' ## Arguments are passed on from sample_ to sample_sbm -#' blocky3 <- pref_matrix %>% -#' sample_(sbm(), n = 20, block.sizes = c(10, 10)) #' @family games #' @family constructor modifiers sample_ <- function(...) { @@ -2166,7 +2162,8 @@ wheel <- function( mode = c("in", "out", "mutual", "undirected"), center = 1 ) { - constructor_spec(make_wheel, n, ..., mode = mode, center = center) + check_dots_empty() + constructor_spec(make_wheel, n, mode = mode, center = center) } ## ----------------------------------------------------------------- diff --git a/man/graph_from_data_frame.Rd b/man/graph_from_data_frame.Rd index 527310dbea..6aa7caeddb 100644 --- a/man/graph_from_data_frame.Rd +++ b/man/graph_from_data_frame.Rd @@ -10,7 +10,7 @@ as_data_frame(x, what = c("edges", "vertices", "both")) graph_from_data_frame(d, directed = TRUE, vertices = NULL) -from_data_frame(d, directed = TRUE, vertices = NULL) +from_data_frame(...) } \arguments{ \item{x}{An igraph object.} @@ -28,6 +28,8 @@ version 0.7 this argument is coerced to a data frame with \item{vertices}{A data frame with vertex metadata, or \code{NULL}. See details below. Since version 0.7 this argument is coerced to a data frame with \code{as.data.frame}, if not \code{NULL}.} + +\item{...}{Passed to \code{graph_from_data_frame()}.} } \value{ An igraph graph object for \code{graph_from_data_frame()}, and either a diff --git a/man/graph_from_edgelist.Rd b/man/graph_from_edgelist.Rd index 611552698f..d9a783cbb0 100644 --- a/man/graph_from_edgelist.Rd +++ b/man/graph_from_edgelist.Rd @@ -7,12 +7,14 @@ \usage{ graph_from_edgelist(el, directed = TRUE) -from_edgelist(el, directed = TRUE) +from_edgelist(...) } \arguments{ \item{el}{The edge list, a two column matrix, character or numeric.} \item{directed}{Whether to create a directed graph.} + +\item{...}{Passed to \code{graph_from_edgelist()}.} } \value{ An igraph graph. diff --git a/man/sample_.Rd b/man/sample_.Rd index 212a9fe71b..5d671e3db4 100644 --- a/man/sample_.Rd +++ b/man/sample_.Rd @@ -39,10 +39,6 @@ blocky <- sample_(sbm( blocky2 <- pref_matrix \%>\% sample_sbm(n = 20, block.sizes = c(10, 10)) - -## Arguments are passed on from sample_ to sample_sbm -blocky3 <- pref_matrix \%>\% - sample_(sbm(), n = 20, block.sizes = c(10, 10)) } \seealso{ Random graph models (games) diff --git a/man/sample_bipartite_gnm.Rd b/man/sample_bipartite_gnm.Rd index 7850990176..399484af61 100644 --- a/man/sample_bipartite_gnm.Rd +++ b/man/sample_bipartite_gnm.Rd @@ -36,6 +36,8 @@ sample_bipartite_gnp( \item{m}{Integer scalar, the number of edges for \eqn{G(n,m)} graphs.} +\item{...}{These dots are for future extensions and must be empty.} + \item{directed}{Logical scalar, whether to create a directed graph. See also the \code{mode} argument.} diff --git a/man/sample_growing.Rd b/man/sample_growing.Rd index db8418bc2d..2549c86287 100644 --- a/man/sample_growing.Rd +++ b/man/sample_growing.Rd @@ -14,6 +14,8 @@ growing(n, m = 1, ..., directed = TRUE, citation = FALSE) \item{m}{Numeric constant, number of edges added in each time step.} +\item{...}{These dots are for future extensions and must be empty.} + \item{directed}{Logical, whether to create a directed graph.} \item{citation}{Logical. If \code{TRUE} a citation graph is created, i.e. in diff --git a/man/sample_pref.Rd b/man/sample_pref.Rd index e1df729409..824d4698e1 100644 --- a/man/sample_pref.Rd +++ b/man/sample_pref.Rd @@ -66,9 +66,6 @@ an undirected graph, it must be symmetric.} \item{type.dist.matrix}{The joint distribution of the in- and out-vertex types.} - -\item{...}{Passed to the constructor, \code{sample_pref()} or -\code{sample_asym_pref()}.} } \value{ An igraph graph. diff --git a/man/sample_traits_callaway.Rd b/man/sample_traits_callaway.Rd index 846c779695..ac4bea7a93 100644 --- a/man/sample_traits_callaway.Rd +++ b/man/sample_traits_callaway.Rd @@ -59,9 +59,6 @@ types. These should be probabilities, i.e. numbers between zero and one.} \item{directed}{Logical constant, whether to generate directed graphs.} \item{k}{The number of trials per time step, see details below.} - -\item{...}{Passed to the constructor, \code{sample_traits()} or -\code{sample_traits_callaway()}.} } \value{ A new graph object. From 269d1bbd928641e5f6317cc045520fecb1de34e7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 2 Nov 2025 10:57:37 +0000 Subject: [PATCH 5/6] fix: merge main and use named arguments for forwarding - Merge main branch (includes version bump and modularity fix) - Add check_dots_empty() to sample_growing() as requested - Change all constructor_spec calls to use named arguments for consistency and clarity - This ensures better code readability and makes argument forwarding explicit All constructors now use named arguments when calling constructor_spec: - R/make.R: star, full_graph, ring, atlas, chordal_ring, circulant, line_graph, de_bruijn_graph, kautz_graph, from_prufer, bipartite_graph, full_bipartite_graph, full_multipartite, turan, full_citation_graph - R/games.R: gnp, gnm, growing, grg, smallworld, last_cit, cit_types, cit_cit_types, bipartite_gnm, bipartite_gnp, sbm, hierarchical_sbm, dot_product - R/adjacency.R: from_adjacency Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> --- R/adjacency.R | 2 +- R/games.R | 31 ++++++++++++++++--------------- R/make.R | 30 +++++++++++++++--------------- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/R/adjacency.R b/R/adjacency.R index 15681a20db..7f8089fd89 100644 --- a/R/adjacency.R +++ b/R/adjacency.R @@ -400,7 +400,7 @@ from_adjacency <- function( ) { constructor_spec( graph_from_adjacency_matrix, - adjmatrix, + adjmatrix = adjmatrix, mode = mode, weighted = weighted, diag = diag, diff --git a/R/games.R b/R/games.R index 6c230de21c..83f29d1f17 100644 --- a/R/games.R +++ b/R/games.R @@ -1065,7 +1065,7 @@ sample_gnp <- function(n, p, directed = FALSE, loops = FALSE) { #' @rdname sample_gnp #' @export gnp <- function(n, p, directed = FALSE, loops = FALSE) { - constructor_spec(sample_gnp, n, p, directed = directed, loops = loops) + constructor_spec(sample_gnp, n = n, p = p, directed = directed, loops = loops) } ## ----------------------------------------------------------------- @@ -1119,7 +1119,7 @@ sample_gnm <- function(n, m, directed = FALSE, loops = FALSE) { #' @rdname sample_gnm #' @export gnm <- function(n, m, directed = FALSE, loops = FALSE) { - constructor_spec(sample_gnm, n, m, directed = directed, loops = loops) + constructor_spec(sample_gnm, n = n, m = m, directed = directed, loops = loops) } ## ----------------------------------------------------------------- @@ -1491,6 +1491,7 @@ degseq <- function(..., deterministic = FALSE) { #' #' @cdocs igraph_growing_random_game sample_growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { + check_dots_empty() growing_random_game_impl( n = n, m = m, @@ -1503,7 +1504,7 @@ sample_growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { #' @export growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { check_dots_empty() - constructor_spec(sample_growing, n, m = m, directed = directed, citation = citation) + constructor_spec(sample_growing, n = n, m = m, directed = directed, citation = citation) } ## ----------------------------------------------------------------- @@ -1968,7 +1969,7 @@ sample_grg <- function(nodes, radius, torus = FALSE, coords = FALSE) { #' @rdname sample_grg #' @export grg <- function(nodes, radius, torus = FALSE, coords = FALSE) { - constructor_spec(sample_grg, nodes, radius, torus = torus, coords = coords) + constructor_spec(sample_grg, nodes = nodes, radius = radius, torus = torus, coords = coords) } ## ----------------------------------------------------------------- @@ -2257,10 +2258,10 @@ sample_smallworld <- function( smallworld <- function(dim, size, nei, p, loops = FALSE, multiple = FALSE) { constructor_spec( sample_smallworld, - dim, - size, - nei, - p, + dim = dim, + size = size, + nei = nei, + p = p, loops = loops, multiple = multiple ) @@ -2332,7 +2333,7 @@ last_cit <- function( ) { constructor_spec( sample_last_cit, - n, + n = n, edges = edges, agebins = agebins, pref = pref, @@ -2381,7 +2382,7 @@ cit_types <- function( ) { constructor_spec( sample_cit_types, - n, + n = n, edges = edges, types = types, pref = pref, @@ -2432,7 +2433,7 @@ cit_cit_types <- function( ) { constructor_spec( sample_cit_cit_types, - n, + n = n, edges = edges, types = types, pref = pref, @@ -2552,7 +2553,7 @@ bipartite_gnm <- function( mode = c("out", "in", "all") ) { check_dots_empty() - constructor_spec(sample_bipartite_gnm, n1, n2, m, directed = directed, mode = mode) + constructor_spec(sample_bipartite_gnm, n1 = n1, n2 = n2, m = m, directed = directed, mode = mode) } #' @rdname sample_bipartite_gnm @@ -2566,7 +2567,7 @@ bipartite_gnp <- function( mode = c("out", "in", "all") ) { check_dots_empty() - constructor_spec(sample_bipartite_gnp, n1, n2, p, directed = directed, mode = mode) + constructor_spec(sample_bipartite_gnp, n1 = n1, n2 = n2, p = p, directed = directed, mode = mode) } #' Bipartite random graphs @@ -2819,7 +2820,7 @@ sample_hierarchical_sbm <- function(n, m, rho, C, p) { #' @rdname sample_hierarchical_sbm #' @export hierarchical_sbm <- function(n, m, rho, C, p) { - constructor_spec(sample_hierarchical_sbm, n, m, rho, C, p) + constructor_spec(sample_hierarchical_sbm, n = n, m = m, rho = rho, C = C, p = p) } ## ----------------------------------------------------------------- @@ -2874,7 +2875,7 @@ sample_dot_product <- function(vecs, directed = FALSE) { #' @rdname sample_dot_product #' @export dot_product <- function(vecs, directed = FALSE) { - constructor_spec(sample_dot_product, vecs, directed = directed) + constructor_spec(sample_dot_product, vecs = vecs, directed = directed) } diff --git a/R/make.R b/R/make.R index ddb9a5b254..23bd1efdec 100644 --- a/R/make.R +++ b/R/make.R @@ -1897,7 +1897,7 @@ make_star <- function( #' @rdname make_star #' @export star <- function(n, mode = c("in", "out", "mutual", "undirected"), center = 1) { - constructor_spec(make_star, n, mode = mode, center = center) + constructor_spec(make_star, n = n, mode = mode, center = center) } ## ----------------------------------------------------------------- @@ -1933,7 +1933,7 @@ make_full_graph <- function(n, directed = FALSE, loops = FALSE) { #' @rdname make_full_graph #' @export full_graph <- function(n, directed = FALSE, loops = FALSE) { - constructor_spec(make_full_graph, n, directed = directed, loops = loops) + constructor_spec(make_full_graph, n = n, directed = directed, loops = loops) } ## ----------------------------------------------------------------- @@ -2285,7 +2285,7 @@ make_from_prufer <- function(prufer) { #' @rdname make_from_prufer #' @export from_prufer <- function(prufer) { - constructor_spec(make_from_prufer, prufer) + constructor_spec(make_from_prufer, prufer = prufer) } ## ----------------------------------------------------------------- @@ -2331,7 +2331,7 @@ graph_from_atlas <- function(n) { #' @rdname graph_from_atlas #' @export atlas <- function(n) { - constructor_spec(graph_from_atlas, n) + constructor_spec(graph_from_atlas, n = n) } ## ----------------------------------------------------------------- @@ -2381,7 +2381,7 @@ make_chordal_ring <- function(n, w, directed = FALSE) { #' @rdname make_chordal_ring #' @export chordal_ring <- function(n, w, directed = FALSE) { - constructor_spec(make_chordal_ring, n, w, directed = directed) + constructor_spec(make_chordal_ring, n = n, w = w, directed = directed) } ## ----------------------------------------------------------------- @@ -2421,7 +2421,7 @@ make_circulant <- function(n, shifts, directed = FALSE) { #' @rdname make_circulant #' @export circulant <- function(n, shifts, directed = FALSE) { - constructor_spec(make_circulant, n, shifts, directed = directed) + constructor_spec(make_circulant, n = n, shifts = shifts, directed = directed) } ## ----------------------------------------------------------------- @@ -2470,7 +2470,7 @@ make_line_graph <- function(graph) { #' @rdname make_line_graph #' @export line_graph <- function(graph) { - constructor_spec(make_line_graph, graph) + constructor_spec(make_line_graph, graph = graph) } ## ----------------------------------------------------------------- @@ -2522,7 +2522,7 @@ make_de_bruijn_graph <- function(m, n) { #' @rdname make_de_bruijn_graph #' @export de_bruijn_graph <- function(m, n) { - constructor_spec(make_de_bruijn_graph, m, n) + constructor_spec(make_de_bruijn_graph, m = m, n = n) } ## ----------------------------------------------------------------- @@ -2570,7 +2570,7 @@ make_kautz_graph <- function(m, n) { #' @rdname make_kautz_graph #' @export kautz_graph <- function(m, n) { - constructor_spec(make_kautz_graph, m, n) + constructor_spec(make_kautz_graph, m = m, n = n) } ## ----------------------------------------------------------------- @@ -2646,8 +2646,8 @@ full_bipartite_graph <- function( ) { constructor_spec( make_full_bipartite_graph, - n1, - n2, + n1 = n1, + n2 = n2, directed = directed, mode = mode ) @@ -2731,7 +2731,7 @@ make_bipartite_graph <- function(types, edges, directed = FALSE) { #' @rdname make_bipartite_graph #' @export bipartite_graph <- function(types, edges, directed = FALSE) { - constructor_spec(make_bipartite_graph, types, edges, directed = directed) + constructor_spec(make_bipartite_graph, types = types, edges = edges, directed = directed) } ## ----------------------------------------------------------------- @@ -2796,7 +2796,7 @@ full_multipartite <- function( directed = FALSE, mode = c("all", "out", "in") ) { - constructor_spec(make_full_multipartite, n, directed = directed, mode = mode) + constructor_spec(make_full_multipartite, n = n, directed = directed, mode = mode) } ## ----------------------------------------------------------------- @@ -2851,7 +2851,7 @@ make_turan <- function(n, r) { #' @rdname make_turan #' @export turan <- function(n, r) { - constructor_spec(make_turan, n, r) + constructor_spec(make_turan, n = n, r = r) } ## ----------------------------------------------------------------- @@ -2884,7 +2884,7 @@ make_full_citation_graph <- function(n, directed = TRUE) { #' @rdname make_full_citation_graph #' @export full_citation_graph <- function(n, directed = TRUE) { - constructor_spec(make_full_citation_graph, n, directed = directed) + constructor_spec(make_full_citation_graph, n = n, directed = directed) } ## ----------------------------------------------------------------- From 54adc5d86cb626fddb0398ac99f8d9d687f6a423 Mon Sep 17 00:00:00 2001 From: krlmlr Date: Sun, 2 Nov 2025 15:09:17 +0000 Subject: [PATCH 6/6] chore: Auto-update from GitHub Actions Run: https://github.com/igraph/rigraph/actions/runs/19013880930 --- R/games.R | 43 ++++++++++++++++++++++++++++++++++++++----- R/make.R | 14 ++++++++++++-- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/R/games.R b/R/games.R index b5ceee2999..54c66a03cb 100644 --- a/R/games.R +++ b/R/games.R @@ -1500,7 +1500,13 @@ sample_growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { #' @export growing <- function(n, m = 1, ..., directed = TRUE, citation = FALSE) { check_dots_empty() - constructor_spec(sample_growing, n = n, m = m, directed = directed, citation = citation) + constructor_spec( + sample_growing, + n = n, + m = m, + directed = directed, + citation = citation + ) } ## ----------------------------------------------------------------- @@ -1965,7 +1971,13 @@ sample_grg <- function(nodes, radius, torus = FALSE, coords = FALSE) { #' @rdname sample_grg #' @export grg <- function(nodes, radius, torus = FALSE, coords = FALSE) { - constructor_spec(sample_grg, nodes = nodes, radius = radius, torus = torus, coords = coords) + constructor_spec( + sample_grg, + nodes = nodes, + radius = radius, + torus = torus, + coords = coords + ) } ## ----------------------------------------------------------------- @@ -2545,7 +2557,14 @@ bipartite_gnm <- function( mode = c("out", "in", "all") ) { check_dots_empty() - constructor_spec(sample_bipartite_gnm, n1 = n1, n2 = n2, m = m, directed = directed, mode = mode) + constructor_spec( + sample_bipartite_gnm, + n1 = n1, + n2 = n2, + m = m, + directed = directed, + mode = mode + ) } #' @rdname sample_bipartite_gnm @@ -2559,7 +2578,14 @@ bipartite_gnp <- function( mode = c("out", "in", "all") ) { check_dots_empty() - constructor_spec(sample_bipartite_gnp, n1 = n1, n2 = n2, p = p, directed = directed, mode = mode) + constructor_spec( + sample_bipartite_gnp, + n1 = n1, + n2 = n2, + p = p, + directed = directed, + mode = mode + ) } #' Bipartite random graphs @@ -2812,7 +2838,14 @@ sample_hierarchical_sbm <- function(n, m, rho, C, p) { #' @rdname sample_hierarchical_sbm #' @export hierarchical_sbm <- function(n, m, rho, C, p) { - constructor_spec(sample_hierarchical_sbm, n = n, m = m, rho = rho, C = C, p = p) + constructor_spec( + sample_hierarchical_sbm, + n = n, + m = m, + rho = rho, + C = C, + p = p + ) } ## ----------------------------------------------------------------- diff --git a/R/make.R b/R/make.R index 1577ea926b..c4602f393f 100644 --- a/R/make.R +++ b/R/make.R @@ -2725,7 +2725,12 @@ make_bipartite_graph <- function(types, edges, directed = FALSE) { #' @rdname make_bipartite_graph #' @export bipartite_graph <- function(types, edges, directed = FALSE) { - constructor_spec(make_bipartite_graph, types = types, edges = edges, directed = directed) + constructor_spec( + make_bipartite_graph, + types = types, + edges = edges, + directed = directed + ) } ## ----------------------------------------------------------------- @@ -2790,7 +2795,12 @@ full_multipartite <- function( directed = FALSE, mode = c("all", "out", "in") ) { - constructor_spec(make_full_multipartite, n = n, directed = directed, mode = mode) + constructor_spec( + make_full_multipartite, + n = n, + directed = directed, + mode = mode + ) } ## -----------------------------------------------------------------