-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: deprecate scale argument of centr_eigen() and centr_eigen_tmax()
#1625
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# centr_eigen_tmax() deprecated argument | ||
|
||
Code | ||
c <- centr_eigen_tmax(g, scale = FALSE) | ||
Condition | ||
Warning: | ||
The `scale` argument of `centr_eigen_tmax()` is deprecated as of igraph 2.1.3. | ||
i The function always behaves as if `scale` were TRUE. The argument will be removed in the future. | ||
|
||
# centr_eigen() deprecated argument | ||
|
||
Code | ||
c <- centr_eigen(g, scale = FALSE) | ||
Condition | ||
Warning: | ||
The `scale` argument of `centr_eigen()` is deprecated as of igraph 2.1.3. | ||
i The function always behaves as if `scale` were TRUE. The argument will be removed in the future. | ||
|
||
# centr_degree_tmax() deprecated argument | ||
|
||
Code | ||
c <- centr_degree_tmax(g) | ||
Condition | ||
Warning: | ||
The `loops` argument of `centr_degree_tmax()` must be explicit as of igraph 2.0.0. | ||
i Default value (`FALSE`) will be dropped in next release, add an explicit value for the loops argument. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
test_that("centr_eigen_tmax() works", { | ||
withr::local_seed(42) | ||
g <- sample_pa(1000, m = 4) | ||
expect_equal(centr_eigen_tmax(g), 998) | ||
}) | ||
|
||
test_that("centr_eigen_tmax() deprecated argument", { | ||
g <- sample_pa(1000, m = 4) | ||
expect_snapshot(c <- centr_eigen_tmax(g, scale = FALSE)) | ||
}) | ||
|
||
test_that("centr_eigen() works", { | ||
withr::local_seed(42) | ||
g <- sample_pa(1000, m = 4) | ||
centr_eigen <- centr_eigen(g) | ||
expect_setequal( | ||
names(centr_eigen), | ||
c("vector", "value", "options", "centralization", "theoretical_max") | ||
) | ||
expect_equal(centr_eigen$centralization, 0.9432924, tolerance = 1e-06) | ||
}) | ||
|
||
test_that("centr_eigen() deprecated argument", { | ||
g <- sample_pa(1000, m = 4) | ||
expect_snapshot(c <- centr_eigen(g, scale = FALSE)) | ||
}) | ||
|
||
test_that("centr_degree_tmax() works", { | ||
withr::local_seed(42) | ||
g <- sample_pa(1000, m = 4) | ||
expect_gt(centr_degree_tmax(g, loops = TRUE), 1990000) | ||
}) | ||
|
||
test_that("centr_degree_tmax() deprecated argument", { | ||
g <- sample_pa(1000, m = 4) | ||
expect_snapshot(c <- centr_degree_tmax(g)) | ||
}) | ||
|
||
test_that("centr_betw() works", { | ||
withr::local_seed(42) | ||
g <- sample_pa(1000, m = 4) | ||
expect_setequal( | ||
names(centr_betw(g)), | ||
c("res", "centralization", "theoretical_max") | ||
) | ||
expect_equal(centr_betw(g)$theoretical_max, 996004998) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually wonder why an explicit value is needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no reasonable default. The user should be forced to make a decision. The decision can only be made based on an understanding of where the network came from—it can't be deduced by looking at the network structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooooh I understand now. I think the current message is slightly misleading: I thought support for TRUE was getting dropped, not support for not choosing. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But now that I know what it means I am not sure how to rephrase the message.