Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions R/aaa-cliques.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ cliques_callback_closure_impl <- function(
rlang::error_cnd(message = "Callback returned a value different from TRUE or FALSE")
}
},
error = function(e) e,
interrupt = function(e) e
error = \(e) e,
interrupt = \(e) e
)
}
} else {
Expand Down Expand Up @@ -192,8 +192,8 @@ maximal_cliques_callback_closure_impl <- function(
rlang::error_cnd(message = "Callback returned a value different from TRUE or FALSE")
}
},
error = function(e) e,
interrupt = function(e) e
error = \(e) e,
interrupt = \(e) e
)
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/aaa-community.R
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ community_leading_eigenvector_callback_closure_impl <- function(
rlang::error_cnd(message = "Callback returned a value different from TRUE or FALSE")
}
},
error = function(e) e,
interrupt = function(e) e
error = \(e) e,
interrupt = \(e) e
)
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/aaa-cycles.R
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ simple_cycles_callback_closure_impl <- function(
rlang::error_cnd(message = "Callback returned a value different from TRUE or FALSE")
}
},
error = function(e) e,
interrupt = function(e) e
error = \(e) e,
interrupt = \(e) e
)
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/aaa-games.R
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ hsbm_list_game_impl <- function(
if (!is.list(Clist)) {
cli::cli_abort("{.arg Clist} must be a list of matrices")
}
Clist <- lapply(Clist, function(m) {
Clist <- lapply(Clist, \(m) {
if (!is.matrix(m)) {
cli::cli_abort("{.arg Clist} must be a list of matrices")
}
Expand Down
2 changes: 1 addition & 1 deletion R/aaa-generators.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ adjlist_impl <- function(
duplicate = TRUE
) {
# Argument checks
adjlist <- lapply(adjlist, function(x) as.numeric(x) - 1)
adjlist <- lapply(adjlist, \(x) as.numeric(x) - 1)
mode <- switch_igraph_arg(
mode,
"out" = 1L,
Expand Down
2 changes: 1 addition & 1 deletion R/aaa-graphlets.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ graphlets_project_impl <- function(
R_igraph_graphlets_project,
graph,
weights,
if (!is.null(cliques)) lapply(cliques, function(.x) .x - 1),
if (!is.null(cliques)) lapply(cliques, \(.x) .x - 1),
Muc,
startMu,
niter
Expand Down
10 changes: 5 additions & 5 deletions R/aaa-isomorphism.R
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ subisomorphic_lad_impl <- function(
R_igraph_subisomorphic_lad,
pattern,
target,
if (!is.null(domains)) lapply(domains, function(.x) .x - 1),
if (!is.null(domains)) lapply(domains, \(.x) .x - 1),
induced,
time_limit
)
Expand Down Expand Up @@ -572,8 +572,8 @@ get_isomorphisms_vf2_callback_closure_impl <- function(
rlang::error_cnd(message = "Callback returned a value different from TRUE or FALSE")
}
},
error = function(e) e,
interrupt = function(e) e
error = \(e) e,
interrupt = \(e) e
)
}
} else {
Expand Down Expand Up @@ -730,8 +730,8 @@ get_subisomorphisms_vf2_callback_closure_impl <- function(
rlang::error_cnd(message = "Callback returned a value different from TRUE or FALSE")
}
},
error = function(e) e,
interrupt = function(e) e
error = \(e) e,
interrupt = \(e) e
)
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/aaa-layout.R
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ layout_merge_dla_impl <- function(
if (!is.list(graphs)) {
cli::cli_abort("{.arg graphs} must be a list of igraph objects")
}
graphs <- lapply(graphs, function(g) {
graphs <- lapply(graphs, \(g) {
if (!inherits(g, "igraph")) {
cli::cli_abort("{.arg graphs} must be a list of igraph objects")
}
Expand All @@ -313,7 +313,7 @@ layout_merge_dla_impl <- function(
if (!is.list(coords)) {
cli::cli_abort("{.arg coords} must be a list of matrices")
}
coords <- lapply(coords, function(m) {
coords <- lapply(coords, \(m) {
if (!is.matrix(m)) {
cli::cli_abort("{.arg coords} must be a list of matrices")
}
Expand Down
4 changes: 2 additions & 2 deletions R/aaa-motifs.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ motifs_randesu_callback_closure_impl <- function(
rlang::error_cnd(message = "Callback returned a value different from TRUE or FALSE")
}
},
error = function(e) e,
interrupt = function(e) e
error = \(e) e,
interrupt = \(e) e
)
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions R/aaa-operators.R
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ disjoint_union_many_impl <- function(
if (!is.list(graphs)) {
cli::cli_abort("{.arg graphs} must be a list of igraph objects")
}
graphs <- lapply(graphs, function(g) {
graphs <- lapply(graphs, \(g) {
if (!inherits(g, "igraph")) {
cli::cli_abort("{.arg graphs} must be a list of igraph objects")
}
Expand Down Expand Up @@ -450,7 +450,7 @@ intersection_many_impl <- function(
if (!is.list(graphs)) {
cli::cli_abort("{.arg graphs} must be a list of igraph objects")
}
graphs <- lapply(graphs, function(g) {
graphs <- lapply(graphs, \(g) {
if (!inherits(g, "igraph")) {
cli::cli_abort("{.arg graphs} must be a list of igraph objects")
}
Expand Down Expand Up @@ -512,7 +512,7 @@ union_many_impl <- function(
if (!is.list(graphs)) {
cli::cli_abort("{.arg graphs} must be a list of igraph objects")
}
graphs <- lapply(graphs, function(g) {
graphs <- lapply(graphs, \(g) {
if (!inherits(g, "igraph")) {
cli::cli_abort("{.arg graphs} must be a list of igraph objects")
}
Expand Down
4 changes: 2 additions & 2 deletions R/aaa-structural.R
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ local_scan_neighborhood_ecount_impl <- function(
R_igraph_local_scan_neighborhood_ecount,
graph,
weights,
if (!is.null(neighborhoods)) lapply(neighborhoods, function(.x) .x - 1)
if (!is.null(neighborhoods)) lapply(neighborhoods, \(.x) .x - 1)
)

res
Expand Down Expand Up @@ -1577,7 +1577,7 @@ local_scan_subset_ecount_impl <- function(
R_igraph_local_scan_subset_ecount,
graph,
weights,
if (!is.null(subsets)) lapply(subsets, function(.x) .x - 1)
if (!is.null(subsets)) lapply(subsets, \(.x) .x - 1)
)

res
Expand Down
12 changes: 6 additions & 6 deletions R/aaa-visitors.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ bfs_closure_impl <- function(
rlang::error_cnd(message = "Callback returned a value different from TRUE or FALSE")
}
},
error = function(e) e,
interrupt = function(e) e
error = \(e) e,
interrupt = \(e) e
)
}
} else {
Expand Down Expand Up @@ -156,8 +156,8 @@ dfs_closure_impl <- function(
rlang::error_cnd(message = "Callback returned a value different from TRUE or FALSE")
}
},
error = function(e) e,
interrupt = function(e) e
error = \(e) e,
interrupt = \(e) e
)
}
} else {
Expand All @@ -178,8 +178,8 @@ dfs_closure_impl <- function(
rlang::error_cnd(message = "Callback returned a value different from TRUE or FALSE")
}
},
error = function(e) e,
interrupt = function(e) e
error = \(e) e,
interrupt = \(e) e
)
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/attributes.R
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ igraph.i.attribute.combination <- function(comb, allow_rename = FALSE) {
}
comb <- as.list(comb)
if (
!all(sapply(comb, function(x) {
!all(sapply(comb, \(x) {
is.function(x) || (is.character(x) && length(x) == 1)
}))
) {
Expand Down Expand Up @@ -1356,7 +1356,7 @@ igraph.i.attribute.combination <- function(comb, allow_rename = FALSE) {
known_names <- c(known_names, "rename")
known_codes <- c(known_codes, NA_integer_)
}
comb <- lapply(comb, function(x) {
comb <- lapply(comb, \(x) {
if (!is.character(x)) {
x
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/centrality.R
Original file line number Diff line number Diff line change
Expand Up @@ -1136,9 +1136,9 @@ arpack <- function(
res$vectors <- rew$vectors
res$values <- rew$values

res$values <- apply(res$values, 1, function(x) x[1] + x[2] * 1i)
res$values <- apply(res$values, 1, \(x) x[1] + x[2] * 1i)
dim(res$vectors) <- c(nrow(res$vectors) * 2, ncol(res$vectors) / 2)
res$vectors <- apply(res$vectors, 2, function(x) {
res$vectors <- apply(res$vectors, 2, \(x) {
l <- length(x) / 2
x[1:l] + x[(l + 1):length(x)] * 1i
})
Expand Down
2 changes: 1 addition & 1 deletion R/cliques.R
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ max_cliques <- function(
as.numeric(min %||% 0),
as.numeric(max %||% 0)
)
res <- lapply(res, function(x) x + 1)
res <- lapply(res, \(x) x + 1)

if (igraph_opt("return.vs.es")) {
res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph))
Expand Down
2 changes: 1 addition & 1 deletion R/community.R
Original file line number Diff line number Diff line change
Expand Up @@ -3583,7 +3583,7 @@ groups.default <- function(x) {
if (is.null(vids)) {
vids <- seq_along(x$membership)
}
tapply(vids, x$membership, simplify = FALSE, function(x) x)
tapply(vids, x$membership, simplify = FALSE, \(x) x)
}

#' @method groups communities
Expand Down
10 changes: 5 additions & 5 deletions R/console.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,24 +201,24 @@ console <- function() {
scr <- tcltk::tkscrollbar(
console,
repeatinterval = 5,
command = function(...) tcltk::tkyview(txt, ...)
command = \(...) tcltk::tkyview(txt, ...)
)
txt <- tcltk::tktext(
console,
yscrollcommand = function(...) tcltk::tkset(scr, ...),
yscrollcommand = \(...) tcltk::tkset(scr, ...),
width = 60,
height = 7,
font = fn
)
tcltk::tkconfigure(txt, state = "disabled")
pbar <- .igraph.progress.tkconsole.pbar(console)

bclear <- tcltk::tkbutton(lfr, text = "Clear", command = function() {
bclear <- tcltk::tkbutton(lfr, text = "Clear", command = \() {
tcltk::tkconfigure(txt, state = "normal")
tcltk::tkdelete(txt, "0.0", "end")
tcltk::tkconfigure(txt, state = "disabled")
})
bclose <- tcltk::tkbutton(lfr, text = "Close", command = function() {
bclose <- tcltk::tkbutton(lfr, text = "Close", command = \() {
if (!is.na(oldverb) && igraph_opt("verbose") == "tkconsole") {
igraph_options(verbose = oldverb)
}
Expand All @@ -243,7 +243,7 @@ console <- function() {
tcltk::tkpack(scr, side = "right", fill = "y", expand = 0)
tcltk::tkpack(txt, side = "left", fill = "both", expand = 1)

tcltk::tkbind(console, "<Destroy>", function() {
tcltk::tkbind(console, "<Destroy>", \() {
if (!is.na(oldverb) && igraph_opt("verbose") == "tkconsole") {
igraph_options(verbose = oldverb)
}
Expand Down
8 changes: 4 additions & 4 deletions R/conversion.R
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ as_adj_edge_list <- function(

on.exit(.Call(Rx_igraph_finalizer))
res <- .Call(Rx_igraph_get_adjedgelist, graph, mode, loops)
res <- lapply(res, function(.x) E(graph)[.x + 1])
res <- lapply(res, \(.x) E(graph)[.x + 1])
if (is_named(graph)) {
names(res) <- V(graph)$name
}
Expand Down Expand Up @@ -1100,7 +1100,7 @@ graph_from_graphnel <- function(

al <- lapply(graph::edgeL(graphNEL), "[[", "edges")
if (graph::edgemode(graphNEL) == "undirected") {
al <- mapply(SIMPLIFY = FALSE, seq_along(al), al, FUN = function(n, l) {
al <- mapply(SIMPLIFY = FALSE, seq_along(al), al, FUN = \(n, l) {
c(l, rep(n, sum(l == n)))
})
}
Expand Down Expand Up @@ -1210,7 +1210,7 @@ as_graphnel <- function(graph) {
}
} else {
al <- as_adj_list(graph, mode = "out", loops = "once")
al <- lapply(al, function(x) list(edges = as.vector(x)))
al <- lapply(al, \(x) list(edges = as.vector(x)))
}

names(al) <- name
Expand Down Expand Up @@ -1248,7 +1248,7 @@ as_graphnel <- function(graph) {
for (n in e.n) {
graph::edgeDataDefaults(res, attr = n) <- NA
res@edgeData@data[el] <- mapply(
function(x, y) {
\(x, y) {
xx <- c(x, y)
names(xx)[length(xx)] <- n
xx
Expand Down
12 changes: 6 additions & 6 deletions R/epi.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ quantile.sir <- function(x, comp = c("NI", "NS", "NR"), prob, ...) {
sir <- x
comp <- toupper(igraph_match_arg(comp))
times <- unlist(sapply(sir, "[[", "times"))
big.N <- unlist(sapply(sir, function(x) {
big.N <- unlist(sapply(sir, \(x) {
x[[comp]]
}))
time.bin <- cut(times, time_bins(sir, middle = FALSE), include.lowest = TRUE)
res <- lapply(prob, function(pp) {
tapply(big.N, time.bin, function(x) {
res <- lapply(prob, \(pp) {
tapply(big.N, time.bin, \(x) {
quantile(x, prob = pp)
})
})
Expand Down Expand Up @@ -215,8 +215,8 @@ plot.sir <- function(
}
quantile_color <- rep(quantile_color, length.out = length(quantiles))

xlim <- xlim %||% c(0, max(sapply(sir, function(x) max(x$times))))
ylim <- ylim %||% c(0, max(sapply(sir, function(x) max(x[[comp]]))))
xlim <- xlim %||% c(0, max(sapply(sir, \(x) max(x$times))))
ylim <- ylim %||% c(0, max(sapply(sir, \(x) max(x[[comp]]))))

## Generate the plot, first with individual curves, and then
## adding median and quantile curves.
Expand Down Expand Up @@ -244,7 +244,7 @@ plot.sir <- function(
ylab = ylab,
...
)
lapply(seq_along(sir), function(i) {
lapply(seq_along(sir), \(i) {
lines(sir[[i]]$times, sir[[i]][[comp]], col = color[1])
})

Expand Down
2 changes: 1 addition & 1 deletion R/glet.R
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ graphlet_proj <- function(
#################
## Example code

function() {
\() {
library(igraph)

fitandplot <- function(g, gl) {
Expand Down
Loading
Loading