Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3072632
refactor: Rename `algo` to `algorithm` in `page_rank()`, `feedback_ar…
claude Aug 17, 2026
3ad95b8
refactor: Rename `nodes` to `n` in generators and `centr_*_tmax()` (#…
claude Aug 17, 2026
1a574c1
refactor: snake_case weights arguments in clique functions and `clust…
claude Aug 17, 2026
691dc3d
refactor: Rename normalization flags to `normalized` (#2788)
claude Aug 17, 2026
1733f27
refactor: Purge legacy alias formals via the migration registry (#2788)
claude Aug 17, 2026
c597e14
refactor: Rename vertex-selector arguments to `vertices` (#2788, #692)
claude Aug 17, 2026
d90f8d9
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Oct 15, 2026
2ae1a8c
refactor: Rename single-vertex arguments to `vertex`
schochastics Oct 15, 2026
6feb3c4
chore: Auto-update from GitHub Actions
schochastics Oct 15, 2026
b6ed9df
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 2, 2026
cf6cc32
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 2, 2026
d6d011e
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 2, 2026
8322415
docs: Refer to degree(vertices = ) in the package overview
schochastics Dec 2, 2026
1247c7e
test: Cover the remaining vertex-selector renames
schochastics Dec 2, 2026
b29c0b7
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 2, 2026
317ed88
Merge remote-tracking branch 'origin/main' into claude/issue-2788-sub…
schochastics Dec 2, 2026
1c1a31b
chore: Auto-update from GitHub Actions
schochastics Dec 2, 2026
d0a349e
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 2, 2026
ce42675
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 3, 2026
7f3c5d5
test: Update snapshot for the clearer migration messages
schochastics Dec 3, 2026
ac2ab72
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 3, 2026
f4aa92c
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 3, 2026
485439f
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 3, 2026
66844e5
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 3, 2026
70ad08f
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 3, 2026
5d0fba5
test: Keep the structural-properties snapshots in test order
schochastics Dec 3, 2026
05c63cb
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 3, 2026
e8649ce
refactor: Let the generator own the head renames
schochastics Dec 3, 2026
739e55c
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 3, 2026
638836a
chore: Regenerate the migration blocks
schochastics Dec 3, 2026
e95d7f8
Merge branch 'claude/issue-2788-subagents-faw1t1-5' into claude/issue…
schochastics Dec 3, 2026
0e9080e
Merge remote-tracking branch 'origin/claude/issue-2788-subagents-faw1…
schochastics Dec 3, 2026
858326b
Merge remote-tracking branch 'origin/claude/issue-2788-subagents-faw1…
schochastics Dec 3, 2026
cc3b511
Merge remote-tracking branch 'origin/claude/issue-2788-subagents-faw1…
schochastics Dec 3, 2026
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
464 changes: 372 additions & 92 deletions R/centrality.R

Large diffs are not rendered by default.

67 changes: 49 additions & 18 deletions R/cocitation.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,23 @@
#' both cite, `bibcoupling()` calculates this.
#'
#' `cocitation()` calculates the cocitation counts for the vertices in the
#' `v` argument and all vertices in the graph.
#' `vertices` argument and all vertices in the graph.
#'
#' `bibcoupling()` calculates the bibliographic coupling for vertices in
#' `v` and all vertices in the graph.
#' `vertices` and all vertices in the graph.
#'
#' Calculating the cocitation or bibliographic coupling for only one vertex
#' costs the same amount of computation as for all vertices. This might change
#' in the future.
#'
#' @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
#' @param vertices Vertex sequence or numeric vector, the vertex IDs for which
#' the cocitation or bibliographic coupling values we want to calculate. The
#' default `NULL` selects all vertices.
#' @return A numeric matrix with `length(v)` lines and
#' @param v `r lifecycle::badge("deprecated")` Use `vertices` instead.
#' @return A numeric matrix with `length(vertices)` lines and
#' `vcount(graph)` columns. Element `(i,j)` contains the cocitation
#' or bibliographic coupling for vertices `v[i]` and `j`.
#' or bibliographic coupling for vertices `vertices[i]` and `j`.
#' @author Gabor Csardi \email{csardi.gabor@@gmail.com}
#' @family cocitation
#' @export
Expand All @@ -53,37 +54,67 @@
#' cocitation(g)
#' bibcoupling(g)
#'
cocitation <- function(graph, v = NULL) {
if (is.null(v)) {
v <- V(graph)
cocitation <- function(graph, vertices = NULL, v = deprecated()) {
if (lifecycle::is_present(v)) {
if (!missing(vertices)) {
cli::cli_abort(c(
"Argument {.arg vertices} of {.fn cocitation} was supplied more than once.",
i = "It was also supplied via its legacy name {.arg v}."
))
}
lifecycle::deprecate_soft(
"3.0.0",
"cocitation(v = )",
"cocitation(vertices = )"
)
vertices <- v
}

if (is.null(vertices)) {
vertices <- V(graph)
}

res <- cocitation_impl(
graph = graph,
vids = v
vids = vertices
)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
v <- as_igraph_vs(graph, v)
rownames(res) <- vertex_attr(graph, "name", v)
vertices <- as_igraph_vs(graph, vertices)
rownames(res) <- vertex_attr(graph, "name", vertices)
colnames(res) <- vertex_attr(graph, "name")
}
res
}

#' @rdname cocitation
#' @export
bibcoupling <- function(graph, v = NULL) {
if (is.null(v)) {
v <- V(graph)
bibcoupling <- function(graph, vertices = NULL, v = deprecated()) {
if (lifecycle::is_present(v)) {
if (!missing(vertices)) {
cli::cli_abort(c(
"Argument {.arg vertices} of {.fn bibcoupling} was supplied more than once.",
i = "It was also supplied via its legacy name {.arg v}."
))
}
lifecycle::deprecate_soft(
"3.0.0",
"bibcoupling(v = )",
"bibcoupling(vertices = )"
)
vertices <- v
}

if (is.null(vertices)) {
vertices <- V(graph)
}

res <- bibcoupling_impl(
graph = graph,
vids = v
vids = vertices
)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
v <- as_igraph_vs(graph, v)
rownames(res) <- vertex_attr(graph, "name", v)
vertices <- as_igraph_vs(graph, vertices)
rownames(res) <- vertex_attr(graph, "name", vertices)
colnames(res) <- vertex_attr(graph, "name")
}
res
Expand Down
2 changes: 1 addition & 1 deletion R/cohesive.blocks.R
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ print.cohesiveBlocks <- function(x, ...) {
cs <- 3 +
2 +
nchar(length(x)) +
max(distances(hierarchy(x), mode = "out", v = 1)) * 3
max(distances(hierarchy(x), mode = "out", vertices = 1)) * 3

.plot <- function(b, ind = "") {
if (b != 1) {
Expand Down
63 changes: 54 additions & 9 deletions R/efficiency.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@
#' @param weights The edge weights. All edge weights must be non-negative;
#' 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.
#' @param vertices The vertex IDs of the vertices for which the calculation will be done.
#' Applies to the local efficiency calculation only. The default `NULL`
#' selects all vertices.
#' @param vids `r lifecycle::badge("deprecated")` Use `vertices` instead.
#' @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
Expand Down Expand Up @@ -128,15 +129,59 @@ global_efficiency <- function(
#' @export
local_efficiency <- function(
graph,
vids = NULL,
vertices = NULL,
...,
weights = NULL,
directed = TRUE,
mode = c("all", "out", "in", "total")
mode = c("all", "out", "in", "total"),
vids = deprecated()
) {
# BEGIN GENERATED ARG_HANDLE: local_efficiency, do not edit, see tools/generate-migrations.R
# fmt: skip
if (...length() > 0L) {
if (!base::missing(vids)) {
# Pre-3.0.0 signature: local_efficiency(graph, vids, weights, directed, mode)
.legacy_signature <- function(graph, vids, weights, directed, mode, ...) {
base::list(env = base::environment(), n_extra = ...length(), extra = base::as.character(base::names(base::substitute(...()))), recovered = base::c(
if (!base::missing(graph)) base::c(graph = "graph"),
if (!base::missing(vids)) base::c(vertices = "vids"),
if (!base::missing(weights)) base::c(weights = "weights"),
if (!base::missing(directed)) base::c(directed = "directed"),
if (!base::missing(mode)) base::c(mode = "mode")
))
}
.arg_call <- base::sys.call()
.arg_call[[1L]] <- .legacy_signature
.arg_handle <- base::eval(.arg_call, base::parent.frame())
.arg_extra <- .arg_handle$extra
if (.arg_handle$n_extra > base::sum(base::nzchar(.arg_extra))) cli::cli_abort("Too many arguments passed to {.fn local_efficiency}.")
.arg_explicit <- base::c("graph", "vertices", "weights", "directed", "mode", "vids")[base::pmatch(.arg_extra, base::c("graph", "vertices", "weights", "directed", "mode", "vids"), duplicates.ok = TRUE)]
if (base::anyNA(.arg_explicit)) cli::cli_abort("Unexpected argument passed to {.fn local_efficiency}: {.arg {(.arg_extra[base::is.na(.arg_explicit)])}}.")
.arg_recovered <- .arg_handle$recovered
.arg_names <- base::names(.arg_recovered)
.arg_conflict <- base::intersect(.arg_names, .arg_explicit)
if (base::length(.arg_conflict) > 0L) {
.arg_conflict <- .arg_conflict[[1L]]
.arg_via <- .arg_recovered[[.arg_conflict]]
cli::cli_abort(base::c("Argument {.arg {(.arg_conflict)}} of {.fn local_efficiency} was supplied more than once.", i = if (base::is.element(.arg_via, base::names(.arg_call))) "It was also supplied via its legacy name {.arg {(.arg_via)}}." else "It was also passed by position, as {.arg {(.arg_via)}} of the old signature."))
}
for (.arg_i in base::seq_along(.arg_recovered)) base::do.call(base::delayedAssign, base::list(.arg_names[[.arg_i]], base::call("[[", .arg_handle$env, .arg_recovered[[.arg_i]]), base::baseenv(), base::environment()))
if (!base::missing(vids)) lifecycle::deprecate_soft("3.0.0", "local_efficiency(vids = )", "local_efficiency(vertices = )")
.arg_tail <- .arg_recovered[base::is.element(.arg_recovered, base::c("weights", "directed", "mode"))]
.arg_tail <- .arg_tail[!base::is.element(.arg_tail, base::names(.arg_call)) | base::names(.arg_tail) != .arg_tail]
if (base::length(.arg_tail) > 0L) {
.arg_shown <- base::ifelse(base::is.element(.arg_tail, base::names(.arg_call)), base::paste0(.arg_tail, " = "), .arg_tail)
lifecycle::deprecate_soft(
"3.0.0",
what = base::I("Calling `local_efficiency()` with positional, abbreviated or renamed arguments"),
details = base::c(
i = base::paste0("Detected call: local_efficiency(", base::paste(base::c("graph", "vertices", .arg_shown), collapse = ", "), ")"),
i = base::paste0("Use instead: local_efficiency(", base::paste(base::c("graph", "vertices", base::paste0(base::names(.arg_tail), " = ")), collapse = ", "), ")")
)
)
}
} else if (...length() > 0L) {
.arg_forbidden <- base::intersect(base::names(base::sys.call()), base::c("v"))
if (base::length(.arg_forbidden) > 0L) cli::cli_abort(base::c("Argument {.arg {(.arg_forbidden)}} matches multiple formal arguments of {.fn local_efficiency}.", i = "Spell out the full argument name."))
# Pre-3.0.0 signature: local_efficiency(graph, vids, weights, directed, mode)
.old_signature <- function(weights, directed, mode, ...) {
if (...length() > 0L) {
Expand Down Expand Up @@ -170,21 +215,21 @@ local_efficiency <- function(
"3.0.0",
what = base::I("Calling `local_efficiency()` with positional or abbreviated arguments"),
details = base::c(
i = base::paste0("Detected call: local_efficiency(", base::paste(base::c("graph", "vids", .arg_shown), collapse = ", "), ")"),
i = base::paste0("Use instead: local_efficiency(", base::paste(base::c("graph", "vids", base::paste0(.arg_names, " = ")), collapse = ", "), ")")
i = base::paste0("Detected call: local_efficiency(", base::paste(base::c("graph", "vertices", .arg_shown), collapse = ", "), ")"),
i = base::paste0("Use instead: local_efficiency(", base::paste(base::c("graph", "vertices", base::paste0(.arg_names, " = ")), collapse = ", "), ")")
)
)
}
}
# END GENERATED ARG_HANDLE

if (is.null(vids)) {
vids <- V(graph)
if (is.null(vertices)) {
vertices <- V(graph)
}

local_efficiency_impl(
graph = graph,
vids = vids,
vids = vertices,
weights = weights,
directed = directed,
mode = mode
Expand Down
2 changes: 1 addition & 1 deletion R/igraph-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ NULL
#' is the \sQuote{name} attribute. This is used for printing the graph
#' instead of the numerical IDs, if it exists. Vertex names can also be
#' used to specify a vector or set of vertices, in all igraph
#' functions. E.g. [degree()] has a `v` argument
#' functions. E.g. [degree()] has a `vertices` argument
#' that gives the vertices for which the degree is calculated. This
#' argument can be given as a character vector of vertex names.
#'
Expand Down
4 changes: 2 additions & 2 deletions R/indexing.R
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,9 @@ expand.grid.unordered <- function(i, j, loops = FALSE, directed = FALSE) {
if (missing(i) && missing(j)) {
todel <- seq_len(ecount(x))
} else if (missing(j)) {
todel <- unlist(incident_edges(x, v = i, mode = "out"))
todel <- unlist(incident_edges(x, vertices = i, mode = "out"))
} else if (missing(i)) {
todel <- unlist(incident_edges(x, v = j, mode = "in"))
todel <- unlist(incident_edges(x, vertices = j, mode = "in"))
} else {
edge_pairs <- expand.grid(i, j)
edge_ids <- get_edge_ids(x, c(rbind(edge_pairs[, 1], edge_pairs[, 2])))
Expand Down
Loading
Loading