From ac494e0075a079588d55781db9dfb8d3c7b0334c Mon Sep 17 00:00:00 2001 From: Giona Casiraghi Date: Mon, 25 May 2020 16:41:29 +0200 Subject: [PATCH] fixes to check_specs --- DESCRIPTION | 2 +- R/auxilliary.R | 20 ++++++++++---------- R/igraphintegration.R | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0f2c6fa..52c7d31 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: ghypernet Type: Package Title: Fit and Simulate Generalised Hypergeometric Ensembles of Graphs -Version: 1.0.0 +Version: 1.0.0.9000 Date: 2020-05-11 Authors@R: c( person("Giona", "Casiraghi", email = "giona@ethz.ch", diff --git a/R/auxilliary.R b/R/auxilliary.R index c1dc267..429fd16 100644 --- a/R/auxilliary.R +++ b/R/auxilliary.R @@ -49,27 +49,27 @@ check_specs <- function(object, ...){ check_specs.matrix <- function(object, ...){ if(is.matrix(object)){ - if(is.null(directed)){ + # if(is.null(directed)){ if(isSymmetric(object)){ directed <- FALSE } else{ directed <- TRUE } - } else{ - if(!directed & !isSymmetric(object)){ - warning('Trying to compute undirected ensemble for asymmetric adjacency matrix. - Adjacency matrix symmetrised as adj <- adj + t(adj)') - object <- object + t(object) - } - } + # } else{ + # if(!directed & !isSymmetric(object)){ + # warning('Trying to compute undirected ensemble for asymmetric adjacency matrix. + # Adjacency matrix symmetrised as adj <- adj + t(adj)') + # object <- object + t(object) + # } + # } - if(is.null(selfloops)){ + # if(is.null(selfloops)){ if(all(diag(object)==0)){ selfloops <- FALSE } else{ selfloops <- TRUE } - } + # } } return(c('directed'=directed, 'selfloops'=selfloops)) } \ No newline at end of file diff --git a/R/igraphintegration.R b/R/igraphintegration.R index 860504b..f225345 100644 --- a/R/igraphintegration.R +++ b/R/igraphintegration.R @@ -1,21 +1,21 @@ # auxiliary function for to extract igraph properties check_specs.igraph <- function(object, ...){ if(requireNamespace("igraph", quietly = TRUE) && igraph::is.igraph(object)){ - if(is.null(directed)){ + # if(is.null(directed)){ if(igraph::is.directed(object)){ directed <- FALSE } else{ directed <- TRUE } - } + # } - if(is.null(selfloops)){ + # if(is.null(selfloops)){ if(igraph::is.simple(igraph::simplify(object, remove.multiple = TRUE, remove.loops = FALSE))){ selfloops <- FALSE } else{ selfloops <- TRUE } - } + # } } return(c('directed'=directed, 'selfloops'=selfloops)) }