Skip to content
Merged
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
24 changes: 19 additions & 5 deletions R/centrality.R
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,8 @@ eigen_defaults <- function() {
#' @param graph Graph to be analyzed.
#' @param directed Logical scalar, whether to consider direction of the edges
#' in directed graphs. It is ignored for undirected graphs.
#' @param scale Logical scalar, whether to scale the result to have a maximum
#' score of one. If no scaling is used then the result vector has unit length
#' in the Euclidean norm.
#' @param scale `r lifecycle::badge("deprecated")` Normalization will always take
#' place.
#' @param weights A numerical vector or `NULL`. This argument can be used
#' to give edge weights for calculating the weighted eigenvector centrality of
#' vertices. If this is `NULL` and the graph has a `weight` edge
Expand Down Expand Up @@ -990,7 +989,7 @@ eigen_defaults <- function() {
#' @cdocs igraph_eigenvector_centrality
eigen_centrality <- function(graph,
directed = FALSE,
scale = TRUE,
scale = deprecated(),
weights = NULL,
options = arpack_defaults()) {

Expand All @@ -1003,9 +1002,24 @@ eigen_centrality <- function(graph,
options <- options()
}

if (lifecycle::is_present(scale)) {
if (isTRUE(scale)) {
lifecycle::deprecate_soft(
"2.1.1",
"eigen_centrality(scale)",
details = "eigen_centrality() will always behave as if scale=TRUE were used."
)
} else {
lifecycle::deprecate_warn(
"2.1.1",
"eigen_centrality(scale = 'always as if TRUE')",
details = "Normalization is always performed")
}
}

eigenvector_centrality_impl(graph = graph,
directed = directed,
scale = scale,
scale = TRUE,
weights = weights,
options = options)
}
Expand Down
7 changes: 3 additions & 4 deletions man/eigen_centrality.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions man/evcent.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

156 changes: 156 additions & 0 deletions tests/testthat/_snaps/centrality.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,159 @@
i Please use `arpack_defaults()` instead.
i So the function arpack_defaults(), not an object called arpack_defaults.

# eigen_centrality() deprecated scale argument

Code
eigen_centrality(g, scale = TRUE)
Condition
Warning:
The `scale` argument of `eigen_centrality()` is deprecated as of igraph 2.1.1.
i eigen_centrality() will always behave as if scale=TRUE were used.
Output
$vector
[1] 1 1 1 1 1 1 1 1 1 1

$value
[1] 2

$options
$options$bmat
[1] "I"

$options$n
[1] 10

$options$which
[1] "LA"

$options$nev
[1] 1

$options$tol
[1] 0

$options$ncv
[1] 0

$options$ldv
[1] 0

$options$ishift
[1] 1

$options$maxiter
[1] 3000

$options$nb
[1] 1

$options$mode
[1] 1

$options$start
[1] 1

$options$sigma
[1] 0

$options$sigmai
[1] 0

$options$info
[1] 0

$options$iter
[1] 1

$options$nconv
[1] 1

$options$numop
[1] 7

$options$numopb
[1] 0

$options$numreo
[1] 5



---

Code
eigen_centrality(g, scale = FALSE)
Condition
Warning:
The `scale` argument of `eigen_centrality()` always as if TRUE as of igraph 2.1.1.
i Normalization is always performed
Output
$vector
[1] 1 1 1 1 1 1 1 1 1 1

$value
[1] 2

$options
$options$bmat
[1] "I"

$options$n
[1] 10

$options$which
[1] "LA"

$options$nev
[1] 1

$options$tol
[1] 0

$options$ncv
[1] 0

$options$ldv
[1] 0

$options$ishift
[1] 1

$options$maxiter
[1] 3000

$options$nb
[1] 1

$options$mode
[1] 1

$options$start
[1] 1

$options$sigma
[1] 0

$options$sigmai
[1] 0

$options$info
[1] 0

$options$iter
[1] 1

$options$nconv
[1] 1

$options$numop
[1] 7

$options$numopb
[1] 0

$options$numreo
[1] 6



70 changes: 0 additions & 70 deletions tests/testthat/test-alpha.centrality.R

This file was deleted.

Loading