From e81392227757e83373a26f803d007f8445063c52 Mon Sep 17 00:00:00 2001 From: Andrew Duncan Date: Mon, 30 Apr 2018 20:52:10 +0100 Subject: [PATCH 1/2] Tweaking tmp_graph in addNodeSize(). --- .Rbuildignore | 1 + .gitignore | 1 + R/sigmaAttrs.R | 2 +- sigmaNet.Rproj | 5 +++++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.Rbuildignore b/.Rbuildignore index 1a555ba..d9b4a00 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,3 +3,4 @@ ^img/bigNetwork\.png$ ^README\.md$ ^docs$ +^\.Rproj\.user$ diff --git a/.gitignore b/.gitignore index c066a39..8e3a7fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ inst/doc +.Rproj.user diff --git a/R/sigmaAttrs.R b/R/sigmaAttrs.R index 6c1f0b2..96e461b 100644 --- a/R/sigmaAttrs.R +++ b/R/sigmaAttrs.R @@ -121,7 +121,7 @@ addNodeSize <- function(sigmaObj, minSize = 1, maxSize = 3, sizeMetric = 'degree sigmaObj$x$options$minNodeSize <- minSize sigmaObj$x$options$maxNodeSize <- maxSize } else{ - tmp_graph <- igraph::graph_from_data_frame(sigmaObj$x$graph$edges) + tmp_graph <- igraph::graph_from_data_frame(sigmaObj$x$graph) if(sizeMetric == 'degree'){ nodes$size <- igraph::degree(tmp_graph) } else if(sizeMetric == 'closeness'){ diff --git a/sigmaNet.Rproj b/sigmaNet.Rproj index d848a9f..cba1b6b 100644 --- a/sigmaNet.Rproj +++ b/sigmaNet.Rproj @@ -5,8 +5,13 @@ SaveWorkspace: No AlwaysSaveHistory: Default EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 Encoding: UTF-8 +RnwWeave: Sweave +LaTeX: pdfLaTeX + AutoAppendNewline: Yes StripTrailingWhitespace: Yes From 5ad9eb84d0998117b1ad9684015d299f929d49eb Mon Sep 17 00:00:00 2001 From: Andrew Duncan Date: Mon, 30 Apr 2018 21:17:56 +0100 Subject: [PATCH 2/2] Problem was actually the difference in directed and undirected networks, should now be fixed. --- R/sigmaAttrs.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/sigmaAttrs.R b/R/sigmaAttrs.R index 96e461b..69dda5f 100644 --- a/R/sigmaAttrs.R +++ b/R/sigmaAttrs.R @@ -121,7 +121,8 @@ addNodeSize <- function(sigmaObj, minSize = 1, maxSize = 3, sizeMetric = 'degree sigmaObj$x$options$minNodeSize <- minSize sigmaObj$x$options$maxNodeSize <- maxSize } else{ - tmp_graph <- igraph::graph_from_data_frame(sigmaObj$x$graph) + tmp_graph <- igraph::graph_from_data_frame(sigmaObj$x$graph$edges, + directed = FALSE) if(sizeMetric == 'degree'){ nodes$size <- igraph::degree(tmp_graph) } else if(sizeMetric == 'closeness'){