diff --git a/R/attributes.R b/R/attributes.R index a75f4d2be3..13824155c1 100644 --- a/R/attributes.R +++ b/R/attributes.R @@ -433,7 +433,7 @@ graph.attributes <- function(graph) { #' @param name Name of the attribute to query. If missing, then #' all vertex attributes are returned in a list. #' @param index An optional vertex sequence to query the attribute only -#' for these vertices. +#' for these vertices. The default `NULL` selects all vertices. #' @return The value of the vertex attribute, or the list of #' all vertex attributes, if `name` is missing. #' @@ -448,16 +448,19 @@ graph.attributes <- function(graph) { #' vertex_attr(g, "label") #' vertex_attr(g) #' plot(g) -vertex_attr <- function(graph, name, index = V(graph)) { +vertex_attr <- function(graph, name, index = NULL) { ensure_igraph(graph) if (missing(name)) { - if (missing(index)) { + if (is.null(index)) { return(vertex.attributes(graph)) } return(vertex.attributes(graph, index = index)) } check_string(name) + if (is.null(index)) { + index <- V(graph) + } myattr <- .Call( Rx_igraph_mybracket2, @@ -479,7 +482,7 @@ vertex_attr <- function(graph, name, index = V(graph)) { #' then `value` must be a named list, and its entries are #' set as vertex attributes. #' @param index An optional vertex sequence to set the attributes -#' of a subset of vertices. +#' of a subset of vertices. The default `NULL` selects all vertices. #' @param value The new value of the attribute(s) for all #' (or `index`) vertices. #' @return The graph, with the vertex attribute(s) added or set. @@ -497,7 +500,10 @@ vertex_attr <- function(graph, name, index = V(graph)) { #' vertex_attr(g, "label") <- V(g)$name #' g #' plot(g) -`vertex_attr<-` <- function(graph, name, index = V(graph), value) { +`vertex_attr<-` <- function(graph, name, index = NULL, value) { + if (is.null(index)) { + index <- V(graph) + } if (missing(name)) { `vertex.attributes<-`(graph, index = index, value = value) } else { @@ -512,7 +518,7 @@ vertex_attr <- function(graph, name, index = V(graph)) { #' @param graph The graph. #' @param name The name of the attribute to set. #' @param index An optional vertex sequence to set the attributes -#' of a subset of vertices. +#' of a subset of vertices. The default `NULL` selects all vertices. #' @param value The new value of the attribute for all (or `index`) #' vertices. #' If `NULL`, the input is returned unchanged. @@ -526,10 +532,14 @@ vertex_attr <- function(graph, name, index = V(graph)) { #' set_vertex_attr("label", value = LETTERS[1:10]) #' g #' plot(g) -set_vertex_attr <- function(graph, name, index = V(graph), value) { +set_vertex_attr <- function(graph, name, index = NULL, value) { call <- rlang::current_env() check_string(name) + if (is.null(index)) { + index <- V(graph) + } + if (is_complete_iterator(index)) { return(i_set_vertex_attr( graph = graph, @@ -554,7 +564,7 @@ set_vertex_attr <- function(graph, name, index = V(graph), value) { #' @param graph The graph. #' @param ... <[`dynamic-dots`][rlang::dyn-dots]> Named arguments, where the names are the attributes #' @param index An optional vertex sequence to set the attributes -#' of a subset of vertices. +#' of a subset of vertices. The default `NULL` selects all vertices. #' @return The graph, with the vertex attributes added or set. #' #' @family attributes @@ -568,7 +578,7 @@ set_vertex_attr <- function(graph, name, index = V(graph), value) { #' set_vertex_attrs(g, !!!x) #' # to set an attribute named "index" use `:=` #' set_vertex_attrs(g, color = "blue", index := 10, name = LETTERS[1:10]) -set_vertex_attrs <- function(graph, ..., index = V(graph)) { +set_vertex_attrs <- function(graph, ..., index = NULL) { call <- rlang::current_env() dots <- rlang::list2(...) @@ -576,6 +586,10 @@ set_vertex_attrs <- function(graph, ..., index = V(graph)) { cli::cli_abort("All arguments in `...` must be named.") } + if (is.null(index)) { + index <- V(graph) + } + for (attr_name in names(dots)) { attr_value <- dots[[attr_name]] graph <- i_set_vertex_attr( @@ -660,10 +674,10 @@ i_set_vertex_attr <- function( } #' @export -vertex.attributes <- function(graph, index = V(graph)) { +vertex.attributes <- function(graph, index = NULL) { ensure_igraph(graph) - if (!missing(index)) { + if (!is.null(index)) { index <- as_igraph_vs(graph, index) } @@ -674,7 +688,7 @@ vertex.attributes <- function(graph, index = V(graph)) { igraph_attr_idx_vertex ) - if (!missing(index)) { + if (!is.null(index)) { if (!index_is_natural_vertex_sequence(index, graph)) { for (i in seq_along(res)) { res[[i]] <- res[[i]][index] @@ -743,7 +757,7 @@ set_value_at <- function(value, idx, length_out) { #' @param name The name of the attribute to query. If missing, then #' all edge attributes are returned in a list. #' @param index An optional edge sequence to query edge attributes -#' for a subset of edges. +#' for a subset of edges. The default `NULL` selects all edges. #' @return The value of the edge attribute, or the list of all #' edge attributes if `name` is missing. #' @@ -757,17 +771,20 @@ set_value_at <- function(value, idx, length_out) { #' set_edge_attr("color", value = "red") #' g #' plot(g, edge.width = E(g)$weight) -edge_attr <- function(graph, name, index = E(graph)) { +edge_attr <- function(graph, name, index = NULL) { ensure_igraph(graph) if (missing(name)) { - if (missing(index)) { + if (is.null(index)) { edge.attributes(graph) } else { edge.attributes(graph, index = index) } } else { check_string(name) + if (is.null(index)) { + index <- E(graph) + } myattr <- .Call( Rx_igraph_mybracket2, graph, @@ -790,7 +807,7 @@ edge_attr <- function(graph, name, index = E(graph)) { #' then `value` must be a named list, and its entries are #' set as edge attributes. #' @param index An optional edge sequence to set the attributes -#' of a subset of edges. +#' of a subset of edges. The default `NULL` selects all edges. #' @param value The new value of the attribute(s) for all #' (or `index`) edges. #' @return The graph, with the edge attribute(s) added or set. @@ -808,7 +825,10 @@ edge_attr <- function(graph, name, index = E(graph)) { #' edge_attr(g, "label") <- E(g)$name #' g #' plot(g) -`edge_attr<-` <- function(graph, name, index = E(graph), value) { +`edge_attr<-` <- function(graph, name, index = NULL, value) { + if (is.null(index)) { + index <- E(graph) + } if (missing(name)) { `edge.attributes<-`(graph, index = index, value = value) } else { @@ -822,7 +842,7 @@ edge_attr <- function(graph, name, index = E(graph)) { #' @param graph The graph #' @param name The name of the attribute to set. #' @param index An optional edge sequence to set the attributes of -#' a subset of edges. +#' a subset of edges. The default `NULL` selects all edges. #' @param value The new value of the attribute for all (or `index`) #' edges. #' If `NULL`, the input is returned unchanged. @@ -836,9 +856,12 @@ edge_attr <- function(graph, name, index = E(graph)) { #' set_edge_attr("label", value = LETTERS[1:10]) #' g #' plot(g) -set_edge_attr <- function(graph, name, index = E(graph), value) { +set_edge_attr <- function(graph, name, index = NULL, value) { call <- rlang::current_env() check_string(name) + if (is.null(index)) { + index <- E(graph) + } if (is_complete_iterator(index)) { i_set_edge_attr( graph = graph, @@ -928,10 +951,10 @@ i_set_edge_attr <- function( } #' @export -edge.attributes <- function(graph, index = E(graph)) { +edge.attributes <- function(graph, index = NULL) { ensure_igraph(graph) - if (!missing(index)) { + if (!is.null(index)) { index <- as_igraph_es(graph, index) } @@ -943,7 +966,7 @@ edge.attributes <- function(graph, index = E(graph)) { ) if ( - !missing(index) && + !is.null(index) && !index_is_natural_edge_sequence(index, graph) ) { for (i in seq_along(res)) { diff --git a/R/centrality.R b/R/centrality.R index b874c4e401..ec70be7fb7 100644 --- a/R/centrality.R +++ b/R/centrality.R @@ -382,6 +382,7 @@ betweenness.estimate <- estimate_betweenness #' @aliases edge.betweenness.estimate #' @param graph The graph to analyze. #' @param v The vertices for which the vertex betweenness will be calculated. +#' The default `NULL` selects all vertices. #' @inheritParams rlang::args_dots_empty #' @param directed Logical, whether directed paths should be considered while #' determining the shortest paths. @@ -430,7 +431,7 @@ betweenness.estimate <- estimate_betweenness #' betweenness <- function( graph, - v = V(graph), + v = NULL, ..., directed = TRUE, weights = NULL, @@ -469,6 +470,10 @@ betweenness <- function( } # END GENERATED ARG_HANDLE + if (is.null(v)) { + v <- V(graph) + } + res <- betweenness_cutoff_impl( graph = graph, vids = v, @@ -489,11 +494,12 @@ betweenness <- function( #' @rdname betweenness #' @param e The edges for which the edge betweenness will be calculated. +#' The default `NULL` selects all edges. #' @inheritParams rlang::args_dots_empty #' @export edge_betweenness <- function( graph, - e = E(graph), + e = NULL, ..., directed = TRUE, weights = NULL, @@ -521,6 +527,10 @@ edge_betweenness <- function( } # END GENERATED ARG_HANDLE + if (is.null(e)) { + e <- E(graph) + } + e <- as_igraph_es(graph, e) res <- edge_betweenness_cutoff_impl( graph = graph, @@ -593,6 +603,7 @@ edge.betweenness.estimate <- estimate_edge_betweenness #' @aliases closeness.estimate #' @param graph The graph to analyze. #' @param vids The vertices for which closeness will be calculated. +#' The default `NULL` selects all vertices. #' @inheritParams rlang::args_dots_empty #' @param mode Character string, defined the types of the paths used for #' measuring the distance in directed graphs. \dQuote{in} measures the paths @@ -628,7 +639,7 @@ edge.betweenness.estimate <- estimate_edge_betweenness #' closeness <- function( graph, - vids = V(graph), + vids = NULL, ..., mode = c("out", "in", "all", "total"), weights = NULL, @@ -667,6 +678,10 @@ closeness <- function( } # END GENERATED ARG_HANDLE + if (is.null(vids)) { + vids <- V(graph) + } + closeness_cutoff_impl( graph = graph, vids = vids, @@ -1451,6 +1466,7 @@ eigen_centrality <- function( #' #' @param graph The input graph. #' @param vids The vertices for which the strength will be calculated. +#' The default `NULL` selects all vertices. #' @inheritParams rlang::args_dots_empty #' @param mode Character string, \dQuote{out} for out-degree, \dQuote{in} for #' in-degree or \dQuote{all} for the sum of the two. For undirected graphs this @@ -1483,7 +1499,7 @@ eigen_centrality <- function( #' @export strength <- function( graph, - vids = V(graph), + vids = NULL, ..., mode = c("all", "out", "in", "total"), loops = TRUE, @@ -1515,6 +1531,10 @@ strength <- function( } # END GENERATED ARG_HANDLE + if (is.null(vids)) { + vids <- V(graph) + } + strength_impl( graph = graph, vids = vids, @@ -1548,6 +1568,7 @@ strength <- function( #' computation. If `NULL`, then the \sQuote{weight} attibute is used. Note #' that this measure is not defined for unweighted graphs. #' @param vids The vertex IDs for which to calculate the measure. +#' The default `NULL` selects all vertices. #' @return A numeric vector, its length is the number of vertices. #' @author Gabor Csardi \email{csardi.gabor@@gmail.com} #' @references Nathan Eagle, Michael Macy and Rob Claxton: Network Diversity @@ -1570,7 +1591,7 @@ diversity <- function( graph, ..., weights = NULL, - vids = V(graph) + vids = NULL ) { # BEGIN GENERATED ARG_HANDLE: diversity, do not edit, see tools/generate-migrations.R if (...length() > 0L) { @@ -1581,7 +1602,7 @@ diversity <- function( recover_old = c("weights", "vids"), match_names = c("weights", "vids"), match_to = c("weights", "vids"), - defaults = list(weights = NULL, vids = V(graph)), + defaults = list(weights = NULL, vids = NULL), head_args = c("graph"), fn_name = "diversity" ) @@ -1594,6 +1615,10 @@ diversity <- function( } # END GENERATED ARG_HANDLE + if (is.null(vids)) { + vids <- V(graph) + } + diversity_impl( graph = graph, weights = weights, @@ -1625,7 +1650,7 @@ diversity <- function( #' interprets edge weights as connection strengths. The weights of parallel #' edges are effectively added up. #' @param options A named list, to override some ARPACK options. See -#' [arpack()] for details. +#' [arpack()] for details. The default `NULL` uses [arpack_defaults()]. #' @inheritParams rlang::args_dots_empty #' @return A named list with members: #' \describe{ @@ -1665,10 +1690,14 @@ hits_scores <- function( ..., scale = TRUE, weights = NULL, - options = arpack_defaults() + options = NULL ) { rlang::check_dots_empty() + if (is.null(options)) { + options <- arpack_defaults() + } + hub_and_authority_scores_impl( graph = graph, scale = scale, @@ -1788,6 +1817,7 @@ hub_score <- function( #' default implementation from igraph version 0.5 until version 0.7. It computes #' PageRank scores by solving an eingevalue problem. #' @param vids The vertices of interest. +#' The default `NULL` selects all vertices. #' @param directed Logical, if true directed paths will be considered for #' directed graphs. It is ignored for undirected graphs. #' @param damping The damping factor (\sQuote{d} in the original paper). @@ -1848,7 +1878,7 @@ page_rank <- function( graph, ..., algo = c("prpack", "arpack"), - vids = V(graph), + vids = NULL, directed = TRUE, damping = 0.85, personalized = NULL, @@ -1906,7 +1936,7 @@ page_rank <- function( ), defaults = list( algo = c("prpack", "arpack"), - vids = V(graph), + vids = NULL, directed = TRUE, damping = 0.85, personalized = NULL, @@ -1925,6 +1955,10 @@ page_rank <- function( } # END GENERATED ARG_HANDLE + if (is.null(vids)) { + vids <- V(graph) + } + personalized_pagerank_impl( graph = graph, algo = algo, @@ -1949,6 +1983,7 @@ page_rank <- function( #' #' @param graph The graph to analyze. #' @param vids The vertices for which harmonic centrality will be calculated. +#' The default `NULL` selects all vertices. #' @inheritParams rlang::args_dots_empty #' @param mode Character string, defining the types of the paths used for #' measuring the distance in directed graphs. \dQuote{out} follows paths along @@ -1985,7 +2020,7 @@ page_rank <- function( #' harmonic_centrality <- function( graph, - vids = V(graph), + vids = NULL, ..., mode = c("out", "in", "all", "total"), weights = NULL, @@ -2024,6 +2059,10 @@ harmonic_centrality <- function( } # END GENERATED ARG_HANDLE + if (is.null(vids)) { + vids <- V(graph) + } + harmonic_centrality_cutoff_impl( graph = graph, vids = vids, @@ -2154,7 +2193,7 @@ bonpow.sparse <- function( #' #' @param graph the input graph. #' @param nodes vertex sequence indicating which vertices are to be included in -#' the calculation. By default, all vertices are included. +#' the calculation. The default `NULL` selects all vertices. #' @inheritParams rlang::args_dots_empty #' @param loops Logical indicating whether or not the diagonal should be #' treated as valid data. Set this true if and only if the data can contain @@ -2216,7 +2255,7 @@ bonpow.sparse <- function( #' power_centrality <- function( graph, - nodes = V(graph), + nodes = NULL, ..., loops = FALSE, exponent = 1, @@ -2282,6 +2321,10 @@ power_centrality <- function( } # END GENERATED ARG_HANDLE + if (is.null(nodes)) { + nodes <- V(graph) + } + nodes <- as_igraph_vs(graph, nodes) if (sparse) { res <- bonpow.sparse( @@ -2395,8 +2438,8 @@ alpha.centrality.sparse <- function( #' @param graph The input graph, can be directed or undirected. In undirected #' graphs, edges are treated as if they were reciprocal directed ones. #' @param nodes Vertex sequence, the vertices for which the alpha centrality -#' values are returned. (For technical reasons they will be calculated for all -#' vertices, anyway.) +#' values are returned. The default `NULL` selects all vertices. +#' (For technical reasons they will be calculated for all vertices, anyway.) #' @inheritParams rlang::args_dots_empty #' @param alpha Parameter specifying the relative importance of endogenous #' versus exogenous factors in the determination of centrality. See details @@ -2437,7 +2480,7 @@ alpha.centrality.sparse <- function( #' alpha_centrality <- function( graph, - nodes = V(graph), + nodes = NULL, ..., alpha = 1, loops = FALSE, @@ -2482,6 +2525,10 @@ alpha_centrality <- function( } # END GENERATED ARG_HANDLE + if (is.null(nodes)) { + nodes <- V(graph) + } + nodes <- as_igraph_vs(graph, nodes) if (sparse) { res <- alpha.centrality.sparse( diff --git a/R/cocitation.R b/R/cocitation.R index 5423dd7efb..f5c67ab277 100644 --- a/R/cocitation.R +++ b/R/cocitation.R @@ -39,7 +39,7 @@ #' @param graph The graph object to analyze #' @param v Vertex sequence or numeric vector, the vertex IDs for which the #' cocitation or bibliographic coupling values we want to calculate. The -#' default is all vertices. +#' default `NULL` selects all vertices. #' @return A numeric matrix with `length(v)` lines and #' `vcount(graph)` columns. Element `(i,j)` contains the cocitation #' or bibliographic coupling for vertices `v[i]` and `j`. @@ -53,7 +53,11 @@ #' cocitation(g) #' bibcoupling(g) #' -cocitation <- function(graph, v = V(graph)) { +cocitation <- function(graph, v = NULL) { + if (is.null(v)) { + v <- V(graph) + } + res <- cocitation_impl( graph = graph, vids = v @@ -68,7 +72,11 @@ cocitation <- function(graph, v = V(graph)) { #' @rdname cocitation #' @export -bibcoupling <- function(graph, v = V(graph)) { +bibcoupling <- function(graph, v = NULL) { + if (is.null(v)) { + v <- V(graph) + } + res <- bibcoupling_impl( graph = graph, vids = v diff --git a/R/cohesive.blocks.R b/R/cohesive.blocks.R index b27c2f859b..3cd2c138fb 100644 --- a/R/cohesive.blocks.R +++ b/R/cohesive.blocks.R @@ -259,8 +259,8 @@ blockGraphs <- function(blocks, graph) { #' them. By default all cohesive blocks are marked, except the one #' corresponding to the all vertices. #' @param layout The layout of a plot, it is simply passed on to -#' `plot.igraph()`, see the possible formats there. By default the -#' Reingold-Tilford layout generator is used. +#' `plot.igraph()`, see the possible formats there. The default `NULL` uses +#' the Reingold-Tilford layout generator. #' @param \dots Additional arguments. `plot_hierarchy()` and [plot()] pass #' them to `plot.igraph()`. [print()] and [summary()] ignore them. #' @return `cohesive_blocks()` returns a `cohesiveBlocks` object. @@ -538,9 +538,13 @@ plot.cohesiveBlocks <- function( #' @importFrom graphics plot plot_hierarchy <- function( blocks, - layout = layout_as_tree(hierarchy(blocks), root = 1), + layout = NULL, ... ) { + if (is.null(layout)) { + layout <- layout_as_tree(hierarchy(blocks), root = 1) + } + plot(hierarchy(blocks), layout = layout, ...) } diff --git a/R/community.R b/R/community.R index c966d54cff..d0849464d2 100644 --- a/R/community.R +++ b/R/community.R @@ -3130,7 +3130,7 @@ plot.communities <- function( #' @rdname plot_dendrogram.communities #' @export -plot_dendrogram <- function(x, mode = igraph_opt("dend.plot.type"), ...) { +plot_dendrogram <- function(x, mode = NULL, ...) { UseMethod("plot_dendrogram") } @@ -3197,6 +3197,7 @@ plot_dendrogram <- function(x, mode = igraph_opt("dend.plot.type"), ...) { #' @param x An object containing the community structure of a graph. See #' [communities()] for details. #' @param mode Which dendrogram plotting function to use. See details below. +#' The default `NULL` uses the `dend.plot.type` igraph option. #' @param \dots Additional arguments to supply to the dendrogram plotting #' function. #' @param use.modularity Logical, whether to use the modularity values @@ -3217,11 +3218,14 @@ plot_dendrogram <- function(x, mode = igraph_opt("dend.plot.type"), ...) { #' plot_dendrogram.communities <- function( x, - mode = igraph_opt("dend.plot.type"), + mode = NULL, ..., use.modularity = FALSE, palette = categorical_pal(8) ) { + if (is.null(mode)) { + mode <- igraph_opt("dend.plot.type") + } mode <- igraph_match_arg(mode, c("auto", "phylo", "hclust", "dendrogram")) old_palette <- palette(palette) @@ -3600,7 +3604,8 @@ communities <- groups.communities #' correspond to the vertices, and for each element the ID in the new graph is #' given. #' @param vertex.attr.comb Specifies how to combine the vertex attributes in -#' the new graph. Please see [attribute.combination()] for details. +#' the new graph. Please see [attribute.combination()] for details. The +#' default `NULL` uses the `vertex.attr.comb` igraph option. #' @return A new graph object. #' @author Gabor Csardi \email{csardi.gabor@@gmail.com} #' @keywords graphs @@ -3624,8 +3629,12 @@ communities <- groups.communities contract <- function( graph, mapping, - vertex.attr.comb = igraph_opt("vertex.attr.comb") + vertex.attr.comb = NULL ) { + if (is.null(vertex.attr.comb)) { + vertex.attr.comb <- igraph_opt("vertex.attr.comb") + } + contract_vertices_impl( graph = graph, mapping = mapping, diff --git a/R/conversion.R b/R/conversion.R index 9f44f19361..28d218c7f2 100644 --- a/R/conversion.R +++ b/R/conversion.R @@ -422,7 +422,7 @@ get.adjacency.sparse <- function( #' is present in the graph. #' @param sparse Logical, whether to create a sparse matrix. The #' \sQuote{`Matrix`} package must be installed for creating sparse -#' matrices. +#' matrices. The default `NULL` uses the `sparsematrices` igraph option. #' @return A `vcount(graph)` by `vcount(graph)` (usually) numeric #' matrix. #' @@ -444,7 +444,7 @@ as_adjacency_matrix <- function( ..., weights = NULL, names = TRUE, - sparse = igraph_opt("sparsematrices"), + sparse = NULL, edges = deprecated(), attr = deprecated() ) { @@ -468,7 +468,7 @@ as_adjacency_matrix <- function( defaults = list( weights = NULL, names = TRUE, - sparse = igraph_opt("sparsematrices"), + sparse = NULL, edges = deprecated(), attr = deprecated() ), @@ -484,6 +484,10 @@ as_adjacency_matrix <- function( } # END GENERATED ARG_HANDLE + if (is.null(sparse)) { + sparse <- igraph_opt("sparsematrices") + } + if (lifecycle::is_present(edges) && isTRUE(edges)) { lifecycle::deprecate_stop("2.0.0", "as_adjacency_matrix(edges = )") } @@ -740,15 +744,19 @@ as_directed <- function( #' `mode="collapse"` or `mode="mutual"`. In these cases many edges #' might be mapped to a single one in the new graph, and their attributes are #' combined. Please see [attribute.combination()] for details on -#' this. +#' this. The default `NULL` uses the `edge.attr.comb` igraph option. #' @export as_undirected <- function( graph, mode = c("collapse", "each", "mutual"), - edge.attr.comb = igraph_opt("edge.attr.comb") + edge.attr.comb = NULL ) { # Argument checks ensure_igraph(graph) + if (is.null(edge.attr.comb)) { + edge.attr.comb <- igraph_opt("edge.attr.comb") + } + mode <- igraph_match_arg(mode) # Function call diff --git a/R/efficiency.R b/R/efficiency.R index 51f6f34974..288d1fc86f 100644 --- a/R/efficiency.R +++ b/R/efficiency.R @@ -42,7 +42,8 @@ #' additionally, no edge weight may be NaN. If it is `NULL` (the default) #' and the graph has a `weight` edge attribute, then it is used automatically. #' @param vids The vertex IDs of the vertices for which the calculation will be done. -#' Applies to the local efficiency calculation only. +#' Applies to the local efficiency calculation only. The default `NULL` +#' selects all vertices. #' @param directed Logical, whether to consider directed paths. Ignored #' for undirected graphs. #' @param mode Specifies how to define the local neighborhood of a vertex in @@ -107,7 +108,7 @@ global_efficiency <- function( #' @export local_efficiency <- function( graph, - vids = V(graph), + vids = NULL, ..., weights = NULL, directed = TRUE, @@ -139,6 +140,10 @@ local_efficiency <- function( } # END GENERATED ARG_HANDLE + if (is.null(vids)) { + vids <- V(graph) + } + local_efficiency_impl( graph = graph, vids = vids, diff --git a/R/embedding.R b/R/embedding.R index 626d9db1d0..77f324decc 100644 --- a/R/embedding.R +++ b/R/embedding.R @@ -62,10 +62,12 @@ #' @param scaled Logical, if `FALSE`, then \eqn{U} and \eqn{V} are #' returned instead of \eqn{X} and \eqn{Y}. #' @param cvec A numeric vector, its length is the number vertices in the -#' graph. This vector is added to the diagonal of the adjacency matrix. +#' graph. This vector is added to the diagonal of the adjacency matrix. The +#' default `NULL` uses +#' `strength(graph, weights = weights) / (vcount(graph) - 1)`. #' @param options A named list containing the parameters for the SVD -#' computation algorithm in ARPACK. By default, the list of values is assigned -#' the values given by [arpack_defaults()]. +#' computation algorithm in ARPACK. The default `NULL` uses the values given +#' by [arpack_defaults()]. #' @return A list containing with entries: #' \describe{ #' \item{X}{ @@ -109,8 +111,8 @@ embed_adjacency_matrix <- function( weights = NULL, which = c("lm", "la", "sa"), scaled = TRUE, - cvec = strength(graph, weights = weights) / (vcount(graph) - 1), - options = arpack_defaults() + cvec = NULL, + options = NULL ) { # BEGIN GENERATED ARG_HANDLE: embed_adjacency_matrix, do not edit, see tools/generate-migrations.R if (...length() > 0L) { @@ -131,8 +133,8 @@ embed_adjacency_matrix <- function( weights = NULL, which = c("lm", "la", "sa"), scaled = TRUE, - cvec = strength(graph, weights = weights) / (vcount(graph) - 1), - options = arpack_defaults() + cvec = NULL, + options = NULL ), head_args = c("graph", "no"), fn_name = "embed_adjacency_matrix" @@ -146,6 +148,13 @@ embed_adjacency_matrix <- function( } # END GENERATED ARG_HANDLE + if (is.null(cvec)) { + cvec <- strength(graph, weights = weights) / (vcount(graph) - 1) + } + if (is.null(options)) { + options <- arpack_defaults() + } + adjacency_spectral_embedding_impl( graph = graph, no = no, @@ -272,8 +281,8 @@ dim_select <- function(sv) { #' @param scaled Logical, if `FALSE`, then \eqn{U} and \eqn{V} are #' returned instead of \eqn{X} and \eqn{Y}. #' @param options A named list containing the parameters for the SVD -#' computation algorithm in ARPACK. By default, the list of values is assigned -#' the values given by [arpack_defaults()]. +#' computation algorithm in ARPACK. The default `NULL` uses the values given +#' by [arpack_defaults()]. #' @return A list containing with entries: #' \describe{ #' \item{X}{ @@ -320,7 +329,7 @@ embed_laplacian_matrix <- function( which = c("lm", "la", "sa"), type = c("default", "D-A", "DAD", "I-DAD", "OAP"), scaled = TRUE, - options = arpack_defaults() + options = NULL ) { # BEGIN GENERATED ARG_HANDLE: embed_laplacian_matrix, do not edit, see tools/generate-migrations.R if (...length() > 0L) { @@ -342,7 +351,7 @@ embed_laplacian_matrix <- function( which = c("lm", "la", "sa"), type = c("default", "D-A", "DAD", "I-DAD", "OAP"), scaled = TRUE, - options = arpack_defaults() + options = NULL ), head_args = c("graph", "no"), fn_name = "embed_laplacian_matrix" @@ -356,6 +365,10 @@ embed_laplacian_matrix <- function( } # END GENERATED ARG_HANDLE + if (is.null(options)) { + options <- arpack_defaults() + } + laplacian_spectral_embedding_impl( graph = graph, no = no, diff --git a/R/games.R b/R/games.R index 6a0cf53800..45a7ab8252 100644 --- a/R/games.R +++ b/R/games.R @@ -2248,9 +2248,10 @@ pa_age <- function( #' @inheritParams rlang::args_dots_empty #' @param edge.per.step The number of edges to add to the graph per time step. #' @param type.dist The distribution of the vertex types. This is assumed to be -#' stationary in time. +#' stationary in time. The default `NULL` gives a uniform distribution. #' @param pref.matrix A matrix giving the preferences of the given vertex #' types. These should be probabilities, i.e. numbers between zero and one. +#' The default `NULL` sets all preferences to one. #' @param directed Logical, whether to generate directed graphs. #' @param k The number of trials per time step, see details below. #' @return A new graph object. @@ -2268,8 +2269,8 @@ sample_traits_callaway <- function( types, ..., edge.per.step = 1, - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) { # BEGIN GENERATED ARG_HANDLE: sample_traits_callaway, do not edit, see tools/generate-migrations.R @@ -2293,8 +2294,8 @@ sample_traits_callaway <- function( match_to = c("edge.per.step", "type.dist", "pref.matrix", "directed"), defaults = list( edge.per.step = 1, - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ), head_args = c("nodes", "types"), @@ -2309,6 +2310,13 @@ sample_traits_callaway <- function( } # END GENERATED ARG_HANDLE + if (is.null(type.dist)) { + type.dist <- rep(1, types) + } + if (is.null(pref.matrix)) { + pref.matrix <- matrix(1, types, types) + } + res <- callaway_traits_game_impl( nodes = nodes, types = types, @@ -2339,8 +2347,8 @@ traits_callaway <- function( types, ..., edge.per.step = 1, - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) { # BEGIN GENERATED ARG_HANDLE: traits_callaway, do not edit, see tools/generate-migrations.R @@ -2364,8 +2372,8 @@ traits_callaway <- function( match_to = c("edge.per.step", "type.dist", "pref.matrix", "directed"), defaults = list( edge.per.step = 1, - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ), head_args = c("nodes", "types"), @@ -2380,6 +2388,13 @@ traits_callaway <- function( } # END GENERATED ARG_HANDLE + if (is.null(type.dist)) { + type.dist <- rep(1, types) + } + if (is.null(pref.matrix)) { + pref.matrix <- matrix(1, types, types) + } + constructor_spec( sample_traits_callaway, nodes, @@ -2399,8 +2414,8 @@ sample_traits <- function( types, k = 1, ..., - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) { # BEGIN GENERATED ARG_HANDLE: sample_traits, do not edit, see tools/generate-migrations.R @@ -2421,11 +2436,7 @@ sample_traits <- function( recover_old = c("type.dist", "pref.matrix", "directed"), match_names = c("type.dist", "pref.matrix", "directed"), match_to = c("type.dist", "pref.matrix", "directed"), - defaults = list( - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), - directed = FALSE - ), + defaults = list(type.dist = NULL, pref.matrix = NULL, directed = FALSE), head_args = c("nodes", "types", "k"), fn_name = "sample_traits" ) @@ -2438,6 +2449,13 @@ sample_traits <- function( } # END GENERATED ARG_HANDLE + if (is.null(type.dist)) { + type.dist <- rep(1, types) + } + if (is.null(pref.matrix)) { + pref.matrix <- matrix(1, types, types) + } + res <- establishment_game_impl( nodes = nodes, types = types, @@ -2464,8 +2482,8 @@ traits <- function( types, k = 1, ..., - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) { # BEGIN GENERATED ARG_HANDLE: traits, do not edit, see tools/generate-migrations.R @@ -2486,11 +2504,7 @@ traits <- function( recover_old = c("type.dist", "pref.matrix", "directed"), match_names = c("type.dist", "pref.matrix", "directed"), match_to = c("type.dist", "pref.matrix", "directed"), - defaults = list( - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), - directed = FALSE - ), + defaults = list(type.dist = NULL, pref.matrix = NULL, directed = FALSE), head_args = c("nodes", "types", "k"), fn_name = "traits" ) @@ -2503,6 +2517,13 @@ traits <- function( } # END GENERATED ARG_HANDLE + if (is.null(type.dist)) { + type.dist <- rep(1, types) + } + if (is.null(pref.matrix)) { + pref.matrix <- matrix(1, types, types) + } + constructor_spec( sample_traits, nodes, @@ -2665,15 +2686,17 @@ grg <- function( #' @inheritParams rlang::args_dots_empty #' @param type.dist The distribution of the vertex types, a numeric vector of #' length \sQuote{types} containing non-negative numbers. The vector will be -#' normed to obtain probabilities. +#' normed to obtain probabilities. The default `NULL` gives a uniform +#' distribution. #' @param fixed.sizes Fix the number of vertices with a given vertex type #' label. The `type.dist` argument gives the group sizes (i.e. number of #' vertices with the different labels) in this case. #' @param type.dist.matrix The joint distribution of the in- and out-vertex -#' types. +#' types. The default `NULL` gives a uniform distribution. #' @param pref.matrix A square matrix giving the preferences of the vertex #' types. The matrix has \sQuote{types} rows and columns. When generating -#' an undirected graph, it must be symmetric. +#' an undirected graph, it must be symmetric. The default `NULL` sets all +#' preferences to one. #' @param directed Logical, whether to create a directed graph. #' @param loops Logical, whether self-loops are allowed in the graph. #' @return An igraph graph. @@ -2701,9 +2724,9 @@ sample_pref <- function( nodes, types, ..., - type.dist = rep(1, types), + type.dist = NULL, fixed.sizes = FALSE, - pref.matrix = matrix(1, types, types), + pref.matrix = NULL, directed = FALSE, loops = FALSE ) { @@ -2752,9 +2775,9 @@ sample_pref <- function( "loops" ), defaults = list( - type.dist = rep(1, types), + type.dist = NULL, fixed.sizes = FALSE, - pref.matrix = matrix(1, types, types), + pref.matrix = NULL, directed = FALSE, loops = FALSE ), @@ -2770,6 +2793,13 @@ sample_pref <- function( } # END GENERATED ARG_HANDLE + if (is.null(type.dist)) { + type.dist <- rep(1, types) + } + if (is.null(pref.matrix)) { + pref.matrix <- matrix(1, types, types) + } + if (nrow(pref.matrix) != types || ncol(pref.matrix) != types) { cli::cli_abort(c( "{.arg pref.matrix} must have {.arg types} rows and columns.", @@ -2805,9 +2835,9 @@ pref <- function( nodes, types, ..., - type.dist = rep(1, types), + type.dist = NULL, fixed.sizes = FALSE, - pref.matrix = matrix(1, types, types), + pref.matrix = NULL, directed = FALSE, loops = FALSE ) { @@ -2856,9 +2886,9 @@ pref <- function( "loops" ), defaults = list( - type.dist = rep(1, types), + type.dist = NULL, fixed.sizes = FALSE, - pref.matrix = matrix(1, types, types), + pref.matrix = NULL, directed = FALSE, loops = FALSE ), @@ -2874,6 +2904,13 @@ pref <- function( } # END GENERATED ARG_HANDLE + if (is.null(type.dist)) { + type.dist <- rep(1, types) + } + if (is.null(pref.matrix)) { + pref.matrix <- matrix(1, types, types) + } + constructor_spec( sample_pref, nodes, @@ -2893,8 +2930,8 @@ sample_asym_pref <- function( nodes, types, ..., - type.dist.matrix = matrix(1, types, types), - pref.matrix = matrix(1, types, types), + type.dist.matrix = NULL, + pref.matrix = NULL, loops = FALSE ) { # BEGIN GENERATED ARG_HANDLE: sample_asym_pref, do not edit, see tools/generate-migrations.R @@ -2916,8 +2953,8 @@ sample_asym_pref <- function( match_names = c("type.dist.matrix", "pref.matrix", "loops"), match_to = c("type.dist.matrix", "pref.matrix", "loops"), defaults = list( - type.dist.matrix = matrix(1, types, types), - pref.matrix = matrix(1, types, types), + type.dist.matrix = NULL, + pref.matrix = NULL, loops = FALSE ), head_args = c("nodes", "types"), @@ -2932,6 +2969,13 @@ sample_asym_pref <- function( } # END GENERATED ARG_HANDLE + if (is.null(type.dist.matrix)) { + type.dist.matrix <- matrix(1, types, types) + } + if (is.null(pref.matrix)) { + pref.matrix <- matrix(1, types, types) + } + if (nrow(pref.matrix) != types || ncol(pref.matrix) != types) { cli::cli_abort(c( "{.arg pref.matrix} must have {.arg types} rows and columns.", @@ -2973,8 +3017,8 @@ asym_pref <- function( nodes, types, ..., - type.dist.matrix = matrix(1, types, types), - pref.matrix = matrix(1, types, types), + type.dist.matrix = NULL, + pref.matrix = NULL, loops = FALSE ) { # BEGIN GENERATED ARG_HANDLE: asym_pref, do not edit, see tools/generate-migrations.R @@ -2996,8 +3040,8 @@ asym_pref <- function( match_names = c("type.dist.matrix", "pref.matrix", "loops"), match_to = c("type.dist.matrix", "pref.matrix", "loops"), defaults = list( - type.dist.matrix = matrix(1, types, types), - pref.matrix = matrix(1, types, types), + type.dist.matrix = NULL, + pref.matrix = NULL, loops = FALSE ), head_args = c("nodes", "types"), @@ -3012,6 +3056,13 @@ asym_pref <- function( } # END GENERATED ARG_HANDLE + if (is.null(type.dist.matrix)) { + type.dist.matrix <- matrix(1, types, types) + } + if (is.null(pref.matrix)) { + pref.matrix <- matrix(1, types, types) + } + constructor_spec( sample_asym_pref, nodes, @@ -3227,13 +3278,16 @@ smallworld <- function( #' @param n Number of vertices. #' @param edges Number of edges per step. #' @inheritParams rlang::args_dots_empty -#' @param agebins Number of aging bins. +#' @param agebins Number of aging bins. The default `NULL` uses `n / 7100`. #' @param pref Vector (`sample_last_cit()` and `sample_cit_types()` or #' matrix (`sample_cit_cit_types()`) giving the (unnormalized) citation -#' probabilities for the different vertex types. +#' probabilities for the different vertex types. The default `NULL` uses +#' `(1:(agebins + 1))^-3` for `sample_last_cit()` and all-one probabilities +#' for the other two. #' @param directed Logical, whether to generate directed networks. #' @param types Vector of length \sQuote{`n`}, the types of the vertices. -#' Types are numbered from zero. +#' Types are numbered from zero. The default `NULL` gives all vertices +#' type zero. #' @param attr Logical, whether to add the vertex types to the generated #' graph as a vertex attribute called \sQuote{`type`}. #' @return A new graph. @@ -3245,8 +3299,8 @@ sample_last_cit <- function( n, edges = 1, ..., - agebins = n / 7100, - pref = (1:(agebins + 1))^-3, + agebins = NULL, + pref = NULL, directed = TRUE ) { # BEGIN GENERATED ARG_HANDLE: sample_last_cit, do not edit, see tools/generate-migrations.R @@ -3258,11 +3312,7 @@ sample_last_cit <- function( recover_old = c("agebins", "pref", "directed"), match_names = c("agebins", "pref", "directed"), match_to = c("agebins", "pref", "directed"), - defaults = list( - agebins = n / 7100, - pref = (1:(agebins + 1))^-3, - directed = TRUE - ), + defaults = list(agebins = NULL, pref = NULL, directed = TRUE), head_args = c("n", "edges"), fn_name = "sample_last_cit" ) @@ -3275,6 +3325,13 @@ sample_last_cit <- function( } # END GENERATED ARG_HANDLE + if (is.null(agebins)) { + agebins <- n / 7100 + } + if (is.null(pref)) { + pref <- (1:(agebins + 1))^-3 + } + res <- lastcit_game_impl( nodes = n, edges_per_node = edges, @@ -3297,8 +3354,8 @@ last_cit <- function( n, edges = 1, ..., - agebins = n / 7100, - pref = (1:(agebins + 1))^-3, + agebins = NULL, + pref = NULL, directed = TRUE ) { # BEGIN GENERATED ARG_HANDLE: last_cit, do not edit, see tools/generate-migrations.R @@ -3310,11 +3367,7 @@ last_cit <- function( recover_old = c("agebins", "pref", "directed"), match_names = c("agebins", "pref", "directed"), match_to = c("agebins", "pref", "directed"), - defaults = list( - agebins = n / 7100, - pref = (1:(agebins + 1))^-3, - directed = TRUE - ), + defaults = list(agebins = NULL, pref = NULL, directed = TRUE), head_args = c("n", "edges"), fn_name = "last_cit" ) @@ -3327,6 +3380,13 @@ last_cit <- function( } # END GENERATED ARG_HANDLE + if (is.null(agebins)) { + agebins <- n / 7100 + } + if (is.null(pref)) { + pref <- (1:(agebins + 1))^-3 + } + constructor_spec( sample_last_cit, n = n, @@ -3343,9 +3403,9 @@ last_cit <- function( sample_cit_types <- function( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = rep(1, length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) { @@ -3358,11 +3418,7 @@ sample_cit_types <- function( recover_old = c("pref", "directed", "attr"), match_names = c("pref", "directed", "attr"), match_to = c("pref", "directed", "attr"), - defaults = list( - pref = rep(1, length(types)), - directed = TRUE, - attr = TRUE - ), + defaults = list(pref = NULL, directed = TRUE, attr = TRUE), head_args = c("n", "edges", "types"), fn_name = "sample_cit_types" ) @@ -3375,6 +3431,13 @@ sample_cit_types <- function( } # END GENERATED ARG_HANDLE + if (is.null(types)) { + types <- rep(0, n) + } + if (is.null(pref)) { + pref <- rep(1, length(types)) + } + res <- cited_type_game_impl( nodes = n, types = types, @@ -3398,9 +3461,9 @@ sample_cit_types <- function( cit_types <- function( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = rep(1, length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) { @@ -3413,11 +3476,7 @@ cit_types <- function( recover_old = c("pref", "directed", "attr"), match_names = c("pref", "directed", "attr"), match_to = c("pref", "directed", "attr"), - defaults = list( - pref = rep(1, length(types)), - directed = TRUE, - attr = TRUE - ), + defaults = list(pref = NULL, directed = TRUE, attr = TRUE), head_args = c("n", "edges", "types"), fn_name = "cit_types" ) @@ -3430,6 +3489,13 @@ cit_types <- function( } # END GENERATED ARG_HANDLE + if (is.null(types)) { + types <- rep(0, n) + } + if (is.null(pref)) { + pref <- rep(1, length(types)) + } + constructor_spec( sample_cit_types, n = n, @@ -3447,9 +3513,9 @@ cit_types <- function( sample_cit_cit_types <- function( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = matrix(1, nrow = length(types), ncol = length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) { @@ -3462,11 +3528,7 @@ sample_cit_cit_types <- function( recover_old = c("pref", "directed", "attr"), match_names = c("pref", "directed", "attr"), match_to = c("pref", "directed", "attr"), - defaults = list( - pref = matrix(1, nrow = length(types), ncol = length(types)), - directed = TRUE, - attr = TRUE - ), + defaults = list(pref = NULL, directed = TRUE, attr = TRUE), head_args = c("n", "edges", "types"), fn_name = "sample_cit_cit_types" ) @@ -3479,6 +3541,13 @@ sample_cit_cit_types <- function( } # END GENERATED ARG_HANDLE + if (is.null(types)) { + types <- rep(0, n) + } + if (is.null(pref)) { + pref <- matrix(1, nrow = length(types), ncol = length(types)) + } + pref[] <- as.numeric(pref) res <- citing_cited_type_game_impl( nodes = n, @@ -3503,9 +3572,9 @@ sample_cit_cit_types <- function( cit_cit_types <- function( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = matrix(1, nrow = length(types), ncol = length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) { @@ -3518,11 +3587,7 @@ cit_cit_types <- function( recover_old = c("pref", "directed", "attr"), match_names = c("pref", "directed", "attr"), match_to = c("pref", "directed", "attr"), - defaults = list( - pref = matrix(1, nrow = length(types), ncol = length(types)), - directed = TRUE, - attr = TRUE - ), + defaults = list(pref = NULL, directed = TRUE, attr = TRUE), head_args = c("n", "edges", "types"), fn_name = "cit_cit_types" ) @@ -3535,6 +3600,13 @@ cit_cit_types <- function( } # END GENERATED ARG_HANDLE + if (is.null(types)) { + types <- rep(0, n) + } + if (is.null(pref)) { + pref <- matrix(1, nrow = length(types), ncol = length(types)) + } + constructor_spec( sample_cit_cit_types, n = n, @@ -4750,8 +4822,8 @@ sample_forestfire <- function( #' graph (the adjacency matrix being used as a vector). #' @inheritParams rlang::args_dots_empty #' @param p A numeric scalar, the probability of an edge between two -#' vertices, it must in the open (0,1) interval. The default is the empirical -#' edge density of the graph. If you are resampling an Erdős-Rényi graph and +#' vertices, it must in the open (0,1) interval. The default `NULL` uses the +#' empirical edge density of the graph. If you are resampling an Erdős-Rényi graph and #' you know the original edge probability of the Erdős-Rényi model, you should #' supply that explicitly. #' @param permutation A numeric vector, a permutation vector that is @@ -4777,7 +4849,7 @@ sample_correlated_gnp <- function( old.graph, corr, ..., - p = edge_density(old.graph), + p = NULL, permutation = NULL ) { # BEGIN GENERATED ARG_HANDLE: sample_correlated_gnp, do not edit, see tools/generate-migrations.R @@ -4789,7 +4861,7 @@ sample_correlated_gnp <- function( recover_old = c("p", "permutation"), match_names = c("p", "permutation"), match_to = c("p", "permutation"), - defaults = list(p = edge_density(old.graph), permutation = NULL), + defaults = list(p = NULL, permutation = NULL), head_args = c("old.graph", "corr"), fn_name = "sample_correlated_gnp" ) @@ -4802,6 +4874,10 @@ sample_correlated_gnp <- function( } # END GENERATED ARG_HANDLE + if (is.null(p)) { + p <- edge_density(old.graph) + } + correlated_game_impl( old_graph = old.graph, corr = corr, diff --git a/R/glet.R b/R/glet.R index 81e97cda8a..718d93f80c 100644 --- a/R/glet.R +++ b/R/glet.R @@ -71,7 +71,8 @@ graphlets.candidate.basis <- function(graph, weights = NULL) { #' @param niter Integer scalar, the number of iterations to perform. #' @param cliques A list of vertex IDs, the graphlet basis to use for the #' projection. -#' @param Mu Starting weights for the projection. +#' @param Mu Starting weights for the projection. The default `NULL` uses a +#' weight of one for each clique. #' @return `graphlets()` returns a list with two members: #' \describe{ #' \item{cliques}{ @@ -178,7 +179,7 @@ graphlet_proj <- function( weights = NULL, cliques, niter = 1000, - Mu = rep(1, length(cliques)) + Mu = NULL ) { # BEGIN GENERATED ARG_HANDLE: graphlet_proj, do not edit, see tools/generate-migrations.R if (...length() > 0L) { @@ -189,11 +190,7 @@ graphlet_proj <- function( recover_old = c("weights", "cliques", "niter", "Mu"), match_names = c("weights", "cliques", "niter", "Mu"), match_to = c("weights", "cliques", "niter", "Mu"), - defaults = list( - weights = NULL, - niter = 1000, - Mu = rep(1, length(cliques)) - ), + defaults = list(weights = NULL, niter = 1000, Mu = NULL), head_args = c("graph"), fn_name = "graphlet_proj" ) @@ -208,6 +205,10 @@ graphlet_proj <- function( # Argument checks ensure_igraph(graph) + if (is.null(Mu)) { + Mu <- rep(1, length(cliques)) + } + if (is.null(weights) && "weight" %in% edge_attr_names(graph)) { weights <- E(graph)$weight } diff --git a/R/hrg.R b/R/hrg.R index e03d7bfca1..d01be95016 100644 --- a/R/hrg.R +++ b/R/hrg.R @@ -266,11 +266,11 @@ fit_hrg <- function( ensure_igraph(graph) if (is.null(hrg)) { hrg <- list( - left = c(), - right = c(), - prob = c(), - edges = c(), - vertices = c() + left = numeric(), + right = numeric(), + prob = numeric(), + edges = numeric(), + vertices = numeric() ) } hrg <- lapply( @@ -830,6 +830,7 @@ rlang::on_load(s3_register("ape::as.phylo", "igraphHRG")) #' @param x An `igraphHRG`, a hierarchical random graph, as returned by #' the [fit_hrg()] function. #' @param mode Which dendrogram plotting function to use. See details below. +#' The default `NULL` uses the `dend.plot.type` igraph option. #' @param \dots Additional arguments to supply to the dendrogram plotting #' function. #' @return Returns whatever the return value was from the plotting function, @@ -846,9 +847,12 @@ rlang::on_load(s3_register("ape::as.phylo", "igraphHRG")) #' plot_dendrogram.igraphHRG <- function( x, - mode = igraph_opt("dend.plot.type"), + mode = NULL, ... ) { + if (is.null(mode)) { + mode <- igraph_opt("dend.plot.type") + } if (mode == "auto") { have_ape <- requireNamespace("ape", quietly = TRUE) mode <- if (have_ape) "phylo" else "hclust" diff --git a/R/layout.R b/R/layout.R index 7c6d472e70..aa15547ea6 100644 --- a/R/layout.R +++ b/R/layout.R @@ -619,8 +619,12 @@ component_wise <- function(merge_method = "dla") { #' Scale coordinates of a layout. #' #' @param xmin,xmax Minimum and maximum for x coordinates. -#' @param ymin,ymax Minimum and maximum for y coordinates. -#' @param zmin,zmax Minimum and maximum for z coordinates. +#' @param ymin,ymax Minimum and maximum for y coordinates. When omitted, +#' they follow `xmin` and `xmax`; `NULL` disables normalization along +#' this axis. +#' @param zmin,zmax Minimum and maximum for z coordinates. When omitted, +#' they follow `xmin` and `xmax`; `NULL` disables normalization along +#' this axis. #' #' @family layout modifiers #' @family graph layouts @@ -631,11 +635,27 @@ component_wise <- function(merge_method = "dla") { normalize <- function( xmin = -1, xmax = 1, - ymin = xmin, - ymax = xmax, - zmin = xmin, - zmax = xmax + ymin = NULL, + ymax = NULL, + zmin = NULL, + zmax = NULL ) { + # NULL is a legal value here (norm_coords() skips normalization along an + # axis with a NULL limit), so the fallback to the x limits applies only + # when an argument is not supplied at all. + if (missing(ymin)) { + ymin <- xmin + } + if (missing(ymax)) { + ymax <- xmax + } + if (missing(zmin)) { + zmin <- xmin + } + if (missing(zmax)) { + zmax <- xmax + } + args <- grab_args() layout_modifier( @@ -760,8 +780,8 @@ as_bipartite <- function(...) layout_spec(layout_as_bipartite, ...) #' #' @param graph The graph to layout. #' @inheritParams rlang::args_dots_empty -#' @param center The ID of the vertex to put in the center. By default it is -#' the first vertex. +#' @param center The ID of the vertex to put in the center. The default +#' `NULL` uses the first vertex. #' @param order Numeric vector, the order of the vertices along the perimeter. #' The default ordering is given by the vertex IDs. #' @return A matrix with two columns and as many rows as the number of vertices @@ -783,7 +803,7 @@ as_bipartite <- function(...) layout_spec(layout_as_bipartite, ...) layout_as_star <- function( graph, ..., - center = V(graph)[1], + center = NULL, order = NULL ) { # BEGIN GENERATED ARG_HANDLE: layout_as_star, do not edit, see tools/generate-migrations.R @@ -795,7 +815,7 @@ layout_as_star <- function( recover_old = c("center", "order"), match_names = c("center", "order"), match_to = c("center", "order"), - defaults = list(center = V(graph)[1], order = NULL), + defaults = list(center = NULL, order = NULL), head_args = c("graph"), fn_name = "layout_as_star" ) @@ -815,6 +835,9 @@ layout_as_star <- function( # vertices return(layout_in_circle(graph)) } + if (is.null(center)) { + center <- V(graph)[1] + } # Use the _impl function layout_star_impl( graph = graph, @@ -998,7 +1021,8 @@ layout.reingold.tilford <- function(..., params = list()) { #' @param graph The input graph. #' @param order The vertices to place on the circle, in the order of their #' desired placement. Vertices that are not included here will be placed at -#' (0,0). +#' (0,0). The default `NULL` selects all vertices, in the order of their +#' IDs. #' @return A numeric matrix with two columns, and one row for each vertex. #' @author Gabor Csardi \email{csardi.gabor@@gmail.com} #' @keywords graphs @@ -1019,7 +1043,11 @@ layout.reingold.tilford <- function(..., params = list()) { #' V(karate)$label.color <- membership(karate_groups) #' V(karate)$shape <- "none" #' plot(karate, layout = coords) -layout_in_circle <- function(graph, order = V(graph)) { +layout_in_circle <- function(graph, order = NULL) { + if (is.null(order)) { + order <- V(graph) + } + # Use the _impl function layout_circle_impl( graph = graph, @@ -1421,7 +1449,8 @@ layout.random <- function(..., params = list()) { #' is not `NULL` then it should be an appropriate matrix of starting #' coordinates. #' @param maxiter Number of iterations to perform in the first phase. -#' @param fineiter Number of iterations in the fine tuning phase. +#' @param fineiter Number of iterations in the fine tuning phase. The +#' default `NULL` uses `max(10, log2(vcount(graph)))`. #' @param cool.fact Cooling factor. #' @param weight.node.dist Weight for the node-node distances component of the #' energy function. @@ -1429,11 +1458,13 @@ layout.random <- function(..., params = list()) { #' the energy function. It can be set to zero, if vertices are allowed to sit #' on the border. #' @param weight.edge.lengths Weight for the edge length component of the -#' energy function. +#' energy function. The default `NULL` uses `edge_density(graph) / 10`. #' @param weight.edge.crossings Weight for the edge crossing component of the -#' energy function. +#' energy function. The default `NULL` uses +#' `1 - sqrt(edge_density(graph))`. #' @param weight.node.edge.dist Weight for the node-edge distance component of -#' the energy function. +#' the energy function. The default `NULL` uses +#' `0.2 * (1 - edge_density(graph))`. #' @return A matrix with two columns, containing the x and y coordinates #' of the vertices: #' \describe{ @@ -1510,13 +1541,13 @@ layout_with_dh <- function( ..., coords = NULL, maxiter = 10, - fineiter = max(10, log2(vcount(graph))), + fineiter = NULL, cool.fact = 0.75, weight.node.dist = 1.0, weight.border = 0.0, - weight.edge.lengths = edge_density(graph) / 10, - weight.edge.crossings = 1.0 - sqrt(edge_density(graph)), - weight.node.edge.dist = 0.2 * (1 - edge_density(graph)) + weight.edge.lengths = NULL, + weight.edge.crossings = NULL, + weight.node.edge.dist = NULL ) { # BEGIN GENERATED ARG_HANDLE: layout_with_dh, do not edit, see tools/generate-migrations.R if (...length() > 0L) { @@ -1580,13 +1611,13 @@ layout_with_dh <- function( defaults = list( coords = NULL, maxiter = 10, - fineiter = max(10, log2(vcount(graph))), + fineiter = NULL, cool.fact = 0.75, weight.node.dist = 1, weight.border = 0, - weight.edge.lengths = edge_density(graph) / 10, - weight.edge.crossings = 1 - sqrt(edge_density(graph)), - weight.node.edge.dist = 0.2 * (1 - edge_density(graph)) + weight.edge.lengths = NULL, + weight.edge.crossings = NULL, + weight.node.edge.dist = NULL ), head_args = c("graph"), fn_name = "layout_with_dh" @@ -1600,6 +1631,19 @@ layout_with_dh <- function( } # END GENERATED ARG_HANDLE + if (is.null(fineiter)) { + fineiter <- max(10, log2(vcount(graph))) + } + if (is.null(weight.edge.lengths)) { + weight.edge.lengths <- edge_density(graph) / 10 + } + if (is.null(weight.edge.crossings)) { + weight.edge.crossings <- 1.0 - sqrt(edge_density(graph)) + } + if (is.null(weight.node.edge.dist)) { + weight.node.edge.dist <- 0.2 * (1 - edge_density(graph)) + } + if (is.null(coords)) { coords <- matrix(NA_real_, ncol = 2, nrow = 0) use.seed <- FALSE @@ -1651,7 +1695,8 @@ with_dh <- function(...) layout_spec(layout_with_dh, ...) #' @param niter Integer scalar, the number of iterations to perform. #' @param start.temp Real scalar, the start temperature. This is the maximum #' amount of movement alloved along one axis, within one step, for a vertex. -#' Currently it is decreased linearly to zero during the iteration. +#' Currently it is decreased linearly to zero during the iteration. The +#' default `NULL` uses `sqrt(vcount(graph))`. #' @param grid Character scalar, whether to use the faster, but less accurate #' grid based implementation of the algorithm. By default (\dQuote{auto}), the #' grid-based implementation is used if the graph has more than one thousand @@ -1716,7 +1761,7 @@ layout_with_fr <- function( coords = NULL, dim = c(2, 3), niter = 500, - start.temp = sqrt(vcount(graph)), + start.temp = NULL, grid = c("auto", "grid", "nogrid"), weights = NULL, minx = NULL, @@ -1839,7 +1884,7 @@ layout_with_fr <- function( coords = NULL, dim = c(2, 3), niter = 500, - start.temp = sqrt(vcount(graph)), + start.temp = NULL, grid = c("auto", "grid", "nogrid"), weights = NULL, minx = NULL, @@ -1868,6 +1913,10 @@ layout_with_fr <- function( # Argument checks ensure_igraph(graph) + if (is.null(start.temp)) { + start.temp <- sqrt(vcount(graph)) + } + coords[] <- as.numeric(coords) dim <- igraph_match_arg(dim) if (!missing(niter) && !missing(maxiter)) { @@ -1997,16 +2046,16 @@ layout.fruchterman.reingold <- function(..., params = list()) { #' depending on the `dim` argument. #' Default: `NULL`. #' @param maxiter The maximum number of iterations to perform. Updating a -#' single vertex counts as an iteration. A reasonable default is 40 * n * n, +#' single vertex counts as an iteration. The default `NULL` uses 40 * n * n, #' where n is the number of vertices. The original paper suggests 4 * n * n, #' but this usually only works if the other parameters are set up carefully. -#' @param temp.max The maximum allowed local temperature. A reasonable default -#' is the number of vertices. +#' @param temp.max The maximum allowed local temperature. The default `NULL` +#' uses the number of vertices. #' @param temp.min The global temperature at which the algorithm terminates #' (even before reaching `maxiter` iterations). A reasonable default is #' 1/10. -#' @param temp.init Initial local temperature of all vertices. A reasonable -#' default is the square root of the number of vertices. +#' @param temp.init Initial local temperature of all vertices. The default +#' `NULL` uses the square root of the number of vertices. #' @return A numeric matrix with two columns, and as many rows as the number of #' vertices. #' @author Gabor Csardi \email{csardi.gabor@@gmail.com} @@ -2028,10 +2077,10 @@ layout_with_gem <- function( graph, ..., coords = NULL, - maxiter = 40 * vcount(graph)^2, - temp.max = max(vcount(graph), 1), - temp.min = 1 / 10, - temp.init = sqrt(max(vcount(graph), 1)) + maxiter = NULL, + temp.max = NULL, + temp.min = 0.1, + temp.init = NULL ) { # BEGIN GENERATED ARG_HANDLE: layout_with_gem, do not edit, see tools/generate-migrations.R if (...length() > 0L) { @@ -2050,10 +2099,10 @@ layout_with_gem <- function( match_to = c("coords", "maxiter", "temp.max", "temp.min", "temp.init"), defaults = list( coords = NULL, - maxiter = 40 * vcount(graph)^2, - temp.max = max(vcount(graph), 1), - temp.min = 1 / 10, - temp.init = sqrt(max(vcount(graph), 1)) + maxiter = NULL, + temp.max = NULL, + temp.min = 0.1, + temp.init = NULL ), head_args = c("graph"), fn_name = "layout_with_gem" @@ -2067,6 +2116,16 @@ layout_with_gem <- function( } # END GENERATED ARG_HANDLE + if (is.null(maxiter)) { + maxiter <- 40 * vcount(graph)^2 + } + if (is.null(temp.max)) { + temp.max <- max(vcount(graph), 1) + } + if (is.null(temp.init)) { + temp.init <- sqrt(max(vcount(graph), 1)) + } + if (is.null(coords)) { coords <- matrix(NA_real_, ncol = 2, nrow = 0) use.seed <- FALSE @@ -2267,13 +2326,14 @@ with_graphopt <- function(...) layout_spec(layout_with_graphopt, ...) #' dimensional layouts are places on a plane, three dimensional ones in the 3d #' space. #' @param maxiter The maximum number of iterations to perform. The algorithm -#' might terminate earlier, see the `epsilon` argument. +#' might terminate earlier, see the `epsilon` argument. The default `NULL` +#' uses `50 * vcount(graph)`. #' @param epsilon Numeric scalar, the algorithm terminates, if the maximal #' delta is less than this. (See the reference below for what delta means.) If #' you set this to zero, then the function always performs `maxiter` #' iterations. #' @param kkconst Numeric scalar, the Kamada-Kawai vertex attraction constant. -#' Typical (and default) value is the number of vertices. +#' The default `NULL` uses the number of vertices. #' @param weights Edge weights, larger values will result in longer edges. #' Note that this is the opposite of [layout_with_fr()], which produces #' shorter edges for larger weights. Weights must be positive. @@ -2315,9 +2375,9 @@ layout_with_kk <- function( ..., coords = NULL, dim = c(2, 3), - maxiter = 50 * vcount(graph), + maxiter = NULL, epsilon = 0.0, - kkconst = max(vcount(graph), 1), + kkconst = NULL, weights = NULL, minx = NULL, maxx = NULL, @@ -2433,9 +2493,9 @@ layout_with_kk <- function( defaults = list( coords = NULL, dim = c(2, 3), - maxiter = 50 * vcount(graph), + maxiter = NULL, epsilon = 0, - kkconst = max(vcount(graph), 1), + kkconst = NULL, weights = NULL, minx = NULL, maxx = NULL, @@ -2461,6 +2521,13 @@ layout_with_kk <- function( } # END GENERATED ARG_HANDLE + if (is.null(maxiter)) { + maxiter <- 50 * vcount(graph) + } + if (is.null(kkconst)) { + kkconst <- max(vcount(graph), 1) + } + # Argument checks if (!missing(coords) && !missing(start)) { cli::cli_abort(c( @@ -2595,17 +2662,17 @@ layout.kamada.kawai <- function(..., params = list()) { #' @param graph The input graph #' @inheritParams rlang::args_dots_empty #' @param maxiter The maximum number of iterations to perform (150). -#' @param maxdelta The maximum change for a vertex during an iteration (the -#' number of vertices). -#' @param area The area of the surface on which the vertices are placed (square -#' of the number of vertices). +#' @param maxdelta The maximum change for a vertex during an iteration. The +#' default `NULL` uses the number of vertices. +#' @param area The area of the surface on which the vertices are placed. The +#' default `NULL` uses the square of the number of vertices. #' @param coolexp The cooling exponent of the simulated annealing (1.5). -#' @param repulserad Cancellation radius for the repulsion (the `area` -#' times the number of vertices). +#' @param repulserad Cancellation radius for the repulsion. The default +#' `NULL` uses the `area` times the number of vertices. #' @param cellsize The size of the cells for the grid. When calculating the #' repulsion forces between vertices only vertices in the same or neighboring -#' grid cells are taken into account (the fourth root of the number of -#' `area`. +#' grid cells are taken into account. The default `NULL` uses the square +#' root of the square root of the `area`. #' @param root The ID of the vertex to place at the middle of the layout. The #' default value is -1 which means that a random vertex is selected. #' @return A numeric matrix with two columns and as many rows as vertices. @@ -2617,11 +2684,11 @@ layout_with_lgl <- function( graph, ..., maxiter = 150, - maxdelta = vcount(graph), - area = vcount(graph)^2, + maxdelta = NULL, + area = NULL, coolexp = 1.5, - repulserad = area * vcount(graph), - cellsize = sqrt(sqrt(area)), + repulserad = NULL, + cellsize = NULL, root = NULL ) { # BEGIN GENERATED ARG_HANDLE: layout_with_lgl, do not edit, see tools/generate-migrations.R @@ -2675,11 +2742,11 @@ layout_with_lgl <- function( ), defaults = list( maxiter = 150, - maxdelta = vcount(graph), - area = vcount(graph)^2, + maxdelta = NULL, + area = NULL, coolexp = 1.5, - repulserad = area * vcount(graph), - cellsize = sqrt(sqrt(area)), + repulserad = NULL, + cellsize = NULL, root = NULL ), head_args = c("graph"), @@ -2695,6 +2762,19 @@ layout_with_lgl <- function( # END GENERATED ARG_HANDLE ensure_igraph(graph) + if (is.null(maxdelta)) { + maxdelta <- vcount(graph) + } + if (is.null(area)) { + area <- vcount(graph)^2 + } + if (is.null(repulserad)) { + repulserad <- area * vcount(graph) + } + if (is.null(cellsize)) { + cellsize <- sqrt(sqrt(area)) + } + if (is.null(root)) { root <- -1 } else { @@ -3252,7 +3332,8 @@ with_sugiyama <- function(...) layout_spec(layout_with_sugiyama, ...) #' @inheritParams rlang::args_dots_empty #' @param method Character constant giving the method to use. Right now only #' `dla` is implemented. -#' @param layout A function object, the layout function to use. +#' @param layout A function object, the layout function to use. The default +#' `NULL` uses `layout_with_kk`. #' @param \dots Additional arguments to pass to the `layout` layout #' function. #' @return A matrix with two columns and as many lines as the total number of @@ -3429,9 +3510,13 @@ norm_coords <- function( #' @rdname merge_coords #' @param graph The input graph. #' @export -layout_components <- function(graph, layout = layout_with_kk, ...) { +layout_components <- function(graph, layout = NULL, ...) { ensure_igraph(graph) + if (is.null(layout)) { + layout <- layout_with_kk + } + V(graph)$id <- seq(vcount(graph)) gl <- decompose(graph) ll <- lapply(gl, layout, ...) @@ -3626,9 +3711,10 @@ layout.drl <- function( #' @param use.seed Logical, whether to use the coordinates given in the #' `seed` argument as a starting point. #' @param seed A matrix with two columns, the starting coordinates for the -#' vertices is `use.seed` is `TRUE`. It is ignored otherwise. +#' vertices is `use.seed` is `TRUE`. It is ignored otherwise. The default +#' `NULL` draws uniformly random starting coordinates. #' @param options Options for the layout generator, a named list. See details -#' below. +#' below. The default `NULL` uses `drl_defaults$default`. #' @param weights The weights of the edges. It must be a positive numeric vector, #' `NULL` or `NA`. If it is `NULL` and the input graph has a #' \sQuote{weight} edge attribute, then that attribute will be used. If @@ -3662,8 +3748,8 @@ layout_with_drl <- function( graph, ..., use.seed = FALSE, - seed = matrix(runif(vcount(graph) * 2), ncol = 2), - options = drl_defaults$default, + seed = NULL, + options = NULL, weights = NULL, dim = c(2, 3) ) { @@ -3684,8 +3770,8 @@ layout_with_drl <- function( match_to = c("use.seed", "seed", "options", "weights", "dim"), defaults = list( use.seed = FALSE, - seed = matrix(runif(vcount(graph) * 2), ncol = 2), - options = drl_defaults$default, + seed = NULL, + options = NULL, weights = NULL, dim = c(2, 3) ), @@ -3703,6 +3789,13 @@ layout_with_drl <- function( ensure_igraph(graph) + if (is.null(seed)) { + seed <- matrix(runif(vcount(graph) * 2), ncol = 2) + } + if (is.null(options)) { + options <- drl_defaults$default + } + dim <- igraph_match_arg(dim) use.seed <- as.logical(use.seed) diff --git a/R/make.R b/R/make.R index 944ad66b39..fece9900e9 100644 --- a/R/make.R +++ b/R/make.R @@ -1393,7 +1393,8 @@ with_graph_ <- function(...) { #' ignored (with a warning) if `edges` are symbolic vertex names. It #' is also ignored if there is a bigger vertex ID in `edges`. This #' means that for this function it is safe to supply zero here if the -#' vertex with the largest ID is not an isolate. +#' vertex with the largest ID is not an isolate. The default `NULL` uses +#' the largest vertex ID in `edges`. #' @param isolates Character vector, names of isolate vertices, #' for symbolic edge lists. It is ignored for numeric edge lists. #' @param directed Whether to create a directed graph. @@ -1427,14 +1428,14 @@ with_graph_ <- function(...) { make_graph <- function( edges, ..., - n = max(edges), + n = NULL, isolates = NULL, directed = TRUE, - dir = directed, + dir = NULL, simplify = TRUE ) { if (inherits(edges, "formula")) { - if (!missing(n)) { + if (!is.null(n)) { cli::cli_abort("{.arg n} should not be given for graph literals") } if (!missing(isolates)) { @@ -1452,16 +1453,16 @@ make_graph <- function( cli::cli_abort("{.arg simplify} should only be used for graph literals") } - if (!missing(dir) && !missing(directed)) { + if (!is.null(dir) && !missing(directed)) { cli::cli_abort("Only give one of {.arg dir} and {.arg directed}") } - if (!missing(dir) && missing(directed)) { + if (!is.null(dir) && missing(directed)) { directed <- dir } if (is.character(edges) && length(edges) == 1) { - if (!missing(n)) { + if (!is.null(n)) { cli::cli_warn("{.arg n} is ignored for the {.str {edges}} graph.") } if (!missing(isolates)) { @@ -1474,7 +1475,7 @@ make_graph <- function( "{.arg directed} is ignored for the {.str {edges}} graph." ) } - if (!missing(dir)) { + if (!is.null(dir)) { cli::cli_warn("{.arg dir} is ignored for the {.str {edges}} graph.") } if (length(list(...))) { @@ -1508,7 +1509,7 @@ make_graph <- function( } args <- list(edges, ...) - if (!missing(n)) { + if (!is.null(n)) { args <- c(args, list(n = n)) } if (!missing(directed)) { @@ -1517,7 +1518,7 @@ make_graph <- function( do.call(old_graph, args) } else if (is.character(edges)) { - if (!missing(n)) { + if (!is.null(n)) { cli::cli_warn("{.arg n} is ignored for edge list with vertex names.") } if (length(list(...))) { @@ -1552,8 +1553,8 @@ make_famous_graph <- function(name) { #' @rdname make_graph #' @export -make_directed_graph <- function(edges, n = max(edges)) { - if (missing(n)) { +make_directed_graph <- function(edges, n = NULL) { + if (is.null(n)) { make_graph(edges, directed = TRUE) } else { make_graph(edges, n = n, directed = TRUE) @@ -1562,8 +1563,8 @@ make_directed_graph <- function(edges, n = max(edges)) { #' @rdname make_graph #' @export -make_undirected_graph <- function(edges, n = max(edges)) { - if (missing(n)) { +make_undirected_graph <- function(edges, n = NULL) { + if (is.null(n)) { make_graph(edges, directed = FALSE) } else { make_graph(edges, n = n, directed = FALSE) diff --git a/R/motifs.R b/R/motifs.R index 509fae0079..4255817e69 100644 --- a/R/motifs.R +++ b/R/motifs.R @@ -331,7 +331,7 @@ sample_motifs <- function( graph, size = 3, ..., - cut.prob = rep(0, size), + cut.prob = NULL, sample.size = NULL, sample = NULL ) { @@ -353,11 +353,7 @@ sample_motifs <- function( recover_old = c("cut.prob", "sample.size", "sample"), match_names = c("cut.prob", "sample.size", "sample"), match_to = c("cut.prob", "sample.size", "sample"), - defaults = list( - cut.prob = rep(0, size), - sample.size = NULL, - sample = NULL - ), + defaults = list(cut.prob = NULL, sample.size = NULL, sample = NULL), head_args = c("graph", "size"), fn_name = "sample_motifs" ) diff --git a/R/operators.R b/R/operators.R index 4560514a94..439d9306b6 100644 --- a/R/operators.R +++ b/R/operators.R @@ -290,10 +290,10 @@ apply_one_combiner <- function(comb, x) { #' @param \dots Graph objects or lists of graph objects. #' @param x,y Graph objects. #' @param graph.attr.comb Specification for combining shared graph attributes. -#' Defaults to the `graph.attr.comb` igraph option (`"rename"` unless changed -#' via [igraph_options()]), which preserves the historical behaviour of -#' appending `_1`, `_2`, ... suffixes to clashing attribute names. See -#' [igraph-attribute-combination] for the available combiners. +#' The default `NULL` uses the `graph.attr.comb` igraph option (`"rename"` +#' unless changed via [igraph_options()]), which preserves the historical +#' behaviour of appending `_1`, `_2`, ... suffixes to clashing attribute +#' names. See [igraph-attribute-combination] for the available combiners. #' @return A new graph object. #' @author Gabor Csardi \email{csardi.gabor@@gmail.com} #' @export @@ -309,8 +309,12 @@ apply_one_combiner <- function(comb, x) { #' @export disjoint_union <- function( ..., - graph.attr.comb = igraph_opt("graph.attr.comb") + graph.attr.comb = NULL ) { + if (is.null(graph.attr.comb)) { + graph.attr.comb <- igraph_opt("graph.attr.comb") + } + graphs <- unlist( recursive = FALSE, lapply(list(...), function(l) { @@ -1005,7 +1009,7 @@ compose <- function( g2, ..., byname = "auto", - graph.attr.comb = igraph_opt("graph.attr.comb"), + graph.attr.comb = NULL, vertex.attr.comb = "rename", edge.attr.comb = "rename" ) { @@ -1045,7 +1049,7 @@ compose <- function( ), defaults = list( byname = "auto", - graph.attr.comb = igraph_opt("graph.attr.comb"), + graph.attr.comb = NULL, vertex.attr.comb = "rename", edge.attr.comb = "rename" ), @@ -1064,6 +1068,10 @@ compose <- function( ensure_igraph(g1) ensure_igraph(g2) + if (is.null(graph.attr.comb)) { + graph.attr.comb <- igraph_opt("graph.attr.comb") + } + if (byname != "auto" && !is.logical(byname)) { cli::cli_abort("{.arg bynam} must be \"auto\", or \"logical\".") } @@ -1604,7 +1612,8 @@ rep.igraph <- function(x, n, mark = TRUE, ...) { #' all edges, this operation is also known as graph transpose. #' #' @param graph The input graph. -#' @param eids The edge IDs of the edges to reverse. +#' @param eids The edge IDs of the edges to reverse. The default `NULL` +#' reverses all edges. #' @return The result graph where the direction of the edges with the given #' IDs are reversed #' @@ -1614,7 +1623,11 @@ rep.igraph <- function(x, n, mark = TRUE, ...) { #' reverse_edges(g, 2) #' @family functions for manipulating graph structure #' @export -reverse_edges <- function(graph, eids = E(graph)) { +reverse_edges <- function(graph, eids = NULL) { + if (is.null(eids)) { + eids <- E(graph) + } + reverse_edges_impl( graph = graph, eids = eids diff --git a/R/paths.R b/R/paths.R index 7931093f6e..24adaac043 100644 --- a/R/paths.R +++ b/R/paths.R @@ -85,7 +85,8 @@ is.dag <- function(graph) { #' #' @param graph The input graph. #' @param from The source vertex. -#' @param to The target vertex of vertices. Defaults to all vertices. +#' @param to The target vertex of vertices. The default `NULL` selects all +#' vertices. #' @inheritParams rlang::args_dots_empty #' @param mode Character constant, gives whether the shortest paths to or #' from the given vertices should be calculated for directed graphs. If @@ -110,7 +111,7 @@ is.dag <- function(graph) { all_simple_paths <- function( graph, from, - to = V(graph), + to = NULL, ..., mode = c("out", "in", "all", "total"), cutoff = -1 @@ -139,6 +140,9 @@ all_simple_paths <- function( ## Argument checks ensure_igraph(graph) + if (is.null(to)) { + to <- V(graph) + } ## Function call res <- with_igraph_opt( diff --git a/R/plot.R b/R/plot.R index 48d02cc0f0..eefa5a0151 100644 --- a/R/plot.R +++ b/R/plot.R @@ -49,10 +49,11 @@ #' used for the different vertex groups. #' @param mark.col A scalar or vector giving the colors of marking the #' polygons, in any format accepted by [graphics::xspline()]; e.g. -#' numeric color IDs, symbolic color names, or colors in RGB. +#' numeric color IDs, symbolic color names, or colors in RGB. The default +#' `NULL` uses semi-transparent rainbow colors. #' @param mark.border A scalar or vector giving the colors of the borders of #' the vertex group marking polygons. If it is `NA`, then no border is -#' drawn. +#' drawn. The default `NULL` uses rainbow colors. #' @param mark.expand A numeric scalar or vector, the size of the border around #' the marked vertex groups. It is in the same units as the vertex sizes. If a #' vector is given, then different values are used for the different vertex @@ -92,9 +93,9 @@ plot.igraph <- function( xlim = NULL, ylim = NULL, mark.groups = list(), - mark.shape = 1 / 2, - mark.col = rainbow(length(mark.groups), alpha = 0.3), - mark.border = rainbow(length(mark.groups), alpha = 1), + mark.shape = 0.5, + mark.col = NULL, + mark.border = NULL, mark.expand = 15, mark.lwd = 1, loop.size = 1, @@ -272,6 +273,12 @@ plot.igraph <- function( if (inherits(mark.groups, "communities")) { mark.groups <- communities(mark.groups) } + if (is.null(mark.col)) { + mark.col <- rainbow(length(mark.groups), alpha = 0.3) + } + if (is.null(mark.border)) { + mark.border <- rainbow(length(mark.groups), alpha = 1) + } mark.shape <- rep(mark.shape, length.out = length(mark.groups)) mark.border <- rep(mark.border, length.out = length(mark.groups)) diff --git a/R/plot.shapes.R b/R/plot.shapes.R index e9fd0a4ad1..927455849d 100644 --- a/R/plot.shapes.R +++ b/R/plot.shapes.R @@ -232,8 +232,10 @@ add.vertex.shape <- function( #' @param shape Character scalar, name of a vertex shape. If it is #' `NULL` for `shapes()`, then the names of all defined #' vertex shapes are returned. -#' @param clip An R function object, the clipping function. -#' @param plot An R function object, the plotting function. +#' @param clip An R function object, the clipping function. The default +#' `NULL` uses `shape_noclip`. +#' @param plot An R function object, the plotting function. The default +#' `NULL` uses `shape_noplot`. #' @param parameters Named list, additional plot/vertex/edge #' parameters. The element named define the new parameters, and the #' elements themselves define their default values. @@ -374,8 +376,8 @@ shape_noplot <- function(coords, v = NULL, params) { add_shape <- function( shape, ..., - clip = shape_noclip, - plot = shape_noplot, + clip = NULL, + plot = NULL, parameters = list() ) { # BEGIN GENERATED ARG_HANDLE: add_shape, do not edit, see tools/generate-migrations.R @@ -387,11 +389,7 @@ add_shape <- function( recover_old = c("clip", "plot", "parameters"), match_names = c("clip", "plot", "parameters"), match_to = c("clip", "plot", "parameters"), - defaults = list( - clip = shape_noclip, - plot = shape_noplot, - parameters = list() - ), + defaults = list(clip = NULL, plot = NULL, parameters = list()), head_args = c("shape"), fn_name = "add_shape" ) @@ -404,6 +402,13 @@ add_shape <- function( } # END GENERATED ARG_HANDLE + if (is.null(clip)) { + clip <- shape_noclip + } + if (is.null(plot)) { + plot <- shape_noplot + } + if (!is.character(shape) || length(shape) != 1) { cli::cli_abort(c( "{.arg shape} must be a character of length 1.", diff --git a/R/print.R b/R/print.R index 20a9ce46e3..1c2afaf994 100644 --- a/R/print.R +++ b/R/print.R @@ -566,16 +566,21 @@ print_all <- function(object, ...) { #' @aliases print.igraph print_all summary.igraph str.igraph #' @param x The graph to print. #' @param full Logical, whether to print the graph structure itself as -#' well. -#' @param graph.attributes Logical, whether to print graph attributes. +#' well. The default `NULL` uses the `print.full` igraph option. +#' @param graph.attributes Logical, whether to print graph attributes. The +#' default `NULL` uses the `print.graph.attributes` igraph option. #' @param vertex.attributes Logical, whether to print vertex -#' attributes. -#' @param edge.attributes Logical, whether to print edge attributes. +#' attributes. The default `NULL` uses the `print.vertex.attributes` igraph +#' option. +#' @param edge.attributes Logical, whether to print edge attributes. The +#' default `NULL` uses the `print.edge.attributes` igraph option. #' @param names Logical, whether to print symbolic vertex names (i.e. #' the `name` vertex attribute) or vertex IDs. #' @param max.lines The maximum number of lines to use. The rest of the -#' output will be truncated. -#' @param id Whether to print the graph ID. +#' output will be truncated. If not given, the `auto.print.lines` igraph +#' option applies; `NULL` prints all lines. +#' @param id Whether to print the graph ID. The default `NULL` uses the +#' `print.id` igraph option. #' @param object The graph of which the summary will be printed. #' @param \dots Additional agruments. #' @return All these functions return the graph invisibly. @@ -593,17 +598,38 @@ print_all <- function(object, ...) { #' print.igraph <- function( x, - full = igraph_opt("print.full"), - graph.attributes = igraph_opt("print.graph.attributes"), - vertex.attributes = igraph_opt("print.vertex.attributes"), - edge.attributes = igraph_opt("print.edge.attributes"), + full = NULL, + graph.attributes = NULL, + vertex.attributes = NULL, + edge.attributes = NULL, names = TRUE, - max.lines = igraph_opt("auto.print.lines"), - id = igraph_opt("print.id"), + max.lines = NULL, + id = NULL, ... ) { ensure_igraph(x) + if (is.null(full)) { + full <- igraph_opt("print.full") + } + if (is.null(graph.attributes)) { + graph.attributes <- igraph_opt("print.graph.attributes") + } + if (is.null(vertex.attributes)) { + vertex.attributes <- igraph_opt("print.vertex.attributes") + } + if (is.null(edge.attributes)) { + edge.attributes <- igraph_opt("print.edge.attributes") + } + if (missing(max.lines)) { + # NULL is a legal value here (print all lines), so the option fallback + # applies only when the argument is not supplied at all. + max.lines <- igraph_opt("auto.print.lines") + } + if (is.null(id)) { + id <- igraph_opt("print.id") + } + if (!is_cli_style()) { return(print_igraph_legacy( x, diff --git a/R/printr.R b/R/printr.R index dcc32ac622..7f5294859a 100644 --- a/R/printr.R +++ b/R/printr.R @@ -189,12 +189,17 @@ head_print_callback <- function( #' #' @param ... Passed to the printing function. #' @param .indent Character scalar, indent the printout with this. -#' @param .printer The printing function, defaults to [print]. +#' @param .printer The printing function. The default `NULL` uses +#' [print]. #' @return The first element in `...`, invisibly. #' #' @export -indent_print <- function(..., .indent = " ", .printer = print) { +indent_print <- function(..., .indent = " ", .printer = NULL) { + if (is.null(.printer)) { + .printer <- print + } + if (length(.indent) != 1 || !is.character(.indent)) { indent <- .indent # cli literal cannot start with a dot cli::cli_abort( diff --git a/R/similarity.R b/R/similarity.R index 481ba60ff3..82a01219e3 100644 --- a/R/similarity.R +++ b/R/similarity.R @@ -26,7 +26,8 @@ #' 25(3):211-230, 2003. #' #' @param graph The input graph. -#' @param vids The vertex IDs for which the similarity is calculated. +#' @param vids The vertex IDs for which the similarity is calculated. The +#' default `NULL` selects all vertices. #' @inheritParams rlang::args_dots_empty #' @param mode The type of neighboring vertices to use for the calculation, #' possible values: \sQuote{`out`}, \sQuote{`in`}, @@ -52,7 +53,7 @@ #' similarity(g, method = "jaccard") similarity <- function( graph, - vids = V(graph), + vids = NULL, ..., mode = c( "all", @@ -93,6 +94,10 @@ similarity <- function( } # END GENERATED ARG_HANDLE + if (is.null(vids)) { + vids <- V(graph) + } + method <- igraph_match_arg(method) if (method == "jaccard") { similarity_jaccard_impl( diff --git a/R/simple.R b/R/simple.R index dcc9120542..26ecd87a8b 100644 --- a/R/simple.R +++ b/R/simple.R @@ -71,7 +71,8 @@ is.simple <- function(graph) { #' @param edge.attr.comb Specifies what to do with edge attributes, if #' `remove.multiple=TRUE`. In this case many edges might be mapped to a #' single one in the new graph, and their attributes are combined. Please see -#' [attribute.combination()] for details on this. +#' [attribute.combination()] for details on this. The default `NULL` uses +#' the `edge.attr.comb` igraph option. #' @return a graph object with the loop and/or multiple edges removed; the #' input graph is returned unchanged if it is already simple. #' @author Gabor Csardi \email{csardi.gabor@@gmail.com} @@ -94,7 +95,7 @@ simplify <- function( graph, remove.multiple = TRUE, remove.loops = TRUE, - edge.attr.comb = igraph_opt("edge.attr.comb") + edge.attr.comb = NULL ) { # A graph that is already simple has no loops and no multiple edges, so # simplify_impl() would not change its structure regardless of the @@ -104,6 +105,9 @@ simplify <- function( if (is_simple(graph)) { return(graph) } + if (is.null(edge.attr.comb)) { + edge.attr.comb <- igraph_opt("edge.attr.comb") + } simplify_impl( graph = graph, remove_multiple = remove.multiple, diff --git a/R/stochastic_matrix.R b/R/stochastic_matrix.R index 3d22332ebe..e91b98fc80 100644 --- a/R/stochastic_matrix.R +++ b/R/stochastic_matrix.R @@ -55,7 +55,8 @@ get.stochastic <- function( #' @param column.wise If `FALSE`, then the rows of the stochastic matrix #' sum up to one; otherwise it is the columns. #' @param sparse Logical, whether to return a sparse matrix. The -#' `Matrix` package is needed for sparse matrices. +#' `Matrix` package is needed for sparse matrices. The default `NULL` uses +#' the `sparsematrices` igraph option. #' @return A regular matrix or a matrix of class `Matrix` if a #' `sparse` argument was `TRUE`. #' @author Gabor Csardi \email{csardi.gabor@@gmail.com} @@ -79,7 +80,7 @@ stochastic_matrix <- function( graph, ..., column.wise = FALSE, - sparse = igraph_opt("sparsematrices") + sparse = NULL ) { # BEGIN GENERATED ARG_HANDLE: stochastic_matrix, do not edit, see tools/generate-migrations.R if (...length() > 0L) { @@ -90,10 +91,7 @@ stochastic_matrix <- function( recover_old = c("column.wise", "sparse"), match_names = c("column.wise", "sparse"), match_to = c("column.wise", "sparse"), - defaults = list( - column.wise = FALSE, - sparse = igraph_opt("sparsematrices") - ), + defaults = list(column.wise = FALSE, sparse = NULL), head_args = c("graph"), fn_name = "stochastic_matrix" ) @@ -108,6 +106,10 @@ stochastic_matrix <- function( ensure_igraph(graph) + if (is.null(sparse)) { + sparse <- igraph_opt("sparsematrices") + } + column.wise <- as.logical(column.wise) if (length(column.wise) != 1) { cli::cli_abort( diff --git a/R/structural-properties.R b/R/structural-properties.R index 578eed4bbc..6c7053036e 100644 --- a/R/structural-properties.R +++ b/R/structural-properties.R @@ -993,6 +993,7 @@ mean_distance <- function( #' #' @param graph The graph to analyze. #' @param v The IDs of vertices of which the degree will be calculated. +#' The default `NULL` selects all vertices. #' @param mode Character string, \dQuote{out} for out-degree, \dQuote{in} for #' in-degree or \dQuote{total} for the sum of the two. For undirected graphs #' this argument is ignored. \dQuote{all} is a synonym of \dQuote{total}. @@ -1030,7 +1031,7 @@ mean_distance <- function( #' degree <- function( graph, - v = V(graph), + v = NULL, ..., mode = c("all", "out", "in", "total"), loops = TRUE, @@ -1063,6 +1064,9 @@ degree <- function( # END GENERATED ARG_HANDLE ensure_igraph(graph) + if (is.null(v)) { + v <- V(graph) + } v <- as_igraph_vs(graph, v) mode <- igraph_match_arg(mode) @@ -1087,10 +1091,14 @@ degree <- function( max_degree <- function( graph, ..., - v = V(graph), + v = NULL, mode = c("all", "out", "in", "total"), loops = TRUE ) { + if (is.null(v)) { + v <- V(graph) + } + maxdegree_impl( graph = graph, v = v, @@ -1215,9 +1223,9 @@ degree_distribution <- function(graph, cumulative = FALSE, ...) { #' #' @param graph The graph to work on. #' @param v Numeric vector, the vertices from which the shortest paths will be -#' calculated. +#' calculated. The default `NULL` selects all vertices. #' @param to Numeric vector, the vertices to which the shortest paths will be -#' calculated. By default it includes all vertices. Note that for +#' calculated. The default `NULL` includes all vertices. Note that for #' `distances()` every vertex must be included here at most once. (This #' is not required for `shortest_paths()`. #' @inheritParams rlang::args_dots_empty @@ -1360,8 +1368,8 @@ degree_distribution <- function(graph, cumulative = FALSE, ...) { #' distances <- function( graph, - v = V(graph), - to = V(graph), + v = NULL, + to = NULL, ..., mode = c("all", "out", "in"), weights = NULL, @@ -1401,6 +1409,12 @@ distances <- function( # END GENERATED ARG_HANDLE ensure_igraph(graph) + if (is.null(v)) { + v <- V(graph) + } + if (is.null(to)) { + to <- V(graph) + } # make sure that the lower-level function in C gets mode == "out" # unconditionally when the graph is undirected; this is used for @@ -1486,7 +1500,7 @@ distances <- function( shortest_paths <- function( graph, from, - to = V(graph), + to = NULL, ..., mode = c("out", "all", "in"), weights = NULL, @@ -1560,6 +1574,9 @@ shortest_paths <- function( # END GENERATED ARG_HANDLE ensure_igraph(graph) + if (is.null(to)) { + to <- V(graph) + } mode <- igraph_match_arg(mode) mode <- switch(mode, "out" = 1, "in" = 2, "all" = 3) output <- igraph_match_arg(output) @@ -1661,7 +1678,7 @@ shortest_paths <- function( all_shortest_paths <- function( graph, from, - to = V(graph), + to = NULL, ..., mode = c("out", "all", "in"), weights = NULL @@ -1689,6 +1706,9 @@ all_shortest_paths <- function( # END GENERATED ARG_HANDLE ensure_igraph(graph) + if (is.null(to)) { + to <- V(graph) + } mode <- igraph_match_arg(mode) @@ -2307,7 +2327,7 @@ transitivity <- function( #' #' @param graph A graph object, the input graph. #' @param nodes The vertices for which the constraint will be calculated. -#' Defaults to all vertices. +#' The default `NULL` selects all vertices. #' @inheritParams rlang::args_dots_empty #' @param weights The weights of the edges. If this is `NULL` and there is #' a `weight` edge attribute this is used. If there is no such edge @@ -2328,7 +2348,7 @@ transitivity <- function( #' constraint <- function( graph, - nodes = V(graph), + nodes = NULL, ..., weights = NULL ) { @@ -2355,6 +2375,9 @@ constraint <- function( # END GENERATED ARG_HANDLE ensure_igraph(graph) + if (is.null(nodes)) { + nodes <- V(graph) + } nodes <- as_igraph_vs(graph, nodes) if (is.null(weights)) { @@ -2522,7 +2545,7 @@ edge_density <- function( ego_size <- function( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -2550,6 +2573,9 @@ ego_size <- function( # END GENERATED ARG_HANDLE ensure_igraph(graph) + if (is.null(nodes)) { + nodes <- V(graph) + } mode <- igraph_match_arg(mode) mode <- switch(mode, "out" = 1, "in" = 2, "all" = 3) mindist <- as.numeric(mindist) @@ -2602,6 +2628,7 @@ neighborhood_size <- ego_size #' @param order Integer giving the order of the neighborhood. Negative values #' indicate an infinite order. #' @param nodes The vertices for which the calculation is performed. +#' The default `NULL` selects all vertices. #' @inheritParams rlang::args_dots_empty #' @param mode Character constant, it specifies how to use the direction of #' the edges if a directed graph is analyzed. For \sQuote{out} only the @@ -2660,7 +2687,7 @@ neighborhood_size <- ego_size ego <- function( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -2688,6 +2715,9 @@ ego <- function( # END GENERATED ARG_HANDLE ensure_igraph(graph) + if (is.null(nodes)) { + nodes <- V(graph) + } mode <- igraph_match_arg(mode) mode <- switch(mode, "out" = 1, "in" = 2, "all" = 3) mindist <- as.numeric(mindist) @@ -2719,7 +2749,7 @@ neighborhood <- ego make_ego_graph <- function( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -2747,6 +2777,9 @@ make_ego_graph <- function( # END GENERATED ARG_HANDLE ensure_igraph(graph) + if (is.null(nodes)) { + nodes <- V(graph) + } mode <- igraph_match_arg(mode) mode <- switch(mode, "out" = 1L, "in" = 2L, "all" = 3L) mindist <- as.numeric(mindist) @@ -3163,8 +3196,8 @@ girth <- function( #' original multiplicity as an edge attribute. #' #' @param graph The input graph. -#' @param eids The edges to which the query is restricted. By default this is -#' all edges in the graph. +#' @param eids The edges to which the query is restricted. The default +#' `NULL` selects all edges. #' @return `any_loop()` and `any_multiple()` return a Logical. #' `which_loop()` and `which_multiple()` return a logical vector. #' `count_loops()` returns a numeric scalar with the total number of loop edges. @@ -3201,7 +3234,11 @@ girth <- function( #' any(which_multiple(g)) #' E(g)$weight #' -which_multiple <- function(graph, eids = E(graph)) { +which_multiple <- function(graph, eids = NULL) { + if (is.null(eids)) { + eids <- E(graph) + } + is_multiple_impl( graph = graph, eids = eids @@ -3216,7 +3253,11 @@ any_multiple <- function(graph) { } #' @rdname which_multiple #' @export -count_multiple <- function(graph, eids = E(graph)) { +count_multiple <- function(graph, eids = NULL) { + if (is.null(eids)) { + eids <- E(graph) + } + count_multiple_impl( graph = graph, eids = eids @@ -3224,7 +3265,11 @@ count_multiple <- function(graph, eids = E(graph)) { } #' @rdname which_multiple #' @export -which_loop <- function(graph, eids = E(graph)) { +which_loop <- function(graph, eids = NULL) { + if (is.null(eids)) { + eids <- E(graph) + } + is_loop_impl( graph = graph, eids = eids @@ -3307,6 +3352,7 @@ count_loops <- function(graph) { #' Default: `NULL`. #' @param extra Additional argument to supply to the callback function. #' @param rho The environment in which the callback function is evaluated. +#' The default `NULL` uses the caller's environment. #' @param neimode `r lifecycle::badge("deprecated")` This argument is deprecated #' from igraph 1.3.0; use `mode` instead. #' @inheritParams rlang::args_dots_empty @@ -3401,7 +3447,7 @@ bfs <- function( dist = FALSE, callback = NULL, extra = NULL, - rho = parent.frame(), + rho = NULL, neimode = deprecated(), father = deprecated() ) { @@ -3409,6 +3455,10 @@ bfs <- function( ensure_igraph(graph) + if (is.null(rho)) { + rho <- parent.frame() + } + if (lifecycle::is_present(neimode)) { lifecycle::deprecate_stop( "1.3.0", @@ -3586,6 +3636,7 @@ bfs <- function( #' Default: `NULL`. #' @param extra Additional argument to supply to the callback function. #' @param rho The environment in which the callback function is evaluated. +#' The default `NULL` uses the caller's environment. #' @param neimode `r lifecycle::badge("deprecated")` This argument is deprecated from igraph 1.3.0; use #' `mode` instead. #' @inheritParams rlang::args_dots_empty @@ -3673,13 +3724,17 @@ dfs <- function( in.callback = NULL, out.callback = NULL, extra = NULL, - rho = parent.frame(), + rho = NULL, neimode = deprecated(), father = deprecated() ) { rlang::check_dots_empty() ensure_igraph(graph) + if (is.null(rho)) { + rho <- parent.frame() + } + if (lifecycle::is_present(neimode)) { lifecycle::deprecate_stop( "1.3.0", @@ -4274,9 +4329,9 @@ laplacian_matrix <- function( #' @param eps A small real number used in equality tests in the weighted #' bipartite matching algorithm. Two real numbers are considered equal in #' the algorithm if their difference is smaller than `eps`. This is -#' required to avoid the accumulation of numerical errors. By default it is -#' set to the smallest \eqn{x}, such that \eqn{1+x \ne 1}{1+x != 1} -#' holds. If you are running the algorithm with no weights, this argument +#' required to avoid the accumulation of numerical errors. The default +#' `NULL` stands for the smallest \eqn{x}, such that +#' \eqn{1+x \ne 1}{1+x != 1} holds (`.Machine$double.eps`). If you are running the algorithm with no weights, this argument #' is ignored. #' @return `is_matching()` and `is_max_matching()` return a logical #' scalar. @@ -4364,7 +4419,7 @@ max_bipartite_match <- function( types = NULL, ..., weights = NULL, - eps = .Machine$double.eps + eps = NULL ) { # BEGIN GENERATED ARG_HANDLE: max_bipartite_match, do not edit, see tools/generate-migrations.R if (...length() > 0L) { @@ -4375,7 +4430,7 @@ max_bipartite_match <- function( recover_old = c("weights", "eps"), match_names = c("weights", "eps"), match_to = c("weights", "eps"), - defaults = list(weights = NULL, eps = .Machine$double.eps), + defaults = list(weights = NULL, eps = NULL), head_args = c("graph", "types"), fn_name = "max_bipartite_match" ) @@ -4388,6 +4443,10 @@ max_bipartite_match <- function( } # END GENERATED ARG_HANDLE + if (is.null(eps)) { + eps <- .Machine$double.eps + } + res <- maximum_bipartite_matching_impl( graph = graph, types = types, @@ -4418,8 +4477,8 @@ max_bipartite_match <- function( #' Undirected graphs contain only mutual edges by definition. #' #' @param graph The input graph. -#' @param eids Edge sequence, the edges that will be probed. By default is -#' includes all edges in the order of their IDs. +#' @param eids Edge sequence, the edges that will be probed. The default +#' `NULL` includes all edges in the order of their IDs. #' @inheritParams rlang::args_dots_empty #' @param loops Logical, whether to consider directed self-loops to be mutual. #' @return A logical vector of the same length as the number of edges supplied. @@ -4438,7 +4497,7 @@ max_bipartite_match <- function( #' @export which_mutual <- function( graph, - eids = E(graph), + eids = NULL, ..., loops = TRUE ) { @@ -4464,6 +4523,10 @@ which_mutual <- function( } # END GENERATED ARG_HANDLE + if (is.null(eids)) { + eids <- E(graph) + } + is_mutual_impl( graph = graph, eids = eids, @@ -4492,8 +4555,8 @@ which_mutual <- function( #' and \eqn{k_v}{k_v} is the neighbors' degree, specified by `neighbor_degree_mode`. #' #' @param graph The input graph. It may be directed. -#' @param vids The vertices for which the calculation is performed. Normally it -#' includes all vertices. Note, that if not all vertices are given here, then +#' @param vids The vertices for which the calculation is performed. +#' The default `NULL` includes all vertices. Note, that if not all vertices are given here, then #' both \sQuote{`knn`} and \sQuote{`knnk`} will be calculated based #' on the given vertices only. #' @inheritParams rlang::args_dots_empty @@ -4549,7 +4612,7 @@ which_mutual <- function( #' @export knn <- function( graph, - vids = V(graph), + vids = NULL, ..., mode = c("all", "out", "in", "total"), neighbor.degree.mode = c("all", "out", "in", "total"), @@ -4585,6 +4648,10 @@ knn <- function( } # END GENERATED ARG_HANDLE + if (is.null(vids)) { + vids <- V(graph) + } + avg_nearest_neighbor_degree_impl( graph = graph, vids = vids, diff --git a/R/triangles.R b/R/triangles.R index d9926f32aa..5a0e5ebb9d 100644 --- a/R/triangles.R +++ b/R/triangles.R @@ -55,9 +55,9 @@ adjacent.triangles <- function(graph, vids = V(graph)) { #' @aliases triangles #' @param graph The input graph. It might be directed, but edge directions are #' ignored. -#' @param vids The vertices to query, all of them by default. This might be a -#' vector of numeric IDs, or a character vector of symbolic vertex names for -#' named graphs. +#' @param vids The vertices to query. This might be a vector of numeric IDs, +#' or a character vector of symbolic vertex names for named graphs. The +#' default `NULL` selects all vertices. #' @return For `triangles()` a numeric vector of vertex IDs, the first three #' vertices belong to the first triangle found, etc. #' @@ -96,7 +96,11 @@ triangles <- function(graph) { #' @export #' @rdname count_triangles -count_triangles <- function(graph, vids = V(graph)) { +count_triangles <- function(graph, vids = NULL) { + if (is.null(vids)) { + vids <- V(graph) + } + count_adjacent_triangles_impl( graph = graph, vids = vids diff --git a/man/add.vertex.shape.Rd b/man/add.vertex.shape.Rd index 0a21bc5552..89adafd6ef 100644 --- a/man/add.vertex.shape.Rd +++ b/man/add.vertex.shape.Rd @@ -16,9 +16,11 @@ add.vertex.shape( \code{NULL} for \code{shapes()}, then the names of all defined vertex shapes are returned.} -\item{clip}{An R function object, the clipping function.} +\item{clip}{An R function object, the clipping function. The default +\code{NULL} uses \code{shape_noclip}.} -\item{plot}{An R function object, the plotting function.} +\item{plot}{An R function object, the plotting function. The default +\code{NULL} uses \code{shape_noplot}.} \item{parameters}{Named list, additional plot/vertex/edge parameters. The element named define the new parameters, and the diff --git a/man/adjacent.triangles.Rd b/man/adjacent.triangles.Rd index 5357c0dfc1..88abc2cda0 100644 --- a/man/adjacent.triangles.Rd +++ b/man/adjacent.triangles.Rd @@ -10,9 +10,9 @@ adjacent.triangles(graph, vids = V(graph)) \item{graph}{The input graph. It might be directed, but edge directions are ignored.} -\item{vids}{The vertices to query, all of them by default. This might be a -vector of numeric IDs, or a character vector of symbolic vertex names for -named graphs.} +\item{vids}{The vertices to query. This might be a vector of numeric IDs, +or a character vector of symbolic vertex names for named graphs. The +default \code{NULL} selects all vertices.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/all_simple_paths.Rd b/man/all_simple_paths.Rd index e406597517..538fc0756b 100644 --- a/man/all_simple_paths.Rd +++ b/man/all_simple_paths.Rd @@ -7,7 +7,7 @@ all_simple_paths( graph, from, - to = V(graph), + to = NULL, ..., mode = c("out", "in", "all", "total"), cutoff = -1 @@ -18,7 +18,8 @@ all_simple_paths( \item{from}{The source vertex.} -\item{to}{The target vertex of vertices. Defaults to all vertices.} +\item{to}{The target vertex of vertices. The default \code{NULL} selects all +vertices.} \item{...}{These dots are for future extensions and must be empty.} diff --git a/man/alpha.centrality.Rd b/man/alpha.centrality.Rd index 4cda7bcae5..fdff3c9a1f 100644 --- a/man/alpha.centrality.Rd +++ b/man/alpha.centrality.Rd @@ -20,8 +20,8 @@ alpha.centrality( graphs, edges are treated as if they were reciprocal directed ones.} \item{nodes}{Vertex sequence, the vertices for which the alpha centrality -values are returned. (For technical reasons they will be calculated for all -vertices, anyway.)} +values are returned. The default \code{NULL} selects all vertices. +(For technical reasons they will be calculated for all vertices, anyway.)} \item{alpha}{Parameter specifying the relative importance of endogenous versus exogenous factors in the determination of centrality. See details diff --git a/man/alpha_centrality.Rd b/man/alpha_centrality.Rd index 0c3050dedc..2b90125c92 100644 --- a/man/alpha_centrality.Rd +++ b/man/alpha_centrality.Rd @@ -6,7 +6,7 @@ \usage{ alpha_centrality( graph, - nodes = V(graph), + nodes = NULL, ..., alpha = 1, loops = FALSE, @@ -21,8 +21,8 @@ alpha_centrality( graphs, edges are treated as if they were reciprocal directed ones.} \item{nodes}{Vertex sequence, the vertices for which the alpha centrality -values are returned. (For technical reasons they will be calculated for all -vertices, anyway.)} +values are returned. The default \code{NULL} selects all vertices. +(For technical reasons they will be calculated for all vertices, anyway.)} \item{...}{These dots are for future extensions and must be empty.} diff --git a/man/as.undirected.Rd b/man/as.undirected.Rd index 1a0ae66f3f..63476faf18 100644 --- a/man/as.undirected.Rd +++ b/man/as.undirected.Rd @@ -22,7 +22,7 @@ as.undirected( \code{mode="collapse"} or \code{mode="mutual"}. In these cases many edges might be mapped to a single one in the new graph, and their attributes are combined. Please see \code{\link[=attribute.combination]{attribute.combination()}} for details on -this.} +this. The default \code{NULL} uses the \code{edge.attr.comb} igraph option.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/as_adj.Rd b/man/as_adj.Rd index 211d5c1b0d..c729a32d7f 100644 --- a/man/as_adj.Rd +++ b/man/as_adj.Rd @@ -49,7 +49,7 @@ is present in the graph.} \item{sparse}{Logical, whether to create a sparse matrix. The \sQuote{\code{Matrix}} package must be installed for creating sparse -matrices.} +matrices. The default \code{NULL} uses the \code{sparsematrices} igraph option.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/as_adjacency_matrix.Rd b/man/as_adjacency_matrix.Rd index e89b439556..983751cac3 100644 --- a/man/as_adjacency_matrix.Rd +++ b/man/as_adjacency_matrix.Rd @@ -10,7 +10,7 @@ as_adjacency_matrix( ..., weights = NULL, names = TRUE, - sparse = igraph_opt("sparsematrices"), + sparse = NULL, edges = deprecated(), attr = deprecated() ) @@ -45,7 +45,7 @@ is present in the graph.} \item{sparse}{Logical, whether to create a sparse matrix. The \sQuote{\code{Matrix}} package must be installed for creating sparse -matrices.} +matrices. The default \code{NULL} uses the \code{sparsematrices} igraph option.} \item{edges}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Logical, whether to return the edge IDs in the matrix. For non-existant edges zero is returned.} diff --git a/man/as_directed.Rd b/man/as_directed.Rd index f4032e7956..ca83689eb0 100644 --- a/man/as_directed.Rd +++ b/man/as_directed.Rd @@ -10,7 +10,7 @@ as_directed(graph, ..., mode = c("mutual", "arbitrary", "random", "acyclic")) as_undirected( graph, mode = c("collapse", "each", "mutual"), - edge.attr.comb = igraph_opt("edge.attr.comb") + edge.attr.comb = NULL ) } \arguments{ @@ -27,7 +27,7 @@ as_undirected( \code{mode="collapse"} or \code{mode="mutual"}. In these cases many edges might be mapped to a single one in the new graph, and their attributes are combined. Please see \code{\link[=attribute.combination]{attribute.combination()}} for details on -this.} +this. The default \code{NULL} uses the \code{edge.attr.comb} igraph option.} } \value{ A new graph object. diff --git a/man/asymmetric.preference.game.Rd b/man/asymmetric.preference.game.Rd index 41ed134280..a25892561c 100644 --- a/man/asymmetric.preference.game.Rd +++ b/man/asymmetric.preference.game.Rd @@ -18,11 +18,12 @@ asymmetric.preference.game( \item{types}{The number of different vertex types.} \item{type.dist.matrix}{The joint distribution of the in- and out-vertex -types.} +types. The default \code{NULL} gives a uniform distribution.} \item{pref.matrix}{A square matrix giving the preferences of the vertex types. The matrix has \sQuote{types} rows and columns. When generating -an undirected graph, it must be symmetric.} +an undirected graph, it must be symmetric. The default \code{NULL} sets all +preferences to one.} \item{loops}{Logical, whether self-loops are allowed in the graph.} } diff --git a/man/betweenness.Rd b/man/betweenness.Rd index 119539bf6f..f8dbd6d4a3 100644 --- a/man/betweenness.Rd +++ b/man/betweenness.Rd @@ -9,7 +9,7 @@ \usage{ betweenness( graph, - v = V(graph), + v = NULL, ..., directed = TRUE, weights = NULL, @@ -19,7 +19,7 @@ betweenness( edge_betweenness( graph, - e = E(graph), + e = NULL, ..., directed = TRUE, weights = NULL, @@ -29,7 +29,8 @@ edge_betweenness( \arguments{ \item{graph}{The graph to analyze.} -\item{v}{The vertices for which the vertex betweenness will be calculated.} +\item{v}{The vertices for which the vertex betweenness will be calculated. +The default \code{NULL} selects all vertices.} \item{...}{These dots are for future extensions and must be empty.} @@ -56,7 +57,8 @@ from each other may be less than \eqn{(n-1)(n-2)/2}.} \item{cutoff}{The maximum shortest path length to consider when calculating betweenness. If negative, then there is no such limit.} -\item{e}{The edges for which the edge betweenness will be calculated.} +\item{e}{The edges for which the edge betweenness will be calculated. +The default \code{NULL} selects all edges.} } \value{ A numeric vector with the betweenness score for each vertex in diff --git a/man/bfs.Rd b/man/bfs.Rd index 74d1db1bf6..b18e9a28f9 100644 --- a/man/bfs.Rd +++ b/man/bfs.Rd @@ -19,7 +19,7 @@ bfs( dist = FALSE, callback = NULL, extra = NULL, - rho = parent.frame(), + rho = NULL, neimode = deprecated(), father = deprecated() ) @@ -71,7 +71,8 @@ Default: \code{NULL}.} \item{extra}{Additional argument to supply to the callback function.} -\item{rho}{The environment in which the callback function is evaluated.} +\item{rho}{The environment in which the callback function is evaluated. +The default \code{NULL} uses the caller's environment.} \item{neimode}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} This argument is deprecated from igraph 1.3.0; use \code{mode} instead.} diff --git a/man/bonpow.Rd b/man/bonpow.Rd index 33cb759d42..d4745d8019 100644 --- a/man/bonpow.Rd +++ b/man/bonpow.Rd @@ -18,7 +18,7 @@ bonpow( \item{graph}{the input graph.} \item{nodes}{vertex sequence indicating which vertices are to be included in -the calculation. By default, all vertices are included.} +the calculation. The default \code{NULL} selects all vertices.} \item{loops}{Logical indicating whether or not the diagonal should be treated as valid data. Set this true if and only if the data can contain diff --git a/man/callaway.traits.game.Rd b/man/callaway.traits.game.Rd index b4abb17313..487c885599 100644 --- a/man/callaway.traits.game.Rd +++ b/man/callaway.traits.game.Rd @@ -21,10 +21,11 @@ callaway.traits.game( \item{edge.per.step}{The number of edges to add to the graph per time step.} \item{type.dist}{The distribution of the vertex types. This is assumed to be -stationary in time.} +stationary in time. The default \code{NULL} gives a uniform distribution.} \item{pref.matrix}{A matrix giving the preferences of the given vertex -types. These should be probabilities, i.e. numbers between zero and one.} +types. These should be probabilities, i.e. numbers between zero and one. +The default \code{NULL} sets all preferences to one.} \item{directed}{Logical, whether to generate directed graphs.} } diff --git a/man/cited.type.game.Rd b/man/cited.type.game.Rd index 8af960e4d8..36274fe108 100644 --- a/man/cited.type.game.Rd +++ b/man/cited.type.game.Rd @@ -19,11 +19,14 @@ cited.type.game( \item{edges}{Number of edges per step.} \item{types}{Vector of length \sQuote{\code{n}}, the types of the vertices. -Types are numbered from zero.} +Types are numbered from zero. The default \code{NULL} gives all vertices +type zero.} \item{pref}{Vector (\code{sample_last_cit()} and \code{sample_cit_types()} or matrix (\code{sample_cit_cit_types()}) giving the (unnormalized) citation -probabilities for the different vertex types.} +probabilities for the different vertex types. The default \code{NULL} uses +\code{(1:(agebins + 1))^-3} for \code{sample_last_cit()} and all-one probabilities +for the other two.} \item{directed}{Logical, whether to generate directed networks.} diff --git a/man/citing.cited.type.game.Rd b/man/citing.cited.type.game.Rd index 34df098f14..151924096c 100644 --- a/man/citing.cited.type.game.Rd +++ b/man/citing.cited.type.game.Rd @@ -19,11 +19,14 @@ citing.cited.type.game( \item{edges}{Number of edges per step.} \item{types}{Vector of length \sQuote{\code{n}}, the types of the vertices. -Types are numbered from zero.} +Types are numbered from zero. The default \code{NULL} gives all vertices +type zero.} \item{pref}{Vector (\code{sample_last_cit()} and \code{sample_cit_types()} or matrix (\code{sample_cit_cit_types()}) giving the (unnormalized) citation -probabilities for the different vertex types.} +probabilities for the different vertex types. The default \code{NULL} uses +\code{(1:(agebins + 1))^-3} for \code{sample_last_cit()} and all-one probabilities +for the other two.} \item{directed}{Logical, whether to generate directed networks.} diff --git a/man/closeness.Rd b/man/closeness.Rd index ca5bb3b4ba..3103521ed9 100644 --- a/man/closeness.Rd +++ b/man/closeness.Rd @@ -7,7 +7,7 @@ \usage{ closeness( graph, - vids = V(graph), + vids = NULL, ..., mode = c("out", "in", "all", "total"), weights = NULL, @@ -18,7 +18,8 @@ closeness( \arguments{ \item{graph}{The graph to analyze.} -\item{vids}{The vertices for which closeness will be calculated.} +\item{vids}{The vertices for which closeness will be calculated. +The default \code{NULL} selects all vertices.} \item{...}{These dots are for future extensions and must be empty.} diff --git a/man/cocitation.Rd b/man/cocitation.Rd index 727d71e807..e148aecbf8 100644 --- a/man/cocitation.Rd +++ b/man/cocitation.Rd @@ -5,16 +5,16 @@ \alias{bibcoupling} \title{Cocitation coupling} \usage{ -cocitation(graph, v = V(graph)) +cocitation(graph, v = NULL) -bibcoupling(graph, v = V(graph)) +bibcoupling(graph, v = NULL) } \arguments{ \item{graph}{The graph object to analyze} \item{v}{Vertex sequence or numeric vector, the vertex IDs for which the cocitation or bibliographic coupling values we want to calculate. The -default is all vertices.} +default \code{NULL} selects all vertices.} } \value{ A numeric matrix with \code{length(v)} lines and diff --git a/man/cohesive_blocks.Rd b/man/cohesive_blocks.Rd index 4c80d62bd1..e03fc6bf35 100644 --- a/man/cohesive_blocks.Rd +++ b/man/cohesive_blocks.Rd @@ -44,11 +44,7 @@ parent(blocks) ... ) -plot_hierarchy( - blocks, - layout = layout_as_tree(hierarchy(blocks), root = 1), - ... -) +plot_hierarchy(blocks, layout = NULL, ...) export_pajek(blocks, graph, file, ..., project.file = TRUE) @@ -92,8 +88,8 @@ them. By default all cohesive blocks are marked, except the one corresponding to the all vertices.} \item{layout}{The layout of a plot, it is simply passed on to -\code{plot.igraph()}, see the possible formats there. By default the -Reingold-Tilford layout generator is used.} +\code{plot.igraph()}, see the possible formats there. The default \code{NULL} uses +the Reingold-Tilford layout generator.} \item{file}{Defines the file (or connection) the Pajek file is written to. diff --git a/man/compose.Rd b/man/compose.Rd index ea67a1050c..ff5e5adcf7 100644 --- a/man/compose.Rd +++ b/man/compose.Rd @@ -10,7 +10,7 @@ compose( g2, ..., byname = "auto", - graph.attr.comb = igraph_opt("graph.attr.comb"), + graph.attr.comb = NULL, vertex.attr.comb = "rename", edge.attr.comb = "rename" ) @@ -81,7 +81,7 @@ g1 and g2, respectively, then (a,a) is included in the result. See \code{\link[=simplify]{simplify()}} if you want to get rid of the self-loops. } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Isomorphism.html#igraph_permute_vertices}{\code{permute_vertices()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Isomorphism.html#igraph_permute_vertices}{\code{permute_vertices()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \examples{ diff --git a/man/constraint.Rd b/man/constraint.Rd index 2d4e7afbd2..3dd16200b3 100644 --- a/man/constraint.Rd +++ b/man/constraint.Rd @@ -4,13 +4,13 @@ \alias{constraint} \title{Burt's constraint} \usage{ -constraint(graph, nodes = V(graph), ..., weights = NULL) +constraint(graph, nodes = NULL, ..., weights = NULL) } \arguments{ \item{graph}{A graph object, the input graph.} \item{nodes}{The vertices for which the constraint will be calculated. -Defaults to all vertices.} +The default \code{NULL} selects all vertices.} \item{...}{These dots are for future extensions and must be empty.} diff --git a/man/contract.Rd b/man/contract.Rd index 677567c3d0..aa11b59ece 100644 --- a/man/contract.Rd +++ b/man/contract.Rd @@ -4,7 +4,7 @@ \alias{contract} \title{Contract several vertices into a single one} \usage{ -contract(graph, mapping, vertex.attr.comb = igraph_opt("vertex.attr.comb")) +contract(graph, mapping, vertex.attr.comb = NULL) } \arguments{ \item{graph}{The input graph, it can be directed or undirected.} @@ -14,7 +14,8 @@ correspond to the vertices, and for each element the ID in the new graph is given.} \item{vertex.attr.comb}{Specifies how to combine the vertex attributes in -the new graph. Please see \code{\link[=attribute.combination]{attribute.combination()}} for details.} +the new graph. Please see \code{\link[=attribute.combination]{attribute.combination()}} for details. The +default \code{NULL} uses the \code{vertex.attr.comb} igraph option.} } \value{ A new graph object. diff --git a/man/contract.vertices.Rd b/man/contract.vertices.Rd index 41c8703202..b527e63f73 100644 --- a/man/contract.vertices.Rd +++ b/man/contract.vertices.Rd @@ -18,7 +18,8 @@ correspond to the vertices, and for each element the ID in the new graph is given.} \item{vertex.attr.comb}{Specifies how to combine the vertex attributes in -the new graph. Please see \code{\link[=attribute.combination]{attribute.combination()}} for details.} +the new graph. Please see \code{\link[=attribute.combination]{attribute.combination()}} for details. The +default \code{NULL} uses the \code{vertex.attr.comb} igraph option.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/count.multiple.Rd b/man/count.multiple.Rd index 0f20b5b875..a4e624fe0c 100644 --- a/man/count.multiple.Rd +++ b/man/count.multiple.Rd @@ -9,8 +9,8 @@ count.multiple(graph, eids = E(graph)) \arguments{ \item{graph}{The input graph.} -\item{eids}{The edges to which the query is restricted. By default this is -all edges in the graph.} +\item{eids}{The edges to which the query is restricted. The default +\code{NULL} selects all edges.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/count_triangles.Rd b/man/count_triangles.Rd index 85bd5504cf..99af82f07d 100644 --- a/man/count_triangles.Rd +++ b/man/count_triangles.Rd @@ -7,15 +7,15 @@ \usage{ triangles(graph) -count_triangles(graph, vids = V(graph)) +count_triangles(graph, vids = NULL) } \arguments{ \item{graph}{The input graph. It might be directed, but edge directions are ignored.} -\item{vids}{The vertices to query, all of them by default. This might be a -vector of numeric IDs, or a character vector of symbolic vertex names for -named graphs.} +\item{vids}{The vertices to query. This might be a vector of numeric IDs, +or a character vector of symbolic vertex names for named graphs. The +default \code{NULL} selects all vertices.} } \value{ For \code{triangles()} a numeric vector of vertex IDs, the first three diff --git a/man/degree.Rd b/man/degree.Rd index 5c26929cc4..ec7c9277b4 100644 --- a/man/degree.Rd +++ b/man/degree.Rd @@ -9,7 +9,7 @@ \usage{ degree( graph, - v = V(graph), + v = NULL, ..., mode = c("all", "out", "in", "total"), loops = TRUE, @@ -19,7 +19,7 @@ degree( max_degree( graph, ..., - v = V(graph), + v = NULL, mode = c("all", "out", "in", "total"), loops = TRUE ) @@ -31,7 +31,8 @@ degree_distribution(graph, cumulative = FALSE, ...) \arguments{ \item{graph}{The graph to analyze.} -\item{v}{The IDs of vertices of which the degree will be calculated.} +\item{v}{The IDs of vertices of which the degree will be calculated. +The default \code{NULL} selects all vertices.} \item{...}{These dots are for future extensions and must be empty.} diff --git a/man/dendPlot.Rd b/man/dendPlot.Rd index 20732492af..0333797f58 100644 --- a/man/dendPlot.Rd +++ b/man/dendPlot.Rd @@ -10,7 +10,8 @@ dendPlot(x, mode = igraph_opt("dend.plot.type"), ...) \item{x}{An object containing the community structure of a graph. See \code{\link[=communities]{communities()}} for details.} -\item{mode}{Which dendrogram plotting function to use. See details below.} +\item{mode}{Which dendrogram plotting function to use. See details below. +The default \code{NULL} uses the \code{dend.plot.type} igraph option.} \item{...}{Additional arguments to supply to the dendrogram plotting function.} diff --git a/man/dfs.Rd b/man/dfs.Rd index 05d1cb6391..5364bfd860 100644 --- a/man/dfs.Rd +++ b/man/dfs.Rd @@ -17,7 +17,7 @@ dfs( in.callback = NULL, out.callback = NULL, extra = NULL, - rho = parent.frame(), + rho = NULL, neimode = deprecated(), father = deprecated() ) @@ -61,7 +61,8 @@ Default: \code{NULL}.} \item{extra}{Additional argument to supply to the callback function.} -\item{rho}{The environment in which the callback function is evaluated.} +\item{rho}{The environment in which the callback function is evaluated. +The default \code{NULL} uses the caller's environment.} \item{neimode}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} This argument is deprecated from igraph 1.3.0; use \code{mode} instead.} diff --git a/man/disjoint_union.Rd b/man/disjoint_union.Rd index 7b0b040da9..c0ae54327c 100644 --- a/man/disjoint_union.Rd +++ b/man/disjoint_union.Rd @@ -5,7 +5,7 @@ \alias{\%du\%} \title{Disjoint union of graphs} \usage{ -disjoint_union(..., graph.attr.comb = igraph_opt("graph.attr.comb")) +disjoint_union(..., graph.attr.comb = NULL) x \%du\% y } @@ -13,10 +13,10 @@ x \%du\% y \item{\dots}{Graph objects or lists of graph objects.} \item{graph.attr.comb}{Specification for combining shared graph attributes. -Defaults to the \code{graph.attr.comb} igraph option (\code{"rename"} unless changed -via \code{\link[=igraph_options]{igraph_options()}}), which preserves the historical behaviour of -appending \verb{_1}, \verb{_2}, ... suffixes to clashing attribute names. See -\link{igraph-attribute-combination} for the available combiners.} +The default \code{NULL} uses the \code{graph.attr.comb} igraph option (\code{"rename"} +unless changed via \code{\link[=igraph_options]{igraph_options()}}), which preserves the historical +behaviour of appending \verb{_1}, \verb{_2}, ... suffixes to clashing attribute +names. See \link{igraph-attribute-combination} for the available combiners.} \item{x, y}{Graph objects.} } @@ -50,7 +50,7 @@ An error is generated if some input graphs are directed and others are undirected. } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \examples{ diff --git a/man/distances.Rd b/man/distances.Rd index e52213e5b5..2e84b17143 100644 --- a/man/distances.Rd +++ b/man/distances.Rd @@ -21,8 +21,8 @@ mean_distance( distances( graph, - v = V(graph), - to = V(graph), + v = NULL, + to = NULL, ..., mode = c("all", "out", "in"), weights = NULL, @@ -33,7 +33,7 @@ distances( shortest_paths( graph, from, - to = V(graph), + to = NULL, ..., mode = c("out", "all", "in"), weights = NULL, @@ -46,7 +46,7 @@ shortest_paths( all_shortest_paths( graph, from, - to = V(graph), + to = NULL, ..., mode = c("out", "all", "in"), weights = NULL @@ -78,10 +78,10 @@ additional information like the number of disconnected vertex pairs in the result when this parameter is set to \code{TRUE}.} \item{v}{Numeric vector, the vertices from which the shortest paths will be -calculated.} +calculated. The default \code{NULL} selects all vertices.} \item{to}{Numeric vector, the vertices to which the shortest paths will be -calculated. By default it includes all vertices. Note that for +calculated. The default \code{NULL} includes all vertices. Note that for \code{distances()} every vertex must be included here at most once. (This is not required for \code{shortest_paths()}.} diff --git a/man/diversity.Rd b/man/diversity.Rd index 8c614717ce..0fe5d21dfd 100644 --- a/man/diversity.Rd +++ b/man/diversity.Rd @@ -4,7 +4,7 @@ \alias{diversity} \title{Graph diversity} \usage{ -diversity(graph, ..., weights = NULL, vids = V(graph)) +diversity(graph, ..., weights = NULL, vids = NULL) } \arguments{ \item{graph}{The input graph. Edge directions are ignored.} @@ -15,7 +15,8 @@ diversity(graph, ..., weights = NULL, vids = V(graph)) computation. If \code{NULL}, then the \sQuote{weight} attibute is used. Note that this measure is not defined for unweighted graphs.} -\item{vids}{The vertex IDs for which to calculate the measure.} +\item{vids}{The vertex IDs for which to calculate the measure. +The default \code{NULL} selects all vertices.} } \value{ A numeric vector, its length is the number of vertices. diff --git a/man/dot-apply_modifiers.Rd b/man/dot-apply_modifiers.Rd index 99caccbb44..18e9b439e0 100644 --- a/man/dot-apply_modifiers.Rd +++ b/man/dot-apply_modifiers.Rd @@ -19,7 +19,7 @@ This is a helper function for the common parts of \code{make_()} and \code{sample_()}. } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Operators.html#igraph_simplify}{\code{simplify()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_is_simple}{\code{is_simple()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Operators.html#igraph_simplify}{\code{simplify()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_is_simple}{\code{is_simple()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \keyword{internal} diff --git a/man/edge.betweenness.Rd b/man/edge.betweenness.Rd index 7084de3a29..a98737cf18 100644 --- a/man/edge.betweenness.Rd +++ b/man/edge.betweenness.Rd @@ -15,7 +15,8 @@ edge.betweenness( \arguments{ \item{graph}{The graph to analyze.} -\item{e}{The edges for which the edge betweenness will be calculated.} +\item{e}{The edges for which the edge betweenness will be calculated. +The default \code{NULL} selects all edges.} \item{directed}{Logical, whether directed paths should be considered while determining the shortest paths.} diff --git a/man/edge_attr-set.Rd b/man/edge_attr-set.Rd index 229c67d280..e25638f33e 100644 --- a/man/edge_attr-set.Rd +++ b/man/edge_attr-set.Rd @@ -5,7 +5,7 @@ \alias{edge.attributes<-} \title{Set one or more edge attributes} \usage{ -edge_attr(graph, name, index = E(graph)) <- value +edge_attr(graph, name, index = NULL) <- value } \arguments{ \item{graph}{The graph.} @@ -15,7 +15,7 @@ then \code{value} must be a named list, and its entries are set as edge attributes.} \item{index}{An optional edge sequence to set the attributes -of a subset of edges.} +of a subset of edges. The default \code{NULL} selects all edges.} \item{value}{The new value of the attribute(s) for all (or \code{index}) edges.} diff --git a/man/edge_attr.Rd b/man/edge_attr.Rd index a56595ace8..d1a412dc8d 100644 --- a/man/edge_attr.Rd +++ b/man/edge_attr.Rd @@ -5,7 +5,7 @@ \alias{edge.attributes} \title{Query edge attributes of a graph} \usage{ -edge_attr(graph, name, index = E(graph)) +edge_attr(graph, name, index = NULL) } \arguments{ \item{graph}{The graph} @@ -14,7 +14,7 @@ edge_attr(graph, name, index = E(graph)) all edge attributes are returned in a list.} \item{index}{An optional edge sequence to query edge attributes -for a subset of edges.} +for a subset of edges. The default \code{NULL} selects all edges.} } \value{ The value of the edge attribute, or the list of all diff --git a/man/ego.Rd b/man/ego.Rd index 0a92929bb2..67ddfceda0 100644 --- a/man/ego.Rd +++ b/man/ego.Rd @@ -16,7 +16,7 @@ connect(graph, order, ..., mode = c("all", "out", "in", "total")) ego_size( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -25,7 +25,7 @@ ego_size( neighborhood_size( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -34,7 +34,7 @@ neighborhood_size( ego( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -43,7 +43,7 @@ ego( neighborhood( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -52,7 +52,7 @@ neighborhood( make_ego_graph( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -61,7 +61,7 @@ make_ego_graph( make_neighborhood_graph( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -83,7 +83,8 @@ vertices from which the source vertex is reachable in at most \code{order} steps are counted. \sQuote{"all"} ignores the direction of the edges. This argument is ignored for undirected graphs.} -\item{nodes}{The vertices for which the calculation is performed.} +\item{nodes}{The vertices for which the calculation is performed. +The default \code{NULL} selects all vertices.} \item{mindist}{The minimum distance to include the vertex in the result.} } diff --git a/man/embed_adjacency_matrix.Rd b/man/embed_adjacency_matrix.Rd index f7c3abd2e9..b5071c1785 100644 --- a/man/embed_adjacency_matrix.Rd +++ b/man/embed_adjacency_matrix.Rd @@ -11,8 +11,8 @@ embed_adjacency_matrix( weights = NULL, which = c("lm", "la", "sa"), scaled = TRUE, - cvec = strength(graph, weights = weights)/(vcount(graph) - 1), - options = arpack_defaults() + cvec = NULL, + options = NULL ) } \arguments{ @@ -41,11 +41,13 @@ are used for the ordering.} returned instead of \eqn{X} and \eqn{Y}.} \item{cvec}{A numeric vector, its length is the number vertices in the -graph. This vector is added to the diagonal of the adjacency matrix.} +graph. This vector is added to the diagonal of the adjacency matrix. The +default \code{NULL} uses +\code{strength(graph, weights = weights) / (vcount(graph) - 1)}.} \item{options}{A named list containing the parameters for the SVD -computation algorithm in ARPACK. By default, the list of values is assigned -the values given by \code{\link[=arpack_defaults]{arpack_defaults()}}.} +computation algorithm in ARPACK. The default \code{NULL} uses the values given +by \code{\link[=arpack_defaults]{arpack_defaults()}}.} } \value{ A list containing with entries: diff --git a/man/embed_laplacian_matrix.Rd b/man/embed_laplacian_matrix.Rd index f857c1da76..ae89843dbd 100644 --- a/man/embed_laplacian_matrix.Rd +++ b/man/embed_laplacian_matrix.Rd @@ -12,7 +12,7 @@ embed_laplacian_matrix( which = c("lm", "la", "sa"), type = c("default", "D-A", "DAD", "I-DAD", "OAP"), scaled = TRUE, - options = arpack_defaults() + options = NULL ) } \arguments{ @@ -61,8 +61,8 @@ graphs and \code{OAP} for directed graphs.} returned instead of \eqn{X} and \eqn{Y}.} \item{options}{A named list containing the parameters for the SVD -computation algorithm in ARPACK. By default, the list of values is assigned -the values given by \code{\link[=arpack_defaults]{arpack_defaults()}}.} +computation algorithm in ARPACK. The default \code{NULL} uses the values given +by \code{\link[=arpack_defaults]{arpack_defaults()}}.} } \value{ A list containing with entries: diff --git a/man/establishment.game.Rd b/man/establishment.game.Rd index fab6da8bb3..c27ce60c40 100644 --- a/man/establishment.game.Rd +++ b/man/establishment.game.Rd @@ -21,10 +21,11 @@ establishment.game( \item{k}{The number of trials per time step, see details below.} \item{type.dist}{The distribution of the vertex types. This is assumed to be -stationary in time.} +stationary in time. The default \code{NULL} gives a uniform distribution.} \item{pref.matrix}{A matrix giving the preferences of the given vertex -types. These should be probabilities, i.e. numbers between zero and one.} +types. These should be probabilities, i.e. numbers between zero and one. +The default \code{NULL} sets all preferences to one.} \item{directed}{Logical, whether to generate directed graphs.} } diff --git a/man/estimate_closeness.Rd b/man/estimate_closeness.Rd index 0f71008210..2b7d031524 100644 --- a/man/estimate_closeness.Rd +++ b/man/estimate_closeness.Rd @@ -16,7 +16,8 @@ estimate_closeness( \arguments{ \item{graph}{The graph to analyze.} -\item{vids}{The vertices for which closeness will be calculated.} +\item{vids}{The vertices for which closeness will be calculated. +The default \code{NULL} selects all vertices.} \item{mode}{Character string, defined the types of the paths used for measuring the distance in directed graphs. \dQuote{in} measures the paths diff --git a/man/estimate_edge_betweenness.Rd b/man/estimate_edge_betweenness.Rd index b5ebe0531d..acd055427c 100644 --- a/man/estimate_edge_betweenness.Rd +++ b/man/estimate_edge_betweenness.Rd @@ -15,7 +15,8 @@ estimate_edge_betweenness( \arguments{ \item{graph}{The graph to analyze.} -\item{e}{The edges for which the edge betweenness will be calculated.} +\item{e}{The edges for which the edge betweenness will be calculated. +The default \code{NULL} selects all edges.} \item{directed}{Logical, whether directed paths should be considered while determining the shortest paths.} diff --git a/man/get.adjacency.Rd b/man/get.adjacency.Rd index 3fa07e6a9e..c514ab5160 100644 --- a/man/get.adjacency.Rd +++ b/man/get.adjacency.Rd @@ -35,7 +35,7 @@ is present in the graph.} \item{sparse}{Logical, whether to create a sparse matrix. The \sQuote{\code{Matrix}} package must be installed for creating sparse -matrices.} +matrices. The default \code{NULL} uses the \code{sparsematrices} igraph option.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/get.all.shortest.paths.Rd b/man/get.all.shortest.paths.Rd index 8710387e65..ac517470fc 100644 --- a/man/get.all.shortest.paths.Rd +++ b/man/get.all.shortest.paths.Rd @@ -20,7 +20,7 @@ be calculated. Note that right now this is not a vector of vertex IDs, but only a single vertex.} \item{to}{Numeric vector, the vertices to which the shortest paths will be -calculated. By default it includes all vertices. Note that for +calculated. The default \code{NULL} includes all vertices. Note that for \code{distances()} every vertex must be included here at most once. (This is not required for \code{shortest_paths()}.} diff --git a/man/get.edge.attribute.Rd b/man/get.edge.attribute.Rd index 2a8249a075..5fc746f899 100644 --- a/man/get.edge.attribute.Rd +++ b/man/get.edge.attribute.Rd @@ -13,7 +13,7 @@ get.edge.attribute(graph, name, index = E(graph)) all edge attributes are returned in a list.} \item{index}{An optional edge sequence to query edge attributes -for a subset of edges.} +for a subset of edges. The default \code{NULL} selects all edges.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/get.shortest.paths.Rd b/man/get.shortest.paths.Rd index f631dd02c8..d71de3f3a7 100644 --- a/man/get.shortest.paths.Rd +++ b/man/get.shortest.paths.Rd @@ -24,7 +24,7 @@ be calculated. Note that right now this is not a vector of vertex IDs, but only a single vertex.} \item{to}{Numeric vector, the vertices to which the shortest paths will be -calculated. By default it includes all vertices. Note that for +calculated. The default \code{NULL} includes all vertices. Note that for \code{distances()} every vertex must be included here at most once. (This is not required for \code{shortest_paths()}.} diff --git a/man/get.stochastic.Rd b/man/get.stochastic.Rd index 9a0c834553..d5b47e6884 100644 --- a/man/get.stochastic.Rd +++ b/man/get.stochastic.Rd @@ -17,7 +17,8 @@ get.stochastic( sum up to one; otherwise it is the columns.} \item{sparse}{Logical, whether to return a sparse matrix. The -\code{Matrix} package is needed for sparse matrices.} +\code{Matrix} package is needed for sparse matrices. The default \code{NULL} uses +the \code{sparsematrices} igraph option.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/get.vertex.attribute.Rd b/man/get.vertex.attribute.Rd index 77bad90850..b13e8f4446 100644 --- a/man/get.vertex.attribute.Rd +++ b/man/get.vertex.attribute.Rd @@ -13,7 +13,7 @@ get.vertex.attribute(graph, name, index = V(graph)) all vertex attributes are returned in a list.} \item{index}{An optional vertex sequence to query the attribute only -for these vertices.} +for these vertices. The default \code{NULL} selects all vertices.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/global_efficiency.Rd b/man/global_efficiency.Rd index b24157c080..2a390554fa 100644 --- a/man/global_efficiency.Rd +++ b/man/global_efficiency.Rd @@ -10,7 +10,7 @@ global_efficiency(graph, ..., weights = NULL, directed = TRUE) local_efficiency( graph, - vids = V(graph), + vids = NULL, ..., weights = NULL, directed = TRUE, @@ -38,7 +38,8 @@ and the graph has a \code{weight} edge attribute, then it is used automatically. for undirected graphs.} \item{vids}{The vertex IDs of the vertices for which the calculation will be done. -Applies to the local efficiency calculation only.} +Applies to the local efficiency calculation only. The default \code{NULL} +selects all vertices.} \item{mode}{Specifies how to define the local neighborhood of a vertex in directed graphs. \dQuote{out} considers out-neighbors only, \dQuote{in} diff --git a/man/graph.Rd b/man/graph.Rd index 1502dd379a..25e0b0c35e 100644 --- a/man/graph.Rd +++ b/man/graph.Rd @@ -40,7 +40,8 @@ Passed to \code{make_directed_graph()} or \code{make_undirected_graph()}.} ignored (with a warning) if \code{edges} are symbolic vertex names. It is also ignored if there is a bigger vertex ID in \code{edges}. This means that for this function it is safe to supply zero here if the -vertex with the largest ID is not an isolate.} +vertex with the largest ID is not an isolate. The default \code{NULL} uses +the largest vertex ID in \code{edges}.} \item{isolates}{Character vector, names of isolate vertices, for symbolic edge lists. It is ignored for numeric edge lists.} diff --git a/man/graph.bfs.Rd b/man/graph.bfs.Rd index cfd41d968d..56642407ca 100644 --- a/man/graph.bfs.Rd +++ b/man/graph.bfs.Rd @@ -67,7 +67,8 @@ Default: \code{NULL}.} \item{extra}{Additional argument to supply to the callback function.} -\item{rho}{The environment in which the callback function is evaluated.} +\item{rho}{The environment in which the callback function is evaluated. +The default \code{NULL} uses the caller's environment.} \item{neimode}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} This argument is deprecated from igraph 1.3.0; use \code{mode} instead.} diff --git a/man/graph.compose.Rd b/man/graph.compose.Rd index b033a85150..7b22c64634 100644 --- a/man/graph.compose.Rd +++ b/man/graph.compose.Rd @@ -24,7 +24,7 @@ but not both graphs are named.} consistent API. } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Isomorphism.html#igraph_permute_vertices}{\code{permute_vertices()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Isomorphism.html#igraph_permute_vertices}{\code{permute_vertices()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \keyword{internal} diff --git a/man/graph.dfs.Rd b/man/graph.dfs.Rd index 6af1a07a25..cdb45188a1 100644 --- a/man/graph.dfs.Rd +++ b/man/graph.dfs.Rd @@ -57,7 +57,8 @@ Default: \code{NULL}.} \item{extra}{Additional argument to supply to the callback function.} -\item{rho}{The environment in which the callback function is evaluated.} +\item{rho}{The environment in which the callback function is evaluated. +The default \code{NULL} uses the caller's environment.} \item{neimode}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} This argument is deprecated from igraph 1.3.0; use \code{mode} instead.} diff --git a/man/graph.disjoint.union.Rd b/man/graph.disjoint.union.Rd index 860eec15e5..fcd7fbb890 100644 --- a/man/graph.disjoint.union.Rd +++ b/man/graph.disjoint.union.Rd @@ -16,7 +16,7 @@ graph.disjoint.union(...) consistent API. } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \keyword{internal} diff --git a/man/graph.diversity.Rd b/man/graph.diversity.Rd index 552c78a974..bd1ca92af5 100644 --- a/man/graph.diversity.Rd +++ b/man/graph.diversity.Rd @@ -13,7 +13,8 @@ graph.diversity(graph, weights = NULL, vids = V(graph)) computation. If \code{NULL}, then the \sQuote{weight} attibute is used. Note that this measure is not defined for unweighted graphs.} -\item{vids}{The vertex IDs for which to calculate the measure.} +\item{vids}{The vertex IDs for which to calculate the measure. +The default \code{NULL} selects all vertices.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/graph.famous.Rd b/man/graph.famous.Rd index 52c5eff3fb..773e87321a 100644 --- a/man/graph.famous.Rd +++ b/man/graph.famous.Rd @@ -40,7 +40,8 @@ Passed to \code{make_directed_graph()} or \code{make_undirected_graph()}.} ignored (with a warning) if \code{edges} are symbolic vertex names. It is also ignored if there is a bigger vertex ID in \code{edges}. This means that for this function it is safe to supply zero here if the -vertex with the largest ID is not an isolate.} +vertex with the largest ID is not an isolate. The default \code{NULL} uses +the largest vertex ID in \code{edges}.} \item{isolates}{Character vector, names of isolate vertices, for symbolic edge lists. It is ignored for numeric edge lists.} diff --git a/man/graph.knn.Rd b/man/graph.knn.Rd index 2b4a24c363..70c502f64e 100644 --- a/man/graph.knn.Rd +++ b/man/graph.knn.Rd @@ -15,8 +15,8 @@ graph.knn( \arguments{ \item{graph}{The input graph. It may be directed.} -\item{vids}{The vertices for which the calculation is performed. Normally it -includes all vertices. Note, that if not all vertices are given here, then +\item{vids}{The vertices for which the calculation is performed. +The default \code{NULL} includes all vertices. Note, that if not all vertices are given here, then both \sQuote{\code{knn}} and \sQuote{\code{knnk}} will be calculated based on the given vertices only.} diff --git a/man/graph.neighborhood.Rd b/man/graph.neighborhood.Rd index 3a52ea1951..2ed769672d 100644 --- a/man/graph.neighborhood.Rd +++ b/man/graph.neighborhood.Rd @@ -18,7 +18,8 @@ graph.neighborhood( \item{order}{Integer giving the order of the neighborhood. Negative values indicate an infinite order.} -\item{nodes}{The vertices for which the calculation is performed.} +\item{nodes}{The vertices for which the calculation is performed. +The default \code{NULL} selects all vertices.} \item{mode}{Character constant, it specifies how to use the direction of the edges if a directed graph is analyzed. For \sQuote{out} only the diff --git a/man/graph.strength.Rd b/man/graph.strength.Rd index d4cc8e6242..daf41c663f 100644 --- a/man/graph.strength.Rd +++ b/man/graph.strength.Rd @@ -15,7 +15,8 @@ graph.strength( \arguments{ \item{graph}{The input graph.} -\item{vids}{The vertices for which the strength will be calculated.} +\item{vids}{The vertices for which the strength will be calculated. +The default \code{NULL} selects all vertices.} \item{mode}{Character string, \dQuote{out} for out-degree, \dQuote{in} for in-degree or \dQuote{all} for the sum of the two. For undirected graphs this diff --git a/man/graph.union.Rd b/man/graph.union.Rd index 5598a09fa6..a87f5e1a2e 100644 --- a/man/graph.union.Rd +++ b/man/graph.union.Rd @@ -22,7 +22,7 @@ graphs are named.} consistent API. } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Isomorphism.html#igraph_permute_vertices}{\code{permute_vertices()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Isomorphism.html#igraph_permute_vertices}{\code{permute_vertices()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \keyword{internal} diff --git a/man/graph_.Rd b/man/graph_.Rd index 823d7aab3a..287c1b7b63 100644 --- a/man/graph_.Rd +++ b/man/graph_.Rd @@ -16,7 +16,7 @@ This is a generic function to convert R objects to igraph graphs. TODO } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Operators.html#igraph_simplify}{\code{simplify()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_is_simple}{\code{is_simple()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Operators.html#igraph_simplify}{\code{simplify()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_is_simple}{\code{is_simple()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \examples{ diff --git a/man/graphlet_basis.Rd b/man/graphlet_basis.Rd index 1fd9f5783d..a6e9708624 100644 --- a/man/graphlet_basis.Rd +++ b/man/graphlet_basis.Rd @@ -8,14 +8,7 @@ \usage{ graphlet_basis(graph, ..., weights = NULL) -graphlet_proj( - graph, - ..., - weights = NULL, - cliques, - niter = 1000, - Mu = rep(1, length(cliques)) -) +graphlet_proj(graph, ..., weights = NULL, cliques, niter = 1000, Mu = NULL) graphlets(graph, ..., weights = NULL, niter = 1000) } @@ -34,7 +27,8 @@ projection.} \item{niter}{Integer scalar, the number of iterations to perform.} -\item{Mu}{Starting weights for the projection.} +\item{Mu}{Starting weights for the projection. The default \code{NULL} uses a +weight of one for each clique.} } \value{ \code{graphlets()} returns a list with two members: diff --git a/man/graphlets.project.Rd b/man/graphlets.project.Rd index dce325e0ea..535c2c5e9c 100644 --- a/man/graphlets.project.Rd +++ b/man/graphlets.project.Rd @@ -25,7 +25,8 @@ projection.} \item{niter}{Integer scalar, the number of iterations to perform.} -\item{Mu}{Starting weights for the projection.} +\item{Mu}{Starting weights for the projection. The default \code{NULL} uses a +weight of one for each clique.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/harmonic_centrality.Rd b/man/harmonic_centrality.Rd index e45621660c..1c93bc61ca 100644 --- a/man/harmonic_centrality.Rd +++ b/man/harmonic_centrality.Rd @@ -6,7 +6,7 @@ \usage{ harmonic_centrality( graph, - vids = V(graph), + vids = NULL, ..., mode = c("out", "in", "all", "total"), weights = NULL, @@ -17,7 +17,8 @@ harmonic_centrality( \arguments{ \item{graph}{The graph to analyze.} -\item{vids}{The vertices for which harmonic centrality will be calculated.} +\item{vids}{The vertices for which harmonic centrality will be calculated. +The default \code{NULL} selects all vertices.} \item{...}{These dots are for future extensions and must be empty.} diff --git a/man/hits_scores.Rd b/man/hits_scores.Rd index 83db1d6116..ee1440b68c 100644 --- a/man/hits_scores.Rd +++ b/man/hits_scores.Rd @@ -4,13 +4,7 @@ \alias{hits_scores} \title{Kleinberg's hub and authority centrality scores.} \usage{ -hits_scores( - graph, - ..., - scale = TRUE, - weights = NULL, - options = arpack_defaults() -) +hits_scores(graph, ..., scale = TRUE, weights = NULL, options = NULL) } \arguments{ \item{graph}{The input graph.} @@ -28,7 +22,7 @@ interprets edge weights as connection strengths. The weights of parallel edges are effectively added up.} \item{options}{A named list, to override some ARPACK options. See -\code{\link[=arpack]{arpack()}} for details.} +\code{\link[=arpack]{arpack()}} for details. The default \code{NULL} uses \code{\link[=arpack_defaults]{arpack_defaults()}}.} } \value{ A named list with members: diff --git a/man/indent_print.Rd b/man/indent_print.Rd index 44dc63c544..abb8662347 100644 --- a/man/indent_print.Rd +++ b/man/indent_print.Rd @@ -4,14 +4,15 @@ \alias{indent_print} \title{Indent a printout} \usage{ -indent_print(..., .indent = " ", .printer = print) +indent_print(..., .indent = " ", .printer = NULL) } \arguments{ \item{...}{Passed to the printing function.} \item{.indent}{Character scalar, indent the printout with this.} -\item{.printer}{The printing function, defaults to \link{print}.} +\item{.printer}{The printing function. The default \code{NULL} uses +\link{print}.} } \value{ The first element in \code{...}, invisibly. diff --git a/man/intersection.igraph.Rd b/man/intersection.igraph.Rd index 5dffbafe55..6a07aae79f 100644 --- a/man/intersection.igraph.Rd +++ b/man/intersection.igraph.Rd @@ -65,7 +65,7 @@ An error is generated if some input graphs are directed and others are undirected. } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Isomorphism.html#igraph_permute_vertices}{\code{permute_vertices()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Isomorphism.html#igraph_permute_vertices}{\code{permute_vertices()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \examples{ diff --git a/man/is.loop.Rd b/man/is.loop.Rd index afbc31e9cc..ce99c88946 100644 --- a/man/is.loop.Rd +++ b/man/is.loop.Rd @@ -9,8 +9,8 @@ is.loop(graph, eids = E(graph)) \arguments{ \item{graph}{The input graph.} -\item{eids}{The edges to which the query is restricted. By default this is -all edges in the graph.} +\item{eids}{The edges to which the query is restricted. The default +\code{NULL} selects all edges.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/is.multiple.Rd b/man/is.multiple.Rd index 267db47fed..8ea9bd2d76 100644 --- a/man/is.multiple.Rd +++ b/man/is.multiple.Rd @@ -9,8 +9,8 @@ is.multiple(graph, eids = E(graph)) \arguments{ \item{graph}{The input graph.} -\item{eids}{The edges to which the query is restricted. By default this is -all edges in the graph.} +\item{eids}{The edges to which the query is restricted. The default +\code{NULL} selects all edges.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/is.mutual.Rd b/man/is.mutual.Rd index 099975f9e2..321108ac67 100644 --- a/man/is.mutual.Rd +++ b/man/is.mutual.Rd @@ -9,8 +9,8 @@ is.mutual(graph, eids = E(graph), loops = TRUE) \arguments{ \item{graph}{The input graph.} -\item{eids}{Edge sequence, the edges that will be probed. By default is -includes all edges in the order of their IDs.} +\item{eids}{Edge sequence, the edges that will be probed. The default +\code{NULL} includes all edges in the order of their IDs.} \item{loops}{Logical, whether to consider directed self-loops to be mutual.} } diff --git a/man/knn.Rd b/man/knn.Rd index fb25f706c9..96ba5158ec 100644 --- a/man/knn.Rd +++ b/man/knn.Rd @@ -6,7 +6,7 @@ \usage{ knn( graph, - vids = V(graph), + vids = NULL, ..., mode = c("all", "out", "in", "total"), neighbor.degree.mode = c("all", "out", "in", "total"), @@ -16,8 +16,8 @@ knn( \arguments{ \item{graph}{The input graph. It may be directed.} -\item{vids}{The vertices for which the calculation is performed. Normally it -includes all vertices. Note, that if not all vertices are given here, then +\item{vids}{The vertices for which the calculation is performed. +The default \code{NULL} includes all vertices. Note, that if not all vertices are given here, then both \sQuote{\code{knn}} and \sQuote{\code{knnk}} will be calculated based on the given vertices only.} diff --git a/man/lastcit.game.Rd b/man/lastcit.game.Rd index ec2be85128..538998802c 100644 --- a/man/lastcit.game.Rd +++ b/man/lastcit.game.Rd @@ -17,11 +17,13 @@ lastcit.game( \item{edges}{Number of edges per step.} -\item{agebins}{Number of aging bins.} +\item{agebins}{Number of aging bins. The default \code{NULL} uses \code{n / 7100}.} \item{pref}{Vector (\code{sample_last_cit()} and \code{sample_cit_types()} or matrix (\code{sample_cit_cit_types()}) giving the (unnormalized) citation -probabilities for the different vertex types.} +probabilities for the different vertex types. The default \code{NULL} uses +\code{(1:(agebins + 1))^-3} for \code{sample_last_cit()} and all-one probabilities +for the other two.} \item{directed}{Logical, whether to generate directed networks.} } diff --git a/man/layout.davidson.harel.Rd b/man/layout.davidson.harel.Rd index 28416461c1..2df57ce460 100644 --- a/man/layout.davidson.harel.Rd +++ b/man/layout.davidson.harel.Rd @@ -26,7 +26,8 @@ coordinates.} \item{maxiter}{Number of iterations to perform in the first phase.} -\item{fineiter}{Number of iterations in the fine tuning phase.} +\item{fineiter}{Number of iterations in the fine tuning phase. The +default \code{NULL} uses \code{max(10, log2(vcount(graph)))}.} \item{cool.fact}{Cooling factor.} @@ -38,13 +39,15 @@ the energy function. It can be set to zero, if vertices are allowed to sit on the border.} \item{weight.edge.lengths}{Weight for the edge length component of the -energy function.} +energy function. The default \code{NULL} uses \code{edge_density(graph) / 10}.} \item{weight.edge.crossings}{Weight for the edge crossing component of the -energy function.} +energy function. The default \code{NULL} uses +\code{1 - sqrt(edge_density(graph))}.} \item{weight.node.edge.dist}{Weight for the node-edge distance component of -the energy function.} +the energy function. The default \code{NULL} uses +\code{0.2 * (1 - edge_density(graph))}.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/layout.drl.Rd b/man/layout.drl.Rd index f8c21417d8..2a6be6f177 100644 --- a/man/layout.drl.Rd +++ b/man/layout.drl.Rd @@ -20,10 +20,11 @@ layout.drl( \code{seed} argument as a starting point.} \item{seed}{A matrix with two columns, the starting coordinates for the -vertices is \code{use.seed} is \code{TRUE}. It is ignored otherwise.} +vertices is \code{use.seed} is \code{TRUE}. It is ignored otherwise. The default +\code{NULL} draws uniformly random starting coordinates.} \item{options}{Options for the layout generator, a named list. See details -below.} +below. The default \code{NULL} uses \code{drl_defaults$default}.} \item{weights}{The weights of the edges. It must be a positive numeric vector, \code{NULL} or \code{NA}. If it is \code{NULL} and the input graph has a diff --git a/man/layout.gem.Rd b/man/layout.gem.Rd index f71b585e24..9046cfc733 100644 --- a/man/layout.gem.Rd +++ b/man/layout.gem.Rd @@ -21,19 +21,19 @@ depending on the \code{dim} argument. Default: \code{NULL}.} \item{maxiter}{The maximum number of iterations to perform. Updating a -single vertex counts as an iteration. A reasonable default is 40 * n * n, +single vertex counts as an iteration. The default \code{NULL} uses 40 * n * n, where n is the number of vertices. The original paper suggests 4 * n * n, but this usually only works if the other parameters are set up carefully.} -\item{temp.max}{The maximum allowed local temperature. A reasonable default -is the number of vertices.} +\item{temp.max}{The maximum allowed local temperature. The default \code{NULL} +uses the number of vertices.} \item{temp.min}{The global temperature at which the algorithm terminates (even before reaching \code{maxiter} iterations). A reasonable default is 1/10.} -\item{temp.init}{Initial local temperature of all vertices. A reasonable -default is the square root of the number of vertices.} +\item{temp.init}{Initial local temperature of all vertices. The default +\code{NULL} uses the square root of the number of vertices.} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} diff --git a/man/layout.star.Rd b/man/layout.star.Rd index 426ec88cbc..7cb3fbf768 100644 --- a/man/layout.star.Rd +++ b/man/layout.star.Rd @@ -9,8 +9,8 @@ layout.star(graph, center = V(graph)[1], order = NULL) \arguments{ \item{graph}{The graph to layout.} -\item{center}{The ID of the vertex to put in the center. By default it is -the first vertex.} +\item{center}{The ID of the vertex to put in the center. The default +\code{NULL} uses the first vertex.} \item{order}{Numeric vector, the order of the vertices along the perimeter. The default ordering is given by the vertex IDs.} diff --git a/man/layout_as_star.Rd b/man/layout_as_star.Rd index 777bdfcbd0..5e488de3a9 100644 --- a/man/layout_as_star.Rd +++ b/man/layout_as_star.Rd @@ -5,7 +5,7 @@ \alias{as_star} \title{Generate coordinates to place the vertices of a graph in a star-shape} \usage{ -layout_as_star(graph, ..., center = V(graph)[1], order = NULL) +layout_as_star(graph, ..., center = NULL, order = NULL) as_star(...) } @@ -14,8 +14,8 @@ as_star(...) \item{...}{Arguments to pass to \code{layout_as_star()}.} -\item{center}{The ID of the vertex to put in the center. By default it is -the first vertex.} +\item{center}{The ID of the vertex to put in the center. The default +\code{NULL} uses the first vertex.} \item{order}{Numeric vector, the order of the vertices along the perimeter. The default ordering is given by the vertex IDs.} diff --git a/man/layout_in_circle.Rd b/man/layout_in_circle.Rd index e2d51dd08f..4fda9824f9 100644 --- a/man/layout_in_circle.Rd +++ b/man/layout_in_circle.Rd @@ -5,7 +5,7 @@ \alias{in_circle} \title{Graph layout with vertices on a circle.} \usage{ -layout_in_circle(graph, order = V(graph)) +layout_in_circle(graph, order = NULL) in_circle(...) } @@ -14,7 +14,8 @@ in_circle(...) \item{order}{The vertices to place on the circle, in the order of their desired placement. Vertices that are not included here will be placed at -(0,0).} +(0,0). The default \code{NULL} selects all vertices, in the order of their +IDs.} \item{...}{Passed to \code{layout_in_circle()}.} } diff --git a/man/layout_with_dh.Rd b/man/layout_with_dh.Rd index c9c3a90ec2..107e502166 100644 --- a/man/layout_with_dh.Rd +++ b/man/layout_with_dh.Rd @@ -10,13 +10,13 @@ layout_with_dh( ..., coords = NULL, maxiter = 10, - fineiter = max(10, log2(vcount(graph))), + fineiter = NULL, cool.fact = 0.75, weight.node.dist = 1, weight.border = 0, - weight.edge.lengths = edge_density(graph)/10, - weight.edge.crossings = 1 - sqrt(edge_density(graph)), - weight.node.edge.dist = 0.2 * (1 - edge_density(graph)) + weight.edge.lengths = NULL, + weight.edge.crossings = NULL, + weight.node.edge.dist = NULL ) with_dh(...) @@ -32,7 +32,8 @@ coordinates.} \item{maxiter}{Number of iterations to perform in the first phase.} -\item{fineiter}{Number of iterations in the fine tuning phase.} +\item{fineiter}{Number of iterations in the fine tuning phase. The +default \code{NULL} uses \code{max(10, log2(vcount(graph)))}.} \item{cool.fact}{Cooling factor.} @@ -44,13 +45,15 @@ the energy function. It can be set to zero, if vertices are allowed to sit on the border.} \item{weight.edge.lengths}{Weight for the edge length component of the -energy function.} +energy function. The default \code{NULL} uses \code{edge_density(graph) / 10}.} \item{weight.edge.crossings}{Weight for the edge crossing component of the -energy function.} +energy function. The default \code{NULL} uses +\code{1 - sqrt(edge_density(graph))}.} \item{weight.node.edge.dist}{Weight for the node-edge distance component of -the energy function.} +the energy function. The default \code{NULL} uses +\code{0.2 * (1 - edge_density(graph))}.} } \value{ A matrix with two columns, containing the x and y coordinates diff --git a/man/layout_with_drl.Rd b/man/layout_with_drl.Rd index c5e17f7cd0..e7441d81fa 100644 --- a/man/layout_with_drl.Rd +++ b/man/layout_with_drl.Rd @@ -15,8 +15,8 @@ layout_with_drl( graph, ..., use.seed = FALSE, - seed = matrix(runif(vcount(graph) * 2), ncol = 2), - options = drl_defaults$default, + seed = NULL, + options = NULL, weights = NULL, dim = c(2, 3) ) @@ -32,10 +32,11 @@ with_drl(...) \code{seed} argument as a starting point.} \item{seed}{A matrix with two columns, the starting coordinates for the -vertices is \code{use.seed} is \code{TRUE}. It is ignored otherwise.} +vertices is \code{use.seed} is \code{TRUE}. It is ignored otherwise. The default +\code{NULL} draws uniformly random starting coordinates.} \item{options}{Options for the layout generator, a named list. See details -below.} +below. The default \code{NULL} uses \code{drl_defaults$default}.} \item{weights}{The weights of the edges. It must be a positive numeric vector, \code{NULL} or \code{NA}. If it is \code{NULL} and the input graph has a diff --git a/man/layout_with_fr.Rd b/man/layout_with_fr.Rd index 6627fbf1c4..90f32995dc 100644 --- a/man/layout_with_fr.Rd +++ b/man/layout_with_fr.Rd @@ -11,7 +11,7 @@ layout_with_fr( coords = NULL, dim = c(2, 3), niter = 500, - start.temp = sqrt(vcount(graph)), + start.temp = NULL, grid = c("auto", "grid", "nogrid"), weights = NULL, minx = NULL, @@ -46,7 +46,8 @@ space.} \item{start.temp}{Real scalar, the start temperature. This is the maximum amount of movement alloved along one axis, within one step, for a vertex. -Currently it is decreased linearly to zero during the iteration.} +Currently it is decreased linearly to zero during the iteration. The +default \code{NULL} uses \code{sqrt(vcount(graph))}.} \item{grid}{Character scalar, whether to use the faster, but less accurate grid based implementation of the algorithm. By default (\dQuote{auto}), the diff --git a/man/layout_with_gem.Rd b/man/layout_with_gem.Rd index f4b36cb3c9..d0d906cc43 100644 --- a/man/layout_with_gem.Rd +++ b/man/layout_with_gem.Rd @@ -9,10 +9,10 @@ layout_with_gem( graph, ..., coords = NULL, - maxiter = 40 * vcount(graph)^2, - temp.max = max(vcount(graph), 1), - temp.min = 1/10, - temp.init = sqrt(max(vcount(graph), 1)) + maxiter = NULL, + temp.max = NULL, + temp.min = 0.1, + temp.init = NULL ) with_gem(...) @@ -27,19 +27,19 @@ depending on the \code{dim} argument. Default: \code{NULL}.} \item{maxiter}{The maximum number of iterations to perform. Updating a -single vertex counts as an iteration. A reasonable default is 40 * n * n, +single vertex counts as an iteration. The default \code{NULL} uses 40 * n * n, where n is the number of vertices. The original paper suggests 4 * n * n, but this usually only works if the other parameters are set up carefully.} -\item{temp.max}{The maximum allowed local temperature. A reasonable default -is the number of vertices.} +\item{temp.max}{The maximum allowed local temperature. The default \code{NULL} +uses the number of vertices.} \item{temp.min}{The global temperature at which the algorithm terminates (even before reaching \code{maxiter} iterations). A reasonable default is 1/10.} -\item{temp.init}{Initial local temperature of all vertices. A reasonable -default is the square root of the number of vertices.} +\item{temp.init}{Initial local temperature of all vertices. The default +\code{NULL} uses the square root of the number of vertices.} } \value{ A numeric matrix with two columns, and as many rows as the number of diff --git a/man/layout_with_kk.Rd b/man/layout_with_kk.Rd index 5b4278c1c9..7d9d6dfda7 100644 --- a/man/layout_with_kk.Rd +++ b/man/layout_with_kk.Rd @@ -10,9 +10,9 @@ layout_with_kk( ..., coords = NULL, dim = c(2, 3), - maxiter = 50 * vcount(graph), + maxiter = NULL, epsilon = 0, - kkconst = max(vcount(graph), 1), + kkconst = NULL, weights = NULL, minx = NULL, maxx = NULL, @@ -43,7 +43,8 @@ dimensional layouts are places on a plane, three dimensional ones in the 3d space.} \item{maxiter}{The maximum number of iterations to perform. The algorithm -might terminate earlier, see the \code{epsilon} argument.} +might terminate earlier, see the \code{epsilon} argument. The default \code{NULL} +uses \code{50 * vcount(graph)}.} \item{epsilon}{Numeric scalar, the algorithm terminates, if the maximal delta is less than this. (See the reference below for what delta means.) If @@ -51,7 +52,7 @@ you set this to zero, then the function always performs \code{maxiter} iterations.} \item{kkconst}{Numeric scalar, the Kamada-Kawai vertex attraction constant. -Typical (and default) value is the number of vertices.} +The default \code{NULL} uses the number of vertices.} \item{weights}{Edge weights, larger values will result in longer edges. Note that this is the opposite of \code{\link[=layout_with_fr]{layout_with_fr()}}, which produces diff --git a/man/layout_with_lgl.Rd b/man/layout_with_lgl.Rd index 7dd652c3f0..ee5fa9bfd3 100644 --- a/man/layout_with_lgl.Rd +++ b/man/layout_with_lgl.Rd @@ -9,11 +9,11 @@ layout_with_lgl( graph, ..., maxiter = 150, - maxdelta = vcount(graph), - area = vcount(graph)^2, + maxdelta = NULL, + area = NULL, coolexp = 1.5, - repulserad = area * vcount(graph), - cellsize = sqrt(sqrt(area)), + repulserad = NULL, + cellsize = NULL, root = NULL ) @@ -26,21 +26,21 @@ with_lgl(...) \item{maxiter}{The maximum number of iterations to perform (150).} -\item{maxdelta}{The maximum change for a vertex during an iteration (the -number of vertices).} +\item{maxdelta}{The maximum change for a vertex during an iteration. The +default \code{NULL} uses the number of vertices.} -\item{area}{The area of the surface on which the vertices are placed (square -of the number of vertices).} +\item{area}{The area of the surface on which the vertices are placed. The +default \code{NULL} uses the square of the number of vertices.} \item{coolexp}{The cooling exponent of the simulated annealing (1.5).} -\item{repulserad}{Cancellation radius for the repulsion (the \code{area} -times the number of vertices).} +\item{repulserad}{Cancellation radius for the repulsion. The default +\code{NULL} uses the \code{area} times the number of vertices.} \item{cellsize}{The size of the cells for the grid. When calculating the repulsion forces between vertices only vertices in the same or neighboring -grid cells are taken into account (the fourth root of the number of -\code{area}.} +grid cells are taken into account. The default \code{NULL} uses the square +root of the square root of the \code{area}.} \item{root}{The ID of the vertex to place at the middle of the layout. The default value is -1 which means that a random vertex is selected.} diff --git a/man/make_.Rd b/man/make_.Rd index f9ff4b5cf8..4bb6dfcaba 100644 --- a/man/make_.Rd +++ b/man/make_.Rd @@ -31,7 +31,7 @@ to the newly created graphs. See the examples and the various constructor modifiers below. } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Operators.html#igraph_simplify}{\code{simplify()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_is_simple}{\code{is_simple()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Operators.html#igraph_simplify}{\code{simplify()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_is_simple}{\code{is_simple()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \examples{ diff --git a/man/make_graph.Rd b/man/make_graph.Rd index 37c8cb01f0..ccf05ddeb6 100644 --- a/man/make_graph.Rd +++ b/man/make_graph.Rd @@ -12,16 +12,16 @@ make_graph( edges, ..., - n = max(edges), + n = NULL, isolates = NULL, directed = TRUE, - dir = directed, + dir = NULL, simplify = TRUE ) -make_directed_graph(edges, n = max(edges)) +make_directed_graph(edges, n = NULL) -make_undirected_graph(edges, n = max(edges)) +make_undirected_graph(edges, n = NULL) directed_graph(...) @@ -53,7 +53,8 @@ Passed to \code{make_directed_graph()} or \code{make_undirected_graph()}.} ignored (with a warning) if \code{edges} are symbolic vertex names. It is also ignored if there is a bigger vertex ID in \code{edges}. This means that for this function it is safe to supply zero here if the -vertex with the largest ID is not an isolate.} +vertex with the largest ID is not an isolate. The default \code{NULL} uses +the largest vertex ID in \code{edges}.} \item{isolates}{Character vector, names of isolate vertices, for symbolic edge lists. It is ignored for numeric edge lists.} diff --git a/man/matching.Rd b/man/matching.Rd index de15b86346..c99eac7679 100644 --- a/man/matching.Rd +++ b/man/matching.Rd @@ -10,13 +10,7 @@ is_matching(graph, matching, types = NULL) is_max_matching(graph, matching, types = NULL) -max_bipartite_match( - graph, - types = NULL, - ..., - weights = NULL, - eps = .Machine$double.eps -) +max_bipartite_match(graph, types = NULL, ..., weights = NULL, eps = NULL) } \arguments{ \item{graph}{The input graph. It might be directed, but edge directions will @@ -40,9 +34,9 @@ much as possible.} \item{eps}{A small real number used in equality tests in the weighted bipartite matching algorithm. Two real numbers are considered equal in the algorithm if their difference is smaller than \code{eps}. This is -required to avoid the accumulation of numerical errors. By default it is -set to the smallest \eqn{x}, such that \eqn{1+x \ne 1}{1+x != 1} -holds. If you are running the algorithm with no weights, this argument +required to avoid the accumulation of numerical errors. The default +\code{NULL} stands for the smallest \eqn{x}, such that +\eqn{1+x \ne 1}{1+x != 1} holds (\code{.Machine$double.eps}). If you are running the algorithm with no weights, this argument is ignored.} } \value{ diff --git a/man/maximum.bipartite.matching.Rd b/man/maximum.bipartite.matching.Rd index ca6b06fa7a..ee95c7a307 100644 --- a/man/maximum.bipartite.matching.Rd +++ b/man/maximum.bipartite.matching.Rd @@ -27,9 +27,9 @@ much as possible.} \item{eps}{A small real number used in equality tests in the weighted bipartite matching algorithm. Two real numbers are considered equal in the algorithm if their difference is smaller than \code{eps}. This is -required to avoid the accumulation of numerical errors. By default it is -set to the smallest \eqn{x}, such that \eqn{1+x \ne 1}{1+x != 1} -holds. If you are running the algorithm with no weights, this argument +required to avoid the accumulation of numerical errors. The default +\code{NULL} stands for the smallest \eqn{x}, such that +\eqn{1+x \ne 1}{1+x != 1} holds (\code{.Machine$double.eps}). If you are running the algorithm with no weights, this argument is ignored.} } \description{ diff --git a/man/merge_coords.Rd b/man/merge_coords.Rd index 2d3d3e4a89..593289a8cc 100644 --- a/man/merge_coords.Rd +++ b/man/merge_coords.Rd @@ -7,7 +7,7 @@ \usage{ merge_coords(graphs, layouts, ..., method = "dla") -layout_components(graph, layout = layout_with_kk, ...) +layout_components(graph, layout = NULL, ...) } \arguments{ \item{graphs}{A list of graph objects.} @@ -22,7 +22,8 @@ function.} \item{graph}{The input graph.} -\item{layout}{A function object, the layout function to use.} +\item{layout}{A function object, the layout function to use. The default +\code{NULL} uses \code{layout_with_kk}.} } \value{ A matrix with two columns and as many lines as the total number of diff --git a/man/neighborhood.size.Rd b/man/neighborhood.size.Rd index f4d6722866..3264876a6f 100644 --- a/man/neighborhood.size.Rd +++ b/man/neighborhood.size.Rd @@ -18,7 +18,8 @@ neighborhood.size( \item{order}{Integer giving the order of the neighborhood. Negative values indicate an infinite order.} -\item{nodes}{The vertices for which the calculation is performed.} +\item{nodes}{The vertices for which the calculation is performed. +The default \code{NULL} selects all vertices.} \item{mode}{Character constant, it specifies how to use the direction of the edges if a directed graph is analyzed. For \sQuote{out} only the diff --git a/man/normalize.Rd b/man/normalize.Rd index 76a002ee70..c45f3047ca 100644 --- a/man/normalize.Rd +++ b/man/normalize.Rd @@ -7,18 +7,22 @@ normalize( xmin = -1, xmax = 1, - ymin = xmin, - ymax = xmax, - zmin = xmin, - zmax = xmax + ymin = NULL, + ymax = NULL, + zmin = NULL, + zmax = NULL ) } \arguments{ \item{xmin, xmax}{Minimum and maximum for x coordinates.} -\item{ymin, ymax}{Minimum and maximum for y coordinates.} +\item{ymin, ymax}{Minimum and maximum for y coordinates. When omitted, +they follow \code{xmin} and \code{xmax}; \code{NULL} disables normalization along +this axis.} -\item{zmin, zmax}{Minimum and maximum for z coordinates.} +\item{zmin, zmax}{Minimum and maximum for z coordinates. When omitted, +they follow \code{xmin} and \code{xmax}; \code{NULL} disables normalization along +this axis.} } \description{ Scale coordinates of a layout. diff --git a/man/page.rank.Rd b/man/page.rank.Rd index ad32dc1ed6..0c81f6fdfc 100644 --- a/man/page.rank.Rd +++ b/man/page.rank.Rd @@ -27,7 +27,8 @@ for all but small graphs. \code{"arpack"} uses the ARPACK library, the default implementation from igraph version 0.5 until version 0.7. It computes PageRank scores by solving an eingevalue problem.} -\item{vids}{The vertices of interest.} +\item{vids}{The vertices of interest. +The default \code{NULL} selects all vertices.} \item{directed}{Logical, if true directed paths will be considered for directed graphs. It is ignored for undirected graphs.} diff --git a/man/page_rank.Rd b/man/page_rank.Rd index d10c8c1c2d..58937b15df 100644 --- a/man/page_rank.Rd +++ b/man/page_rank.Rd @@ -8,7 +8,7 @@ page_rank( graph, ..., algo = c("prpack", "arpack"), - vids = V(graph), + vids = NULL, directed = TRUE, damping = 0.85, personalized = NULL, @@ -30,7 +30,8 @@ for all but small graphs. \code{"arpack"} uses the ARPACK library, the default implementation from igraph version 0.5 until version 0.7. It computes PageRank scores by solving an eingevalue problem.} -\item{vids}{The vertices of interest.} +\item{vids}{The vertices of interest. +The default \code{NULL} selects all vertices.} \item{directed}{Logical, if true directed paths will be considered for directed graphs. It is ignored for undirected graphs.} diff --git a/man/piecewise.layout.Rd b/man/piecewise.layout.Rd index 50ca54cc9e..71052f144a 100644 --- a/man/piecewise.layout.Rd +++ b/man/piecewise.layout.Rd @@ -9,7 +9,8 @@ piecewise.layout(graph, layout = layout_with_kk, ...) \arguments{ \item{graph}{The input graph.} -\item{layout}{A function object, the layout function to use.} +\item{layout}{A function object, the layout function to use. The default +\code{NULL} uses \code{layout_with_kk}.} \item{...}{Additional arguments to pass to the \code{layout} layout function.} diff --git a/man/plot.igraph.Rd b/man/plot.igraph.Rd index 71fc17e8e4..a2eb1a656b 100644 --- a/man/plot.igraph.Rd +++ b/man/plot.igraph.Rd @@ -12,9 +12,9 @@ xlim = NULL, ylim = NULL, mark.groups = list(), - mark.shape = 1/2, - mark.col = rainbow(length(mark.groups), alpha = 0.3), - mark.border = rainbow(length(mark.groups), alpha = 1), + mark.shape = 0.5, + mark.col = NULL, + mark.border = NULL, mark.expand = 15, mark.lwd = 1, loop.size = 1, @@ -48,11 +48,12 @@ used for the different vertex groups.} \item{mark.col}{A scalar or vector giving the colors of marking the polygons, in any format accepted by \code{\link[graphics:xspline]{graphics::xspline()}}; e.g. -numeric color IDs, symbolic color names, or colors in RGB.} +numeric color IDs, symbolic color names, or colors in RGB. The default +\code{NULL} uses semi-transparent rainbow colors.} \item{mark.border}{A scalar or vector giving the colors of the borders of the vertex group marking polygons. If it is \code{NA}, then no border is -drawn.} +drawn. The default \code{NULL} uses rainbow colors.} \item{mark.expand}{A numeric scalar or vector, the size of the border around the marked vertex groups. It is in the same units as the vertex sizes. If a diff --git a/man/plotHierarchy.Rd b/man/plotHierarchy.Rd index 9ed2994130..81fb79b068 100644 --- a/man/plotHierarchy.Rd +++ b/man/plotHierarchy.Rd @@ -12,8 +12,8 @@ plotHierarchy( } \arguments{ \item{layout}{The layout of a plot, it is simply passed on to -\code{plot.igraph()}, see the possible formats there. By default the -Reingold-Tilford layout generator is used.} +\code{plot.igraph()}, see the possible formats there. The default \code{NULL} uses +the Reingold-Tilford layout generator.} \item{...}{Additional arguments. \code{plot_hierarchy()} and \code{\link[=plot]{plot()}} pass them to \code{plot.igraph()}. \code{\link[=print]{print()}} and \code{\link[=summary]{summary()}} ignore them.} diff --git a/man/plot_dendrogram.communities.Rd b/man/plot_dendrogram.communities.Rd index 33a205c286..0b8bc7f9ff 100644 --- a/man/plot_dendrogram.communities.Rd +++ b/man/plot_dendrogram.communities.Rd @@ -5,11 +5,11 @@ \alias{plot_dendrogram.communities} \title{Community structure dendrogram plots} \usage{ -plot_dendrogram(x, mode = igraph_opt("dend.plot.type"), ...) +plot_dendrogram(x, mode = NULL, ...) \method{plot_dendrogram}{communities}( x, - mode = igraph_opt("dend.plot.type"), + mode = NULL, ..., use.modularity = FALSE, palette = categorical_pal(8) @@ -19,7 +19,8 @@ plot_dendrogram(x, mode = igraph_opt("dend.plot.type"), ...) \item{x}{An object containing the community structure of a graph. See \code{\link[=communities]{communities()}} for details.} -\item{mode}{Which dendrogram plotting function to use. See details below.} +\item{mode}{Which dendrogram plotting function to use. See details below. +The default \code{NULL} uses the \code{dend.plot.type} igraph option.} \item{\dots}{Additional arguments to supply to the dendrogram plotting function.} diff --git a/man/plot_dendrogram.igraphHRG.Rd b/man/plot_dendrogram.igraphHRG.Rd index fd00e13ada..caf346887d 100644 --- a/man/plot_dendrogram.igraphHRG.Rd +++ b/man/plot_dendrogram.igraphHRG.Rd @@ -4,13 +4,14 @@ \alias{plot_dendrogram.igraphHRG} \title{HRG dendrogram plot} \usage{ -\method{plot_dendrogram}{igraphHRG}(x, mode = igraph_opt("dend.plot.type"), ...) +\method{plot_dendrogram}{igraphHRG}(x, mode = NULL, ...) } \arguments{ \item{x}{An \code{igraphHRG}, a hierarchical random graph, as returned by the \code{\link[=fit_hrg]{fit_hrg()}} function.} -\item{mode}{Which dendrogram plotting function to use. See details below.} +\item{mode}{Which dendrogram plotting function to use. See details below. +The default \code{NULL} uses the \code{dend.plot.type} igraph option.} \item{\dots}{Additional arguments to supply to the dendrogram plotting function.} diff --git a/man/power_centrality.Rd b/man/power_centrality.Rd index 2549e592ea..a471df4bd1 100644 --- a/man/power_centrality.Rd +++ b/man/power_centrality.Rd @@ -6,7 +6,7 @@ \usage{ power_centrality( graph, - nodes = V(graph), + nodes = NULL, ..., loops = FALSE, exponent = 1, @@ -20,7 +20,7 @@ power_centrality( \item{graph}{the input graph.} \item{nodes}{vertex sequence indicating which vertices are to be included in -the calculation. By default, all vertices are included.} +the calculation. The default \code{NULL} selects all vertices.} \item{...}{These dots are for future extensions and must be empty.} diff --git a/man/preference.game.Rd b/man/preference.game.Rd index 736009aab8..d55dea8377 100644 --- a/man/preference.game.Rd +++ b/man/preference.game.Rd @@ -21,7 +21,8 @@ preference.game( \item{type.dist}{The distribution of the vertex types, a numeric vector of length \sQuote{types} containing non-negative numbers. The vector will be -normed to obtain probabilities.} +normed to obtain probabilities. The default \code{NULL} gives a uniform +distribution.} \item{fixed.sizes}{Fix the number of vertices with a given vertex type label. The \code{type.dist} argument gives the group sizes (i.e. number of @@ -29,7 +30,8 @@ vertices with the different labels) in this case.} \item{pref.matrix}{A square matrix giving the preferences of the vertex types. The matrix has \sQuote{types} rows and columns. When generating -an undirected graph, it must be symmetric.} +an undirected graph, it must be symmetric. The default \code{NULL} sets all +preferences to one.} \item{directed}{Logical, whether to create a directed graph.} diff --git a/man/print.igraph.Rd b/man/print.igraph.Rd index 2b34d4b130..0aa9e07f11 100644 --- a/man/print.igraph.Rd +++ b/man/print.igraph.Rd @@ -9,13 +9,13 @@ \usage{ \method{print}{igraph}( x, - full = igraph_opt("print.full"), - graph.attributes = igraph_opt("print.graph.attributes"), - vertex.attributes = igraph_opt("print.vertex.attributes"), - edge.attributes = igraph_opt("print.edge.attributes"), + full = NULL, + graph.attributes = NULL, + vertex.attributes = NULL, + edge.attributes = NULL, names = TRUE, - max.lines = igraph_opt("auto.print.lines"), - id = igraph_opt("print.id"), + max.lines = NULL, + id = NULL, ... ) @@ -25,22 +25,27 @@ \item{x}{The graph to print.} \item{full}{Logical, whether to print the graph structure itself as -well.} +well. The default \code{NULL} uses the \code{print.full} igraph option.} -\item{graph.attributes}{Logical, whether to print graph attributes.} +\item{graph.attributes}{Logical, whether to print graph attributes. The +default \code{NULL} uses the \code{print.graph.attributes} igraph option.} \item{vertex.attributes}{Logical, whether to print vertex -attributes.} +attributes. The default \code{NULL} uses the \code{print.vertex.attributes} igraph +option.} -\item{edge.attributes}{Logical, whether to print edge attributes.} +\item{edge.attributes}{Logical, whether to print edge attributes. The +default \code{NULL} uses the \code{print.edge.attributes} igraph option.} \item{names}{Logical, whether to print symbolic vertex names (i.e. the \code{name} vertex attribute) or vertex IDs.} \item{max.lines}{The maximum number of lines to use. The rest of the -output will be truncated.} +output will be truncated. If not given, the \code{auto.print.lines} igraph +option applies; \code{NULL} prints all lines.} -\item{id}{Whether to print the graph ID.} +\item{id}{Whether to print the graph ID. The default \code{NULL} uses the +\code{print.id} igraph option.} \item{\dots}{Additional agruments.} diff --git a/man/print.igraph.es.Rd b/man/print.igraph.es.Rd index b5d2dbe95f..5d3a9505ca 100644 --- a/man/print.igraph.es.Rd +++ b/man/print.igraph.es.Rd @@ -12,7 +12,8 @@ \item{full}{Whether to show the full sequence, or truncate the output to the screen size.} -\item{id}{Whether to print the graph ID.} +\item{id}{Whether to print the graph ID. The default \code{NULL} uses the +\code{print.id} igraph option.} \item{...}{Currently ignored.} } diff --git a/man/print.igraph.vs.Rd b/man/print.igraph.vs.Rd index 15342a5c9a..92504a5dcd 100644 --- a/man/print.igraph.vs.Rd +++ b/man/print.igraph.vs.Rd @@ -12,7 +12,8 @@ \item{full}{Whether to show the full sequence, or truncate the output to the screen size.} -\item{id}{Whether to print the graph ID.} +\item{id}{Whether to print the graph ID. The default \code{NULL} uses the +\code{print.id} igraph option.} \item{...}{These arguments are currently ignored.} } diff --git a/man/reverse_edges.Rd b/man/reverse_edges.Rd index 7ca28fec47..f4d0cd085f 100644 --- a/man/reverse_edges.Rd +++ b/man/reverse_edges.Rd @@ -5,14 +5,15 @@ \alias{t.igraph} \title{Reverse edges in a graph} \usage{ -reverse_edges(graph, eids = E(graph)) +reverse_edges(graph, eids = NULL) \method{t}{igraph}(x) } \arguments{ \item{graph}{The input graph.} -\item{eids}{The edge IDs of the edges to reverse.} +\item{eids}{The edge IDs of the edges to reverse. The default \code{NULL} +reverses all edges.} \item{x}{The input graph.} } diff --git a/man/sample_.Rd b/man/sample_.Rd index a7c4390887..13ea902286 100644 --- a/man/sample_.Rd +++ b/man/sample_.Rd @@ -31,7 +31,7 @@ to the newly created graphs. See the examples and the various constructor modifiers below. } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Operators.html#igraph_simplify}{\code{simplify()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_is_simple}{\code{is_simple()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Operators.html#igraph_simplify}{\code{simplify()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_is_simple}{\code{is_simple()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \examples{ diff --git a/man/sample_correlated_gnp.Rd b/man/sample_correlated_gnp.Rd index 0c119fe8f5..9c7e5c11f7 100644 --- a/man/sample_correlated_gnp.Rd +++ b/man/sample_correlated_gnp.Rd @@ -5,13 +5,7 @@ \title{Generate a new random graph from a given graph by randomly adding/removing edges} \usage{ -sample_correlated_gnp( - old.graph, - corr, - ..., - p = edge_density(old.graph), - permutation = NULL -) +sample_correlated_gnp(old.graph, corr, ..., p = NULL, permutation = NULL) } \arguments{ \item{old.graph}{The original graph.} @@ -23,8 +17,8 @@ graph (the adjacency matrix being used as a vector).} \item{...}{These dots are for future extensions and must be empty.} \item{p}{A numeric scalar, the probability of an edge between two -vertices, it must in the open (0,1) interval. The default is the empirical -edge density of the graph. If you are resampling an Erdős-Rényi graph and +vertices, it must in the open (0,1) interval. The default \code{NULL} uses the +empirical edge density of the graph. If you are resampling an Erdős-Rényi graph and you know the original edge probability of the Erdős-Rényi model, you should supply that explicitly.} diff --git a/man/sample_last_cit.Rd b/man/sample_last_cit.Rd index 03db1e4376..6f26215231 100644 --- a/man/sample_last_cit.Rd +++ b/man/sample_last_cit.Rd @@ -13,26 +13,19 @@ sample_last_cit( n, edges = 1, ..., - agebins = n/7100, - pref = (1:(agebins + 1))^-3, + agebins = NULL, + pref = NULL, directed = TRUE ) -last_cit( - n, - edges = 1, - ..., - agebins = n/7100, - pref = (1:(agebins + 1))^-3, - directed = TRUE -) +last_cit(n, edges = 1, ..., agebins = NULL, pref = NULL, directed = TRUE) sample_cit_types( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = rep(1, length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) @@ -40,9 +33,9 @@ sample_cit_types( cit_types( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = rep(1, length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) @@ -50,9 +43,9 @@ cit_types( sample_cit_cit_types( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = matrix(1, nrow = length(types), ncol = length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) @@ -60,9 +53,9 @@ sample_cit_cit_types( cit_cit_types( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = matrix(1, nrow = length(types), ncol = length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) @@ -74,16 +67,19 @@ cit_cit_types( \item{...}{These dots are for future extensions and must be empty.} -\item{agebins}{Number of aging bins.} +\item{agebins}{Number of aging bins. The default \code{NULL} uses \code{n / 7100}.} \item{pref}{Vector (\code{sample_last_cit()} and \code{sample_cit_types()} or matrix (\code{sample_cit_cit_types()}) giving the (unnormalized) citation -probabilities for the different vertex types.} +probabilities for the different vertex types. The default \code{NULL} uses +\code{(1:(agebins + 1))^-3} for \code{sample_last_cit()} and all-one probabilities +for the other two.} \item{directed}{Logical, whether to generate directed networks.} \item{types}{Vector of length \sQuote{\code{n}}, the types of the vertices. -Types are numbered from zero.} +Types are numbered from zero. The default \code{NULL} gives all vertices +type zero.} \item{attr}{Logical, whether to add the vertex types to the generated graph as a vertex attribute called \sQuote{\code{type}}.} diff --git a/man/sample_motifs.Rd b/man/sample_motifs.Rd index 266ca0665f..f2d2dedcba 100644 --- a/man/sample_motifs.Rd +++ b/man/sample_motifs.Rd @@ -8,7 +8,7 @@ sample_motifs( graph, size = 3, ..., - cut.prob = rep(0, size), + cut.prob = NULL, sample.size = NULL, sample = NULL ) diff --git a/man/sample_pref.Rd b/man/sample_pref.Rd index bb452c0351..35b69cbd0d 100644 --- a/man/sample_pref.Rd +++ b/man/sample_pref.Rd @@ -11,9 +11,9 @@ sample_pref( nodes, types, ..., - type.dist = rep(1, types), + type.dist = NULL, fixed.sizes = FALSE, - pref.matrix = matrix(1, types, types), + pref.matrix = NULL, directed = FALSE, loops = FALSE ) @@ -22,9 +22,9 @@ pref( nodes, types, ..., - type.dist = rep(1, types), + type.dist = NULL, fixed.sizes = FALSE, - pref.matrix = matrix(1, types, types), + pref.matrix = NULL, directed = FALSE, loops = FALSE ) @@ -33,8 +33,8 @@ sample_asym_pref( nodes, types, ..., - type.dist.matrix = matrix(1, types, types), - pref.matrix = matrix(1, types, types), + type.dist.matrix = NULL, + pref.matrix = NULL, loops = FALSE ) @@ -42,8 +42,8 @@ asym_pref( nodes, types, ..., - type.dist.matrix = matrix(1, types, types), - pref.matrix = matrix(1, types, types), + type.dist.matrix = NULL, + pref.matrix = NULL, loops = FALSE ) } @@ -56,7 +56,8 @@ asym_pref( \item{type.dist}{The distribution of the vertex types, a numeric vector of length \sQuote{types} containing non-negative numbers. The vector will be -normed to obtain probabilities.} +normed to obtain probabilities. The default \code{NULL} gives a uniform +distribution.} \item{fixed.sizes}{Fix the number of vertices with a given vertex type label. The \code{type.dist} argument gives the group sizes (i.e. number of @@ -64,14 +65,15 @@ vertices with the different labels) in this case.} \item{pref.matrix}{A square matrix giving the preferences of the vertex types. The matrix has \sQuote{types} rows and columns. When generating -an undirected graph, it must be symmetric.} +an undirected graph, it must be symmetric. The default \code{NULL} sets all +preferences to one.} \item{directed}{Logical, whether to create a directed graph.} \item{loops}{Logical, whether self-loops are allowed in the graph.} \item{type.dist.matrix}{The joint distribution of the in- and out-vertex -types.} +types. The default \code{NULL} gives a uniform distribution.} } \value{ An igraph graph. diff --git a/man/sample_traits_callaway.Rd b/man/sample_traits_callaway.Rd index b472c39185..29f831bc9b 100644 --- a/man/sample_traits_callaway.Rd +++ b/man/sample_traits_callaway.Rd @@ -12,8 +12,8 @@ sample_traits_callaway( types, ..., edge.per.step = 1, - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) @@ -22,8 +22,8 @@ traits_callaway( types, ..., edge.per.step = 1, - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) @@ -32,8 +32,8 @@ sample_traits( types, k = 1, ..., - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) @@ -42,8 +42,8 @@ traits( types, k = 1, ..., - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) } @@ -57,10 +57,11 @@ traits( \item{edge.per.step}{The number of edges to add to the graph per time step.} \item{type.dist}{The distribution of the vertex types. This is assumed to be -stationary in time.} +stationary in time. The default \code{NULL} gives a uniform distribution.} \item{pref.matrix}{A matrix giving the preferences of the given vertex -types. These should be probabilities, i.e. numbers between zero and one.} +types. These should be probabilities, i.e. numbers between zero and one. +The default \code{NULL} sets all preferences to one.} \item{directed}{Logical, whether to generate directed graphs.} diff --git a/man/set.edge.attribute.Rd b/man/set.edge.attribute.Rd index 71dd0b2101..d88601f71b 100644 --- a/man/set.edge.attribute.Rd +++ b/man/set.edge.attribute.Rd @@ -12,7 +12,7 @@ set.edge.attribute(graph, name, index = E(graph), value) \item{name}{The name of the attribute to set.} \item{index}{An optional edge sequence to set the attributes of -a subset of edges.} +a subset of edges. The default \code{NULL} selects all edges.} \item{value}{The new value of the attribute for all (or \code{index}) edges. diff --git a/man/set.vertex.attribute.Rd b/man/set.vertex.attribute.Rd index 98702f4fec..f24c2f3077 100644 --- a/man/set.vertex.attribute.Rd +++ b/man/set.vertex.attribute.Rd @@ -12,7 +12,7 @@ set.vertex.attribute(graph, name, index = V(graph), value) \item{name}{The name of the attribute to set.} \item{index}{An optional vertex sequence to set the attributes -of a subset of vertices.} +of a subset of vertices. The default \code{NULL} selects all vertices.} \item{value}{The new value of the attribute for all (or \code{index}) vertices. diff --git a/man/set_edge_attr.Rd b/man/set_edge_attr.Rd index 8b50ec8fbe..ab5dd24576 100644 --- a/man/set_edge_attr.Rd +++ b/man/set_edge_attr.Rd @@ -4,7 +4,7 @@ \alias{set_edge_attr} \title{Set edge attributes} \usage{ -set_edge_attr(graph, name, index = E(graph), value) +set_edge_attr(graph, name, index = NULL, value) } \arguments{ \item{graph}{The graph} @@ -12,7 +12,7 @@ set_edge_attr(graph, name, index = E(graph), value) \item{name}{The name of the attribute to set.} \item{index}{An optional edge sequence to set the attributes of -a subset of edges.} +a subset of edges. The default \code{NULL} selects all edges.} \item{value}{The new value of the attribute for all (or \code{index}) edges. diff --git a/man/set_vertex_attr.Rd b/man/set_vertex_attr.Rd index 025bb58193..5d315ad020 100644 --- a/man/set_vertex_attr.Rd +++ b/man/set_vertex_attr.Rd @@ -4,7 +4,7 @@ \alias{set_vertex_attr} \title{Set vertex attributes} \usage{ -set_vertex_attr(graph, name, index = V(graph), value) +set_vertex_attr(graph, name, index = NULL, value) } \arguments{ \item{graph}{The graph.} @@ -12,7 +12,7 @@ set_vertex_attr(graph, name, index = V(graph), value) \item{name}{The name of the attribute to set.} \item{index}{An optional vertex sequence to set the attributes -of a subset of vertices.} +of a subset of vertices. The default \code{NULL} selects all vertices.} \item{value}{The new value of the attribute for all (or \code{index}) vertices. diff --git a/man/set_vertex_attrs.Rd b/man/set_vertex_attrs.Rd index 61b81c8f25..ca504251f0 100644 --- a/man/set_vertex_attrs.Rd +++ b/man/set_vertex_attrs.Rd @@ -4,7 +4,7 @@ \alias{set_vertex_attrs} \title{Set multiple vertex attributes} \usage{ -set_vertex_attrs(graph, ..., index = V(graph)) +set_vertex_attrs(graph, ..., index = NULL) } \arguments{ \item{graph}{The graph.} @@ -12,7 +12,7 @@ set_vertex_attrs(graph, ..., index = V(graph)) \item{...}{<\code{\link[rlang:dyn-dots]{dynamic-dots}}> Named arguments, where the names are the attributes} \item{index}{An optional vertex sequence to set the attributes -of a subset of vertices.} +of a subset of vertices. The default \code{NULL} selects all vertices.} } \value{ The graph, with the vertex attributes added or set. diff --git a/man/shapes.Rd b/man/shapes.Rd index a06011fffe..6223055e10 100644 --- a/man/shapes.Rd +++ b/man/shapes.Rd @@ -14,13 +14,7 @@ shape_noclip(coords, el, params, end = c("both", "from", "to")) shape_noplot(coords, v = NULL, params) -add_shape( - shape, - ..., - clip = shape_noclip, - plot = shape_noplot, - parameters = list() -) +add_shape(shape, ..., clip = NULL, plot = NULL, parameters = list()) } \arguments{ \item{shape}{Character scalar, name of a vertex shape. If it is @@ -32,9 +26,11 @@ functions below.} \item{...}{These dots are for future extensions and must be empty.} -\item{clip}{An R function object, the clipping function.} +\item{clip}{An R function object, the clipping function. The default +\code{NULL} uses \code{shape_noclip}.} -\item{plot}{An R function object, the plotting function.} +\item{plot}{An R function object, the plotting function. The default +\code{NULL} uses \code{shape_noplot}.} \item{parameters}{Named list, additional plot/vertex/edge parameters. The element named define the new parameters, and the diff --git a/man/shortest.paths.Rd b/man/shortest.paths.Rd index 0fc77c7806..041f8de75b 100644 --- a/man/shortest.paths.Rd +++ b/man/shortest.paths.Rd @@ -17,10 +17,10 @@ shortest.paths( \item{graph}{The graph to work on.} \item{v}{Numeric vector, the vertices from which the shortest paths will be -calculated.} +calculated. The default \code{NULL} selects all vertices.} \item{to}{Numeric vector, the vertices to which the shortest paths will be -calculated. By default it includes all vertices. Note that for +calculated. The default \code{NULL} includes all vertices. Note that for \code{distances()} every vertex must be included here at most once. (This is not required for \code{shortest_paths()}.} diff --git a/man/similarity.Rd b/man/similarity.Rd index 2b254e0d5a..505e887ec6 100644 --- a/man/similarity.Rd +++ b/man/similarity.Rd @@ -6,7 +6,7 @@ \usage{ similarity( graph, - vids = V(graph), + vids = NULL, ..., mode = c("all", "out", "in", "total"), loops = FALSE, @@ -16,7 +16,8 @@ similarity( \arguments{ \item{graph}{The input graph.} -\item{vids}{The vertex IDs for which the similarity is calculated.} +\item{vids}{The vertex IDs for which the similarity is calculated. The +default \code{NULL} selects all vertices.} \item{...}{These dots are for future extensions and must be empty.} diff --git a/man/similarity.dice.Rd b/man/similarity.dice.Rd index d9616b8d86..eef1059ad7 100644 --- a/man/similarity.dice.Rd +++ b/man/similarity.dice.Rd @@ -14,7 +14,8 @@ similarity.dice( \arguments{ \item{graph}{The input graph.} -\item{vids}{The vertex IDs for which the similarity is calculated.} +\item{vids}{The vertex IDs for which the similarity is calculated. The +default \code{NULL} selects all vertices.} \item{mode}{The type of neighboring vertices to use for the calculation, possible values: \sQuote{\code{out}}, \sQuote{\verb{in}}, diff --git a/man/similarity.invlogweighted.Rd b/man/similarity.invlogweighted.Rd index 8f8dbdd2b7..8fbc142be0 100644 --- a/man/similarity.invlogweighted.Rd +++ b/man/similarity.invlogweighted.Rd @@ -13,7 +13,8 @@ similarity.invlogweighted( \arguments{ \item{graph}{The input graph.} -\item{vids}{The vertex IDs for which the similarity is calculated.} +\item{vids}{The vertex IDs for which the similarity is calculated. The +default \code{NULL} selects all vertices.} \item{mode}{The type of neighboring vertices to use for the calculation, possible values: \sQuote{\code{out}}, \sQuote{\verb{in}}, diff --git a/man/similarity.jaccard.Rd b/man/similarity.jaccard.Rd index 433fca4c62..f28b381f80 100644 --- a/man/similarity.jaccard.Rd +++ b/man/similarity.jaccard.Rd @@ -14,7 +14,8 @@ similarity.jaccard( \arguments{ \item{graph}{The input graph.} -\item{vids}{The vertex IDs for which the similarity is calculated.} +\item{vids}{The vertex IDs for which the similarity is calculated. The +default \code{NULL} selects all vertices.} \item{mode}{The type of neighboring vertices to use for the calculation, possible values: \sQuote{\code{out}}, \sQuote{\verb{in}}, diff --git a/man/simplify.Rd b/man/simplify.Rd index bf1643497a..91a279f97b 100644 --- a/man/simplify.Rd +++ b/man/simplify.Rd @@ -10,7 +10,7 @@ simplify( graph, remove.multiple = TRUE, remove.loops = TRUE, - edge.attr.comb = igraph_opt("edge.attr.comb") + edge.attr.comb = NULL ) is_simple(graph) @@ -28,7 +28,8 @@ removed.} \item{edge.attr.comb}{Specifies what to do with edge attributes, if \code{remove.multiple=TRUE}. In this case many edges might be mapped to a single one in the new graph, and their attributes are combined. Please see -\code{\link[=attribute.combination]{attribute.combination()}} for details on this.} +\code{\link[=attribute.combination]{attribute.combination()}} for details on this. The default \code{NULL} uses +the \code{edge.attr.comb} igraph option.} } \value{ a graph object with the loop and/or multiple edges removed; the diff --git a/man/stochastic_matrix.Rd b/man/stochastic_matrix.Rd index df24220d9d..3c1ad6b6e1 100644 --- a/man/stochastic_matrix.Rd +++ b/man/stochastic_matrix.Rd @@ -4,12 +4,7 @@ \alias{stochastic_matrix} \title{Stochastic matrix of a graph} \usage{ -stochastic_matrix( - graph, - ..., - column.wise = FALSE, - sparse = igraph_opt("sparsematrices") -) +stochastic_matrix(graph, ..., column.wise = FALSE, sparse = NULL) } \arguments{ \item{graph}{The input graph. Must be of class \code{igraph}.} @@ -20,7 +15,8 @@ stochastic_matrix( sum up to one; otherwise it is the columns.} \item{sparse}{Logical, whether to return a sparse matrix. The -\code{Matrix} package is needed for sparse matrices.} +\code{Matrix} package is needed for sparse matrices. The default \code{NULL} uses +the \code{sparsematrices} igraph option.} } \value{ A regular matrix or a matrix of class \code{Matrix} if a diff --git a/man/strength.Rd b/man/strength.Rd index 3dfd73932e..cf0e0765c5 100644 --- a/man/strength.Rd +++ b/man/strength.Rd @@ -6,7 +6,7 @@ \usage{ strength( graph, - vids = V(graph), + vids = NULL, ..., mode = c("all", "out", "in", "total"), loops = TRUE, @@ -16,7 +16,8 @@ strength( \arguments{ \item{graph}{The input graph.} -\item{vids}{The vertices for which the strength will be calculated.} +\item{vids}{The vertices for which the strength will be calculated. +The default \code{NULL} selects all vertices.} \item{...}{These dots are for future extensions and must be empty.} diff --git a/man/union.igraph.Rd b/man/union.igraph.Rd index 95aacbd76c..f75202bc1d 100644 --- a/man/union.igraph.Rd +++ b/man/union.igraph.Rd @@ -62,7 +62,7 @@ An error is generated if some input graphs are directed and others are undirected. } \section{Related documentation in the C library}{ -\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Isomorphism.html#igraph_permute_vertices}{\code{permute_vertices()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} +\href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Isomorphism.html#igraph_permute_vertices}{\code{permute_vertices()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}} } \examples{ diff --git a/man/vertex_attr-set.Rd b/man/vertex_attr-set.Rd index 56324443d7..817c5abfe5 100644 --- a/man/vertex_attr-set.Rd +++ b/man/vertex_attr-set.Rd @@ -5,7 +5,7 @@ \alias{vertex.attributes<-} \title{Set one or more vertex attributes} \usage{ -vertex_attr(graph, name, index = V(graph)) <- value +vertex_attr(graph, name, index = NULL) <- value } \arguments{ \item{graph}{The graph.} @@ -15,7 +15,7 @@ then \code{value} must be a named list, and its entries are set as vertex attributes.} \item{index}{An optional vertex sequence to set the attributes -of a subset of vertices.} +of a subset of vertices. The default \code{NULL} selects all vertices.} \item{value}{The new value of the attribute(s) for all (or \code{index}) vertices.} diff --git a/man/vertex_attr.Rd b/man/vertex_attr.Rd index ff6476e401..5a864092fe 100644 --- a/man/vertex_attr.Rd +++ b/man/vertex_attr.Rd @@ -5,7 +5,7 @@ \alias{vertex.attributes} \title{Query vertex attributes of a graph} \usage{ -vertex_attr(graph, name, index = V(graph)) +vertex_attr(graph, name, index = NULL) } \arguments{ \item{graph}{The graph.} @@ -14,7 +14,7 @@ vertex_attr(graph, name, index = V(graph)) all vertex attributes are returned in a list.} \item{index}{An optional vertex sequence to query the attribute only -for these vertices.} +for these vertices. The default \code{NULL} selects all vertices.} } \value{ The value of the vertex attribute, or the list of diff --git a/man/which_multiple.Rd b/man/which_multiple.Rd index 52f8c68739..a705616f7d 100644 --- a/man/which_multiple.Rd +++ b/man/which_multiple.Rd @@ -9,13 +9,13 @@ \alias{count_loops} \title{Find the multiple or loop edges in a graph} \usage{ -which_multiple(graph, eids = E(graph)) +which_multiple(graph, eids = NULL) any_multiple(graph) -count_multiple(graph, eids = E(graph)) +count_multiple(graph, eids = NULL) -which_loop(graph, eids = E(graph)) +which_loop(graph, eids = NULL) any_loop(graph) @@ -24,8 +24,8 @@ count_loops(graph) \arguments{ \item{graph}{The input graph.} -\item{eids}{The edges to which the query is restricted. By default this is -all edges in the graph.} +\item{eids}{The edges to which the query is restricted. The default +\code{NULL} selects all edges.} } \value{ \code{any_loop()} and \code{any_multiple()} return a Logical. diff --git a/man/which_mutual.Rd b/man/which_mutual.Rd index a576fe94c7..46346529c7 100644 --- a/man/which_mutual.Rd +++ b/man/which_mutual.Rd @@ -4,13 +4,13 @@ \alias{which_mutual} \title{Find mutual edges in a directed graph} \usage{ -which_mutual(graph, eids = E(graph), ..., loops = TRUE) +which_mutual(graph, eids = NULL, ..., loops = TRUE) } \arguments{ \item{graph}{The input graph.} -\item{eids}{Edge sequence, the edges that will be probed. By default is -includes all edges in the order of their IDs.} +\item{eids}{Edge sequence, the edges that will be probed. The default +\code{NULL} includes all edges in the order of their IDs.} \item{...}{These dots are for future extensions and must be empty.} diff --git a/tests/testthat/test-constant-defaults.R b/tests/testthat/test-constant-defaults.R new file mode 100644 index 0000000000..f8770f4eb4 --- /dev/null +++ b/tests/testthat/test-constant-defaults.R @@ -0,0 +1,110 @@ +# Migrated signatures carry only constant defaults; complex defaults are +# declared as `NULL` and resolved in the body after all arguments are +# available. These tests pin the user-visible semantics of that pattern. + +test_that("NULL selector defaults stand for the full vertex/edge set", { + g <- make_ring(5) + E(g)$weight <- seq_len(5) + + # Passing NULL explicitly is now the same as not passing the argument. + # (Before the constant-defaults cleanup an explicit NULL was coerced to an + # empty selection -- an accident of as_igraph_vs(), never documented.) + expect_identical(degree(g, v = NULL), degree(g)) + expect_identical(distances(g, v = NULL, to = NULL), distances(g)) + expect_identical(diversity(g, vids = NULL), diversity(g)) + expect_identical(which_mutual(g, eids = NULL), which_mutual(g)) + expect_identical(closeness(g, vids = NULL), closeness(g)) +}) + +test_that("NULL non-selector defaults resolve in the body", { + g <- make_ring(4) + + # sparse = NULL falls back to the sparsematrices option. + local_igraph_options(sparsematrices = TRUE) + expect_s4_class(as_adjacency_matrix(g), "dgCMatrix") + local_igraph_options(sparsematrices = FALSE) + expect_true(is.matrix(as_adjacency_matrix(g))) + + # eps = NULL falls back to the machine epsilon. + bip <- make_bipartite_graph(c(0, 1, 0, 1), c(1, 2, 3, 4)) + expect_identical(max_bipartite_match(bip)$matching_size, 2) +}) + +test_that("NULL selector defaults of round-2 functions select the full set", { + g <- make_ring(5) + + expect_identical(max_degree(g, v = NULL), max_degree(g)) + expect_identical(which_loop(g, eids = NULL), which_loop(g)) + expect_identical(which_multiple(g, eids = NULL), which_multiple(g)) + expect_identical(count_multiple(g, eids = NULL), count_multiple(g)) + expect_identical(count_triangles(g, vids = NULL), count_triangles(g)) + expect_identical(cocitation(g, v = NULL), cocitation(g)) + expect_identical(similarity(g, vids = NULL), similarity(g)) + expect_identical_graphs(reverse_edges(g, eids = NULL), reverse_edges(g)) + + V(g)$name <- letters[1:5] + expect_identical(vertex_attr(g, "name", index = NULL), vertex_attr(g, "name")) + expect_identical(vertex.attributes(g, index = NULL), vertex.attributes(g)) + g2 <- set_vertex_attr(g, "x", index = NULL, value = 1) + expect_identical(vertex_attr(g2, "x"), rep(1, 5)) +}) + +test_that("NULL non-selector defaults of round-2 functions resolve in the body", { + g <- make_ring(4) + + # option-backed defaults fall back to the igraph option + expect_identical_graphs( + simplify(g + edge(1, 2), edge.attr.comb = NULL), + simplify(g + edge(1, 2)) + ) + expect_identical_graphs( + as_undirected(as_directed(g), edge.attr.comb = NULL), + as_undirected(as_directed(g)) + ) + + # cross-referencing defaults resolve after all arguments are available + igraph_local_seed(42) + g1 <- sample_pref(20, types = 2, pref.matrix = NULL, type.dist = NULL) + igraph_local_seed(42) + g2 <- sample_pref(20, types = 2) + expect_identical_graphs(g1, g2) + + igraph_local_seed(1) + l1 <- layout_with_kk(g, kkconst = NULL, maxiter = NULL) + igraph_local_seed(1) + l2 <- layout_with_kk(g) + expect_identical(l1, l2) +}) + +test_that("empty-sequence defaults are spelled as typed empty vectors", { + # `c()` evaluates to NULL, so a `c()` default would collide with the + # resolve-in-body sentinel. Typed empties stay constant and disjoint from + # NULL: an explicit empty selection keeps meaning "nothing selected", + # while NULL now always means "use the default". + g <- make_graph(c(1, 2, 2, 2, 2, 3), directed = TRUE) + expect_equal(max_degree(g, v = integer()), 0) + expect_identical(which_loop(g, eids = integer()), logical(0)) + expect_gt(max_degree(g, v = NULL), 0) + + # layout_as_tree(): the typed empty stays the documented default + tree <- make_tree(5) + expect_identical( + layout_as_tree(tree, root = numeric()), + layout_as_tree(tree) + ) +}) + +test_that("positional recovery of a selector with a NULL default works", { + # Regression: with `vids = V(graph)` as the default, re-evaluating the + # default during recovery produced a fresh igraph.vs whose weakref `env` + # attribute never compares identical(), so the legacy positional call + # `diversity(g, weights, vids)` died with a spurious + # "supplied more than once" error. A constant NULL default is stable, so + # the recovery path works again. + g <- make_ring(5) + E(g)$weight <- seq_len(5) + lifecycle::expect_deprecated( + res <- diversity(g, NULL, V(g)[1:3]) + ) + expect_identical(res, diversity(g, weights = NULL, vids = V(g)[1:3])) +}) diff --git a/tests/testthat/test-generate-migrations.R b/tests/testthat/test-generate-migrations.R index 3798e3970e..e9ee4ffaac 100644 --- a/tests/testthat/test-generate-migrations.R +++ b/tests/testthat/test-generate-migrations.R @@ -140,19 +140,88 @@ test_that("render_call_arg() wraps a single long item without a stray comma", { }) test_that("default expressions keep air's spacing around binary `/`", { + # The constant-defaults rule keeps arithmetic like `n / 7100` out of real + # registries, but the renderer must stay air-clean for any deparsed + # expression, so exercise the helpers directly. + gen <- local_generator() + fmls <- formals(function(agebins = n / 7100, base = "http://a/b") {}) + expect_identical(gen$default_expr(fmls, "agebins"), "n / 7100") + # slashes inside string literals stay untouched + expect_identical(gen$default_expr(fmls, "base"), "\"http://a/b\"") +}) + +test_that("is_constant_default() classifies expressions", { + gen <- local_generator() + const <- alist( + NULL, + TRUE, + 1, + -1, + "out", + NA, + NA_character_, + Inf, + c("a", "b"), + c(1, -2.5), + list(), + (2), + deprecated(), + lifecycle::deprecated(), + # typed empty vectors: the canonical spelling of an empty sequence + logical(), + integer(), + numeric(), + double(), + complex(), + character(), + raw() + ) + for (e in const) { + expect_true(gen$is_constant_default(e), label = deparse(e)) + } + nonconst <- alist( + igraph_opt("sparsematrices"), + V(graph), + bins * 2, + new.env(), + stats::runif(1), + rep(0, 3), + sqrt(.Machine$double.eps), + .Machine$double.eps, + x, + T, + c(1, n), + # not empty constructors: sized or converting calls stay non-constant + numeric(2), + integer(n), + vector("numeric") + ) + for (e in nonconst) { + expect_false(gen$is_constant_default(e), label = deparse(e)) + } +}) + +test_that("non-constant defaults are rejected, with no escape hatch", { gen <- local_generator() entry <- list( - old = function(graph, agebins, base) {}, - new = function( - graph, - ..., - agebins = n / 7100, - base = "http://a/b" - ) {}, + old = function(graph, vids) {}, + new = function(graph, ..., vids = V(graph)) {}, when = "3.0.0" ) - norm <- gen$normalise_migration("fn_slash", entry) - expect_identical(norm$defaults$agebins, "n / 7100") - # slashes inside string literals stay untouched - expect_identical(norm$defaults$base, "\"http://a/b\"") + expect_error( + gen$normalise_migration("fn_nc", entry), + "non-constant default" + ) + + # the constant replacement passes + entry$new <- function(graph, ..., vids = NULL) {} + expect_silent(norm <- gen$normalise_migration("fn_nc", entry)) + expect_identical(norm$tail, "vids") + + # the retired grandfather field is called out explicitly + entry$nonconst_defaults <- "vids" + expect_error( + gen$normalise_migration("fn_nc", entry), + "not supported" + ) }) diff --git a/tests/testthat/test-structural-properties.R b/tests/testthat/test-structural-properties.R index b7768c9e90..6c4e575202 100644 --- a/tests/testthat/test-structural-properties.R +++ b/tests/testthat/test-structural-properties.R @@ -69,7 +69,8 @@ test_that("max_degree() works", { expect_equal(max_degree(g, loops = FALSE), 2) expect_equal(max_degree(g, mode = "out", loops = FALSE), 1) expect_equal(max_degree(g, mode = "in", loops = FALSE), 1) - expect_equal(max_degree(g, v = c()), 0) + expect_equal(max_degree(g, v = integer()), 0) + expect_equal(max_degree(g, v = NULL), max_degree(g)) expect_equal(max_degree(make_empty_graph()), 0) }) diff --git a/tools/generate-migrations.R b/tools/generate-migrations.R index c28bbfe615..96709c2a07 100644 --- a/tools/generate-migrations.R +++ b/tools/generate-migrations.R @@ -130,9 +130,111 @@ space_binary_slash <- function(text) { gsub("[ ]+/[ ]+", " / ", paste(chars, collapse = "")) } +# ---- constant-default rule -------------------------------------------------- +# +# Defaults in migrated (`new`) signatures must be *constant expressions*: +# literals, NULL/TRUE/FALSE/NA*/Inf/NaN, `c()`/`list()` of constants, a typed +# empty vector (`integer()`, `numeric()`, ...), a unary sign, or the +# `deprecated()` sentinel. Anything else -- option lookups, `V(graph)`, +# cross-references to other arguments, RNG draws, `rep()`, ... -- is evaluated +# lazily at an unpredictable time, invites forcing hazards in the recovery +# machinery, and hides the real default from the signature. There is no escape +# hatch: express a complex default as `NULL` and resolve it in the body after +# all arguments are available. + +is_constant_default <- function(expr) { + if (is.null(expr)) { + return(TRUE) + } + if (is.atomic(expr)) { + return(TRUE) + } + if (is.symbol(expr)) { + # TRUE/FALSE/NULL/NA/Inf/NaN parse as literals, not symbols; any symbol + # here references an argument or a global -- not constant. (T/F included.) + return(FALSE) + } + if (is.call(expr)) { + head <- expr[[1]] + if (is.call(head)) { + # namespaced sentinel: lifecycle::deprecated() + return( + length(expr) == 1L && + identical(head, quote(lifecycle::deprecated)) + ) + } + if (!is.symbol(head)) { + return(FALSE) + } + fn <- as.character(head) + if (fn %in% c("c", "list", "(")) { + args <- as.list(expr)[-1] + return(all(vapply(args, is_constant_default, logical(1)))) + } + empty_ctors <- c( + "logical", + "integer", + "numeric", + "double", + "complex", + "character", + "raw" + ) + if (fn %in% empty_ctors && length(expr) == 1L) { + # A typed empty vector is a literal: the canonical spelling of an + # empty-sequence default (`c()` would be NULL in disguise). + return(TRUE) + } + if (fn %in% c("+", "-") && length(expr) == 2L) { + return(is_constant_default(expr[[2]])) + } + if (fn == "deprecated" && length(expr) == 1L) { + return(TRUE) + } + return(FALSE) + } + FALSE +} + +check_constant_defaults <- function(fn, new_fmls) { + flagged <- character(0) + for (nm in names(new_fmls)) { + if (nm == "...") { + next + } + if (!nzchar(default_expr(new_fmls, nm))) { + next + } # no default + if (!is_constant_default(new_fmls[[nm]])) { + flagged <- c(flagged, nm) + } + } + if (length(flagged)) { + stop( + "Migration `", + fn, + "`: non-constant default(s) for ", + paste0("`", flagged, "`", collapse = ", "), + ".\nDeclare the formal as `NULL` and resolve it in the body after all\n", + "arguments are available (see tools/migrations/README.md).", + call. = FALSE + ) + } + invisible(TRUE) +} + # Turn one registry entry (with `old`/`new` as function objects) into the flat # structure the renderer consumes. normalise_migration <- function(fn, entry) { + if (!is.null(entry$nonconst_defaults)) { + stop( + "Migration `", + fn, + "`: `nonconst_defaults` is not supported; defaults must be constant\n", + "expressions (declare the formal as `NULL` and resolve it in the body).", + call. = FALSE + ) + } for (field in c("old", "new")) { if (!is.function(entry[[field]])) { stop( @@ -150,6 +252,7 @@ normalise_migration <- function(fn, entry) { old_fmls <- formals(entry$old) new_fmls <- formals(entry$new) + check_constant_defaults(fn, new_fmls) entry$old <- names(old_fmls) entry$new <- names(new_fmls) diff --git a/tools/migrations/README.md b/tools/migrations/README.md index cba13e02c6..2c42465154 100644 --- a/tools/migrations/README.md +++ b/tools/migrations/README.md @@ -17,6 +17,39 @@ Regenerate the spliced blocks after editing any registry file: Rscript tools/generate-migrations.R ``` +## Constant defaults + +Defaults in migrated (`new`) signatures must be **constant expressions**: +literals, `NULL`/`TRUE`/`FALSE`/`NA*`/`Inf`/`NaN`, +`c()`/`list()` of constants, +a typed empty vector (`integer()`, `numeric()`, ...), +a unary sign, +or the `deprecated()` sentinel. +An empty-sequence default must be spelled as a typed empty vector, +never as `c()`: +`c()` evaluates to `NULL`, +and `NULL` is reserved as the resolve-in-body sentinel. +Anything else -- option lookups, `V(graph)`, +references to other arguments, RNG draws -- +is evaluated lazily at an unpredictable time, +invites forcing hazards in the recovery machinery, +and hides the real default from the signature. +The generator stops with an error on any non-constant default; +there is no escape hatch. +Express a complex default as `NULL` +and resolve it in the body +after all arguments are available: + +```r +some_fun <- function(graph, ..., vids = NULL) { + # (generated ARG_HANDLE block) + if (is.null(vids)) { + vids <- V(graph) + } + ... +} +``` + ## Entry schema Every registry file defines a `migrations` list named by function. diff --git a/tools/migrations/centrality.R b/tools/migrations/centrality.R index 45a7912fd1..4e6c02ac37 100644 --- a/tools/migrations/centrality.R +++ b/tools/migrations/centrality.R @@ -7,7 +7,7 @@ migrations <- list( old = function(graph, nodes, alpha, loops, exo, weights, tol, sparse) {}, new = function( graph, - nodes = V(graph), + nodes = NULL, ..., alpha = 1, loops = FALSE, @@ -23,7 +23,7 @@ migrations <- list( old = function(graph, v, directed, weights, normalized, cutoff) {}, new = function( graph, - v = V(graph), + v = NULL, ..., directed = TRUE, weights = NULL, @@ -37,7 +37,7 @@ migrations <- list( old = function(graph, vids, mode, weights, normalized, cutoff) {}, new = function( graph, - vids = V(graph), + vids = NULL, ..., mode = c("out", "in", "all", "total"), weights = NULL, @@ -53,7 +53,7 @@ migrations <- list( graph, ..., weights = NULL, - vids = V(graph) + vids = NULL ) {}, when = "3.0.0" ), @@ -62,7 +62,7 @@ migrations <- list( old = function(graph, e, directed, weights, cutoff) {}, new = function( graph, - e = E(graph), + e = NULL, ..., directed = TRUE, weights = NULL, @@ -75,7 +75,7 @@ migrations <- list( old = function(graph, vids, mode, weights, normalized, cutoff) {}, new = function( graph, - vids = V(graph), + vids = NULL, ..., mode = c("out", "in", "all", "total"), weights = NULL, @@ -100,7 +100,7 @@ migrations <- list( graph, ..., algo = c("prpack", "arpack"), - vids = V(graph), + vids = NULL, directed = TRUE, damping = 0.85, personalized = NULL, @@ -123,7 +123,7 @@ migrations <- list( ) {}, new = function( graph, - nodes = V(graph), + nodes = NULL, ..., loops = FALSE, exponent = 1, @@ -139,7 +139,7 @@ migrations <- list( old = function(graph, vids, mode, loops, weights) {}, new = function( graph, - vids = V(graph), + vids = NULL, ..., mode = c("all", "out", "in", "total"), loops = TRUE, diff --git a/tools/migrations/conversion.R b/tools/migrations/conversion.R index f70729ddca..05e9104015 100644 --- a/tools/migrations/conversion.R +++ b/tools/migrations/conversion.R @@ -16,7 +16,7 @@ migrations <- list( ..., weights = NULL, names = TRUE, - sparse = igraph_opt("sparsematrices"), + sparse = NULL, edges = deprecated(), attr = deprecated() ) {}, diff --git a/tools/migrations/games.R b/tools/migrations/games.R index fdbc774737..89d95e6fc1 100644 --- a/tools/migrations/games.R +++ b/tools/migrations/games.R @@ -9,8 +9,8 @@ migrations <- list( nodes, types, ..., - type.dist.matrix = matrix(1, types, types), - pref.matrix = matrix(1, types, types), + type.dist.matrix = NULL, + pref.matrix = NULL, loops = FALSE ) {}, when = "3.0.0" @@ -21,9 +21,9 @@ migrations <- list( new = function( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = matrix(1, nrow = length(types), ncol = length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) {}, @@ -35,9 +35,9 @@ migrations <- list( new = function( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = rep(1, length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) {}, @@ -96,8 +96,8 @@ migrations <- list( n, edges = 1, ..., - agebins = n / 7100, - pref = (1:(agebins + 1))^-3, + agebins = NULL, + pref = NULL, directed = TRUE ) {}, when = "3.0.0" @@ -183,9 +183,9 @@ migrations <- list( nodes, types, ..., - type.dist = rep(1, types), + type.dist = NULL, fixed.sizes = FALSE, - pref.matrix = matrix(1, types, types), + pref.matrix = NULL, directed = FALSE, loops = FALSE ) {}, @@ -198,8 +198,8 @@ migrations <- list( nodes, types, ..., - type.dist.matrix = matrix(1, types, types), - pref.matrix = matrix(1, types, types), + type.dist.matrix = NULL, + pref.matrix = NULL, loops = FALSE ) {}, when = "3.0.0" @@ -210,9 +210,9 @@ migrations <- list( new = function( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = matrix(1, nrow = length(types), ncol = length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) {}, @@ -224,9 +224,9 @@ migrations <- list( new = function( n, edges = 1, - types = rep(0, n), + types = NULL, ..., - pref = rep(1, length(types)), + pref = NULL, directed = TRUE, attr = TRUE ) {}, @@ -239,7 +239,7 @@ migrations <- list( old.graph, corr, ..., - p = edge_density(old.graph), + p = NULL, permutation = NULL ) {}, when = "3.0.0" @@ -375,8 +375,8 @@ migrations <- list( n, edges = 1, ..., - agebins = n / 7100, - pref = (1:(agebins + 1))^-3, + agebins = NULL, + pref = NULL, directed = TRUE ) {}, when = "3.0.0" @@ -466,9 +466,9 @@ migrations <- list( nodes, types, ..., - type.dist = rep(1, types), + type.dist = NULL, fixed.sizes = FALSE, - pref.matrix = matrix(1, types, types), + pref.matrix = NULL, directed = FALSE, loops = FALSE ) {}, @@ -509,8 +509,8 @@ migrations <- list( types, k = 1, ..., - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) {}, when = "3.0.0" @@ -530,8 +530,8 @@ migrations <- list( types, ..., edge.per.step = 1, - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) {}, when = "3.0.0" @@ -571,8 +571,8 @@ migrations <- list( types, k = 1, ..., - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) {}, when = "3.0.0" @@ -592,8 +592,8 @@ migrations <- list( types, ..., edge.per.step = 1, - type.dist = rep(1, types), - pref.matrix = matrix(1, types, types), + type.dist = NULL, + pref.matrix = NULL, directed = FALSE ) {}, when = "3.0.0" diff --git a/tools/migrations/hrg-embedding.R b/tools/migrations/hrg-embedding.R index 59ec37972c..6377eaceb7 100644 --- a/tools/migrations/hrg-embedding.R +++ b/tools/migrations/hrg-embedding.R @@ -12,8 +12,8 @@ migrations <- list( weights = NULL, which = c("lm", "la", "sa"), scaled = TRUE, - cvec = strength(graph, weights = weights) / (vcount(graph) - 1), - options = arpack_defaults() + cvec = NULL, + options = NULL ) {}, when = "3.0.0" ), @@ -28,7 +28,7 @@ migrations <- list( which = c("lm", "la", "sa"), type = c("default", "D-A", "DAD", "I-DAD", "OAP"), scaled = TRUE, - options = arpack_defaults() + options = NULL ) {}, when = "3.0.0" ), diff --git a/tools/migrations/layout.R b/tools/migrations/layout.R index 52e0df783c..b9ac4be525 100644 --- a/tools/migrations/layout.R +++ b/tools/migrations/layout.R @@ -21,7 +21,7 @@ migrations <- list( new = function( graph, ..., - center = V(graph)[1], + center = NULL, order = NULL ) {}, when = "3.0.0" @@ -81,13 +81,13 @@ migrations <- list( ..., coords = NULL, maxiter = 10, - fineiter = max(10, log2(vcount(graph))), + fineiter = NULL, cool.fact = 0.75, weight.node.dist = 1.0, weight.border = 0.0, - weight.edge.lengths = edge_density(graph) / 10, - weight.edge.crossings = 1.0 - sqrt(edge_density(graph)), - weight.node.edge.dist = 0.2 * (1 - edge_density(graph)) + weight.edge.lengths = NULL, + weight.edge.crossings = NULL, + weight.node.edge.dist = NULL ) {}, when = "3.0.0" ), @@ -98,8 +98,8 @@ migrations <- list( graph, ..., use.seed = FALSE, - seed = matrix(runif(vcount(graph) * 2), ncol = 2), - options = drl_defaults$default, + seed = NULL, + options = NULL, weights = NULL, dim = c(2, 3) ) {}, @@ -133,7 +133,7 @@ migrations <- list( coords = NULL, dim = c(2, 3), niter = 500, - start.temp = sqrt(vcount(graph)), + start.temp = NULL, grid = c("auto", "grid", "nogrid"), weights = NULL, minx = NULL, @@ -157,10 +157,10 @@ migrations <- list( graph, ..., coords = NULL, - maxiter = 40 * vcount(graph)^2, - temp.max = max(vcount(graph), 1), - temp.min = 1 / 10, - temp.init = sqrt(max(vcount(graph), 1)) + maxiter = NULL, + temp.max = NULL, + temp.min = 0.1, + temp.init = NULL ) {}, when = "3.0.0" ), @@ -216,9 +216,9 @@ migrations <- list( ..., coords = NULL, dim = c(2, 3), - maxiter = 50 * vcount(graph), + maxiter = NULL, epsilon = 0.0, - kkconst = max(vcount(graph), 1), + kkconst = NULL, weights = NULL, minx = NULL, maxx = NULL, @@ -250,11 +250,11 @@ migrations <- list( graph, ..., maxiter = 150, - maxdelta = vcount(graph), - area = vcount(graph)^2, + maxdelta = NULL, + area = NULL, coolexp = 1.5, - repulserad = area * vcount(graph), - cellsize = sqrt(sqrt(area)), + repulserad = NULL, + cellsize = NULL, root = NULL ) {}, when = "3.0.0" diff --git a/tools/migrations/misc.R b/tools/migrations/misc.R index 32bd22ca25..471d08a71a 100644 --- a/tools/migrations/misc.R +++ b/tools/migrations/misc.R @@ -68,7 +68,7 @@ migrations <- list( graph, ..., column.wise = FALSE, - sparse = igraph_opt("sparsematrices") + sparse = NULL ) {}, when = "3.0.0" ) diff --git a/tools/migrations/motifs-graphlets.R b/tools/migrations/motifs-graphlets.R index 21f26a2012..7bf83db155 100644 --- a/tools/migrations/motifs-graphlets.R +++ b/tools/migrations/motifs-graphlets.R @@ -21,7 +21,7 @@ migrations <- list( weights = NULL, cliques, niter = 1000, - Mu = rep(1, length(cliques)) + Mu = NULL ) {}, when = "3.0.0" ), @@ -66,7 +66,7 @@ migrations <- list( graph, size = 3, ..., - cut.prob = rep(0, size), + cut.prob = NULL, sample.size = NULL, sample = NULL ) {}, diff --git a/tools/migrations/operators.R b/tools/migrations/operators.R index 219b04a518..fb6ac480c2 100644 --- a/tools/migrations/operators.R +++ b/tools/migrations/operators.R @@ -27,7 +27,7 @@ migrations <- list( g2, ..., byname = "auto", - graph.attr.comb = igraph_opt("graph.attr.comb"), + graph.attr.comb = NULL, vertex.attr.comb = "rename", edge.attr.comb = "rename" ) {}, diff --git a/tools/migrations/plotting.R b/tools/migrations/plotting.R index 876a80666f..22036c7f6a 100644 --- a/tools/migrations/plotting.R +++ b/tools/migrations/plotting.R @@ -28,8 +28,8 @@ migrations <- list( new = function( shape, ..., - clip = shape_noclip, - plot = shape_noplot, + clip = NULL, + plot = NULL, parameters = list() ) {}, when = "3.0.0" diff --git a/tools/migrations/similarity-efficiency.R b/tools/migrations/similarity-efficiency.R index c6f1ad256a..1860778604 100644 --- a/tools/migrations/similarity-efficiency.R +++ b/tools/migrations/similarity-efficiency.R @@ -52,7 +52,7 @@ migrations <- list( old = function(graph, vids, weights, directed, mode) {}, new = function( graph, - vids = V(graph), + vids = NULL, ..., weights = NULL, directed = TRUE, @@ -65,7 +65,7 @@ migrations <- list( old = function(graph, vids, mode, loops, method) {}, new = function( graph, - vids = V(graph), + vids = NULL, ..., mode = c( "all", diff --git a/tools/migrations/structural-properties.R b/tools/migrations/structural-properties.R index 66294f7737..b7b781964f 100644 --- a/tools/migrations/structural-properties.R +++ b/tools/migrations/structural-properties.R @@ -41,7 +41,7 @@ migrations <- list( new = function( graph, from, - to = V(graph), + to = NULL, ..., mode = c("out", "in", "all", "total"), cutoff = -1 @@ -64,7 +64,7 @@ migrations <- list( new = function( graph, from, - to = V(graph), + to = NULL, ..., mode = c("out", "all", "in"), weights = NULL @@ -86,7 +86,7 @@ migrations <- list( old = function(graph, nodes, weights) {}, new = function( graph, - nodes = V(graph), + nodes = NULL, ..., weights = NULL ) {}, @@ -127,7 +127,7 @@ migrations <- list( old = function(graph, v, mode, loops, normalized) {}, new = function( graph, - v = V(graph), + v = NULL, ..., mode = c("all", "out", "in", "total"), loops = TRUE, @@ -152,8 +152,8 @@ migrations <- list( old = function(graph, v, to, mode, weights, algorithm) {}, new = function( graph, - v = V(graph), - to = V(graph), + v = NULL, + to = NULL, ..., mode = c("all", "out", "in"), weights = NULL, @@ -184,7 +184,7 @@ migrations <- list( new = function( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -197,7 +197,7 @@ migrations <- list( new = function( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -286,7 +286,7 @@ migrations <- list( old = function(graph, vids, mode, neighbor.degree.mode, weights) {}, new = function( graph, - vids = V(graph), + vids = NULL, ..., mode = c("all", "out", "in", "total"), neighbor.degree.mode = c("all", "out", "in", "total"), @@ -300,7 +300,7 @@ migrations <- list( new = function( graph, order = 1, - nodes = V(graph), + nodes = NULL, ..., mode = c("all", "out", "in"), mindist = 0 @@ -315,7 +315,7 @@ migrations <- list( types = NULL, ..., weights = NULL, - eps = .Machine$double.eps + eps = NULL ) {}, when = "3.0.0" ), @@ -369,7 +369,7 @@ migrations <- list( new = function( graph, from, - to = V(graph), + to = NULL, ..., mode = c("out", "all", "in"), weights = NULL, @@ -452,7 +452,7 @@ migrations <- list( old = function(graph, eids, loops) {}, new = function( graph, - eids = E(graph), + eids = NULL, ..., loops = TRUE ) {},