diff --git a/R/R6Class-BipartiteSBM.R b/R/R6Class-BipartiteSBM.R index 8260fc7..5d80b01 100644 --- a/R/R6Class-BipartiteSBM.R +++ b/R/R6Class-BipartiteSBM.R @@ -21,8 +21,8 @@ BipartiteSBM <- stopifnot(length(blockProp) == 2, is.list(blockProp), length(blockProp[[1]]) == nrow(connectParam$mean), # dimensions match between vector of length(blockProp[[2]]) == ncol(connectParam$mean)) # block proportion and connectParam$mean - stopifnot(all(blockProp[[1]] > 0), all(blockProp[[1]] < 1)) # positive proportions - stopifnot(all(blockProp[[2]] > 0), all(blockProp[[2]] < 1)) + stopifnot(all(blockProp[[1]] >= 0)) # positive proportions + stopifnot(all(blockProp[[2]] >= 0)) names(blockProp) <- names(dimLabels) ## Check that connectivity parameters and model are consistent diff --git a/R/R6Class-SimpleSBM.R b/R/R6Class-SimpleSBM.R index 96a9ff4..c95502a 100644 --- a/R/R6Class-SimpleSBM.R +++ b/R/R6Class-SimpleSBM.R @@ -19,7 +19,7 @@ SimpleSBM <- ## SANITY CHECKS (on parameters) stopifnot(length(dimLabels) == 1) - stopifnot(is.atomic(blockProp), all(blockProp > 0), all(blockProp < 1)) # positive proportions + stopifnot(is.atomic(blockProp), all(blockProp >= 0)) # positive proportions stopifnot(all.equal(length(blockProp), ncol(connectParam$mean)), # dimensions match between vector of all.equal(length(blockProp), nrow(connectParam$mean))) # block proportion and connectParam$mean diff --git a/R/utils.R b/R/utils.R index 9df7f2e..361c2a2 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,5 +1,6 @@ as_indicator <- function(clustering) { - K <- length(unique(clustering)) + #K <- length(unique(clustering)) + K <- max(clustering) N <- length(clustering) Z <- matrix(0, N, K) Z[cbind(seq.int(N), clustering)] <- 1 diff --git a/R/utils_plot.R b/R/utils_plot.R index 74cda01..37152cf 100644 --- a/R/utils_plot.R +++ b/R/utils_plot.R @@ -115,8 +115,8 @@ plotMatrix = function(Mat, dimLabels, clustering = NULL, plotOptions = list()){ if (!is.null(clustering)) { - g <- g + geom_vline(data = sepCol,mapping = aes_string(xintercept = 'sep'),size = currentOptions$line.width, col=currentOptions$line.color) - g <- g + geom_hline(data = sepRow + 1,mapping = aes_string(yintercept = 'sep'),size = currentOptions$line.width, col=currentOptions$line.color) + g <- g + geom_vline(data = sepCol,mapping = aes(xintercept = .data$sep),linewidth = currentOptions$line.width, col=currentOptions$line.color) + g <- g + geom_hline(data = sepRow + 1,mapping = aes(yintercept = .data$sep),linewidth = currentOptions$line.width, col=currentOptions$line.color) } if (!is.null(currentOptions$title)){g <- g + ggtitle(currentOptions$title) } g