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/centrality.R
Original file line number Diff line number Diff line change
Expand Up @@ -1913,19 +1913,19 @@ bonpow.sparse <- function(
#' dir = FALSE
#' )
#' # Compute power centrality scores
#' for (e in seq(-0.5, .5, by = 0.1)) {
#' for (e in seq(-0.5, 0.5, by = 0.1)) {
#' print(round(power_centrality(g.c, exp = e)[c(1, 2, 4)], 2))
#' }
#'
#' for (e in seq(-0.4, .4, by = 0.1)) {
#' for (e in seq(-0.4, 0.4, by = 0.1)) {
#' print(round(power_centrality(g.d, exp = e)[c(1, 2, 5)], 2))
#' }
#'
#' for (e in seq(-0.4, .4, by = 0.1)) {
#' for (e in seq(-0.4, 0.4, by = 0.1)) {
#' print(round(power_centrality(g.e, exp = e)[c(1, 2, 5)], 2))
#' }
#'
#' for (e in seq(-0.4, .4, by = 0.1)) {
#' for (e in seq(-0.4, 0.4, by = 0.1)) {
#' print(round(power_centrality(g.f, exp = e)[c(1, 2, 5)], 2))
#' }
#'
Expand Down
10 changes: 5 additions & 5 deletions R/games.R
Original file line number Diff line number Diff line change
Expand Up @@ -2443,7 +2443,7 @@ cit_cit_types <- function(
#' sample_bipartite(10, 5, p = 1)
#'
#' ## random bipartite graph
#' sample_bipartite(10, 5, p = .1)
#' sample_bipartite(10, 5, p = 0.1)
#'
#' ## directed bipartite graph, G(n,m)
#' sample_bipartite(10, 5, type = "Gnm", m = 20, directed = TRUE, mode = "all")
Expand Down Expand Up @@ -2581,7 +2581,7 @@ bipartite_gnp <- function(
#' sample_bipartite_gnp(10, 5, p = 1)
#'
#' ## random bipartite graph
#' sample_bipartite_gnp(10, 5, p = .1)
#' sample_bipartite_gnp(10, 5, p = 0.1)
#'
#' ## directed bipartite graph, G(n,m)
#' sample_bipartite_gnm(10, 5, m = 20, directed = TRUE, mode = "all")
Expand Down Expand Up @@ -2673,7 +2673,7 @@ sample_bipartite_gnp <- function(
#' @examples
#'
#' ## Two groups with not only few connection between groups
#' pm <- cbind(c(.1, .001), c(.001, .05))
#' pm <- cbind(c(0.1, 0.001), c(0.001, 0.05))
#' g <- sample_sbm(1000, pref.matrix = pm, block.sizes = c(300, 700))
#' g
#' @family games
Expand Down Expand Up @@ -3412,7 +3412,7 @@ sample_forestfire <- function(
#' @family games
#' @export
#' @examples
#' g <- sample_gnp(1000, .1)
#' g <- sample_gnp(1000, 0.1)
#' g2 <- sample_correlated_gnp(g, corr = 0.5)
#' cor(as.vector(g[]), as.vector(g2[]))
#' g
Expand Down Expand Up @@ -3461,7 +3461,7 @@ sample_correlated_gnp <- function(
#' @export
#' @examples
#' gg <- sample_correlated_gnp_pair(
#' n = 10, corr = .8, p = .5,
#' n = 10, corr = 0.8, p = 0.5,
#' directed = FALSE
#' )
#' gg
Expand Down
4 changes: 2 additions & 2 deletions R/hrg.R
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ hrgPlotHclust <- function(
x,
rect = 0,
colbar = rainbow(rect),
hang = .01,
hang = 0.01,
ann = FALSE,
main = "",
sub = "",
Expand Down Expand Up @@ -819,7 +819,7 @@ hrgPlotDendrogram <- function(x, ...) {
#' @importFrom grDevices rainbow
hrgPlotPhylo <- function(
x,
colbar = rainbow(11, start = .7, end = .1),
colbar = rainbow(11, start = 0.7, end = 0.1),
edge.color = NULL,
use.edge.length = FALSE,
...
Expand Down
32 changes: 16 additions & 16 deletions R/layout.R
Original file line number Diff line number Diff line change
Expand Up @@ -2276,7 +2276,7 @@ with_mds <- function(...) layout_spec(layout_with_mds, ...)
#' ), 1, which))
#'
#' ## Simple plot, not very nice
#' par(mar = rep(.1, 4))
#' par(mar = rep(0.1, 4))
#' plot(DC, layout = lay1$layout, vertex.label.cex = 0.5)
#'
#' ## Sugiyama plot
Expand Down Expand Up @@ -2344,7 +2344,7 @@ with_mds <- function(...) layout_spec(layout_with_mds, ...)
#' realedge <- as_edgelist(layex$extd_graph)[, 2] <= vcount(ex)
#' plot(layex$extd_graph,
#' vertex.label.cex = 0.5,
#' edge.arrow.size = .5,
#' edge.arrow.size = 0.5,
#' vertex.size = ifelse(origvert, 5, 0),
#' vertex.shape = ifelse(origvert, "square", "none"),
#' vertex.label = ifelse(origvert, V(ex)$name, ""),
Expand Down Expand Up @@ -2923,14 +2923,14 @@ igraph.drl.default <- list(
cooldown.iterations = 200,
cooldown.temperature = 2000,
cooldown.attraction = 1,
cooldown.damping.mult = .1,
cooldown.damping.mult = 0.1,
crunch.iterations = 50,
crunch.temperature = 250,
crunch.attraction = 1,
crunch.damping.mult = 0.25,
simmer.iterations = 100,
simmer.temperature = 250,
simmer.attraction = .5,
simmer.attraction = 0.5,
simmer.damping.mult = 0
)

Expand All @@ -2953,14 +2953,14 @@ igraph.drl.coarsen <- list(
cooldown.iterations = 200,
cooldown.temperature = 2000,
cooldown.attraction = 1,
cooldown.damping.mult = .1,
cooldown.damping.mult = 0.1,
crunch.iterations = 50,
crunch.temperature = 250,
crunch.attraction = 1,
crunch.damping.mult = 0.25,
simmer.iterations = 100,
simmer.temperature = 250,
simmer.attraction = .5,
simmer.attraction = 0.5,
simmer.damping.mult = 0
)

Expand All @@ -2983,14 +2983,14 @@ igraph.drl.coarsest <- list(
cooldown.iterations = 200,
cooldown.temperature = 2000,
cooldown.attraction = 1,
cooldown.damping.mult = .1,
cooldown.damping.mult = 0.1,
crunch.iterations = 200,
crunch.temperature = 250,
crunch.attraction = 1,
crunch.damping.mult = 0.25,
simmer.iterations = 100,
simmer.temperature = 250,
simmer.attraction = .5,
simmer.attraction = 0.5,
simmer.damping.mult = 0
)

Expand All @@ -3000,27 +3000,27 @@ igraph.drl.refine <- list(
edge.cut = 32 / 40,
init.iterations = 0,
init.temperature = 50,
init.attraction = .5,
init.attraction = 0.5,
init.damping.mult = 1.0,
liquid.iterations = 0,
liquid.temperature = 2000,
liquid.attraction = 2,
liquid.damping.mult = 1.0,
expansion.iterations = 50,
expansion.temperature = 500,
expansion.attraction = .1,
expansion.damping.mult = .25,
expansion.attraction = 0.1,
expansion.damping.mult = 0.25,
cooldown.iterations = 50,
cooldown.temperature = 250,
cooldown.attraction = 1,
cooldown.damping.mult = .1,
cooldown.damping.mult = 0.1,
crunch.iterations = 50,
crunch.temperature = 250,
crunch.attraction = 1,
crunch.damping.mult = 0.25,
simmer.iterations = 0,
simmer.temperature = 250,
simmer.attraction = .5,
simmer.attraction = 0.5,
simmer.damping.mult = 0
)

Expand All @@ -3030,7 +3030,7 @@ igraph.drl.final <- list(
edge.cut = 32 / 40,
init.iterations = 0,
init.temperature = 50,
init.attraction = .5,
init.attraction = 0.5,
init.damping.mult = 0,
liquid.iterations = 0,
liquid.temperature = 2000,
Expand All @@ -3043,14 +3043,14 @@ igraph.drl.final <- list(
cooldown.iterations = 50,
cooldown.temperature = 200,
cooldown.attraction = 1,
cooldown.damping.mult = .1,
cooldown.damping.mult = 0.1,
crunch.iterations = 50,
crunch.temperature = 250,
crunch.attraction = 1,
crunch.damping.mult = 0.25,
simmer.iterations = 25,
simmer.temperature = 250,
simmer.attraction = .5,
simmer.attraction = 0.5,
simmer.damping.mult = 0
)

Expand Down
8 changes: 4 additions & 4 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,10 @@ plot.igraph <- function(
c(
x0,
y0,
x0 + .4 * loopSize,
y0 + narrowing * .2 * loopSize,
x0 + .4 * loopSize,
y0 - narrowing * .2 * loopSize,
x0 + 0.4 * loopSize,
y0 + narrowing * 0.2 * loopSize,
x0 + 0.4 * loopSize,
y0 - narrowing * 0.2 * loopSize,
x0,
y0
),
Expand Down
2 changes: 1 addition & 1 deletion R/rewire.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#' @examples
#' g <- make_ring(10)
#' g %>%
#' rewire(each_edge(p = .1, loops = FALSE)) %>%
#' rewire(each_edge(p = 0.1, loops = FALSE)) %>%
#' plot(layout = layout_in_circle)
#' print_all(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
rewire <- function(graph, with) {
Expand Down
2 changes: 1 addition & 1 deletion inst/benchmarks/correlated.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ time_that(
library(igraph)
},
{
sample_correlated_gnp_pair(100, corr = .8, p = 5 / 100)
sample_correlated_gnp_pair(100, corr = 0.8, p = 5 / 100)
}
)
4 changes: 2 additions & 2 deletions inst/benchmarks/local.scan.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ init <- expression({
set.seed(42)
})
reinit <- expression({
g <- random.graph.game(1000, p = .1)
g <- random.graph.game(1000, p = 0.1)
E(g)$weight <- sample(ecount(g))
gp <- random.graph.game(1000, p = .1)
gp <- random.graph.game(1000, p = 0.1)
E(gp)$weight <- sample(ecount(gp))
})

Expand Down
4 changes: 2 additions & 2 deletions inst/benchmarks/time_sgm.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ time_that(
nos = 10
},
reinit = {
g1 <- erdos.renyi.game(vc, .01)
g1 <- erdos.renyi.game(vc, 0.01)
perm <- c(1:nos, sample(vc-nos)+nos)
g2 <- sample_correlated_gnp(g1, corr = .7, p = g1$p, permutation = perm)
g2 <- sample_correlated_gnp(g1, corr = 0.7, p = g1$p, permutation = perm)
},
{
match_vertices(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-bipartite.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test_that("bipartite_projection works", {
test_that("bipartite_projection can calculate only one projection", {
withr::local_seed(42)

g <- sample_bipartite_gnp(5, 10, p = .3)
g <- sample_bipartite_gnp(5, 10, p = 0.3)
proj <- bipartite_projection(g)
proj_false <- bipartite_projection(g, which = "false")
proj_true <- bipartite_projection(g, which = "true")
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-centrality.R
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ test_that("power_centrality() works", {
)

g.c <- make_graph(c(1, 2, 1, 3, 2, 4, 3, 5), dir = FALSE)
bp.c <- lapply(seq(-.5, .5, by = 0.1), function(x) {
bp.c <- lapply(seq(-0.5, 0.5, by = 0.1), function(x) {
round(power_centrality(g.c, exponent = x), 2)[c(1, 2, 4)]
})

Expand All @@ -490,7 +490,7 @@ test_that("power_centrality() works", {
)

g.d <- make_graph(c(1, 2, 1, 3, 1, 4, 2, 5, 3, 6, 4, 7), dir = FALSE)
bp.d <- lapply(seq(-.4, .4, by = 0.1), function(x) {
bp.d <- lapply(seq(-0.4, 0.4, by = 0.1), function(x) {
round(power_centrality(g.d, exponent = x), 2)[c(1, 2, 5)]
})
expect_equal(
Expand All @@ -509,7 +509,7 @@ test_that("power_centrality() works", {
)

g.e <- make_graph(c(1, 2, 1, 3, 1, 4, 2, 5, 2, 6, 3, 7, 3, 8, 4, 9, 4, 10), dir = FALSE)
bp.e <- lapply(seq(-.4, .4, by = 0.1), function(x) {
bp.e <- lapply(seq(-0.4, 0.4, by = 0.1), function(x) {
round(power_centrality(g.e, exponent = x), 2)[c(1, 2, 5)]
})
expect_equal(
Expand All @@ -530,7 +530,7 @@ test_that("power_centrality() works", {
g.f <- make_graph(c(1, 2, 1, 3, 1, 4, 2, 5, 2, 6, 2, 7, 3, 8, 3, 9, 3, 10, 4, 11, 4, 12, 4, 13),
dir = FALSE
)
bp.f <- lapply(seq(-.4, .4, by = 0.1), function(x) {
bp.f <- lapply(seq(-0.4, 0.4, by = 0.1), function(x) {
round(power_centrality(g.f, exponent = x), 2)[c(1, 2, 5)]
})
expect_equal(
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-cliques.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ test_that("max_cliques() work", {

test_that("max_cliques() work for subsets", {
withr::local_seed(42)
gnp <- sample_gnp(100, .5)
gnp <- sample_gnp(100, 0.5)

mysort <- function(x) {
xl <- sapply(x, length)
Expand All @@ -219,7 +219,7 @@ test_that("max_cliques() work for subsets", {

test_that("count_max_cliques works", {
withr::local_seed(42)
gnp <- sample_gnp(100, .5)
gnp <- sample_gnp(100, 0.5)

cl1 <- count_max_cliques(gnp, min = 8)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-embedding.R
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ test_that("embed_adjacency_matrix -- Directed, weighted case works", {
test_that("embed_adjacency_matrix -- Issue #50 is resolved", {
withr::local_seed(12345)

g <- sample_gnp(15, .4)
g <- sample_gnp(15, 0.4)
w <- -log(runif(ecount(g)))
X1 <- embed_adjacency_matrix(g, 2, weights = w)

Expand Down
Loading
Loading