Skip to content

Commit

Permalink
fixed some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
schochastics committed Nov 20, 2021
1 parent ecb4034 commit 1cb9837
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: graphlayouts
Title: Additional Layout Algorithms for Network Visualizations
Version: 0.7.1
Version: 0.7.2
Authors@R: person("David", "Schoch", email = "david.schoch@manchester.ac.uk", role = c("aut", "cre"))
Maintainer: David Schoch <david.schoch@manchester.ac.uk>
Description: Several new layout algorithms to visualize networks are provided which are not part of 'igraph'.
Expand All @@ -25,5 +25,5 @@ Suggests:
LinkingTo:
Rcpp,
RcppArmadillo
RoxygenNote: 7.1.0
RoxygenNote: 7.1.2
Roxygen: list(markdown = TRUE)
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# graphlayouts 0.7.2

* fixed description of `bbox` in `layout_with_stress`
* fixed bug in `layout_with_stress3D` which only produced a 2D layout

# graphlayouts 0.7.1

* restoring old seed after using stress layout
Expand Down
7 changes: 4 additions & 3 deletions R/layout_large_graphs.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
#' @param g igraph object
#' @param pivots number of pivots
#' @param D precomputed distances from pivots to all nodes (if available, default: NULL)
#' @param dim dimensionality of layout (defaults to 2)
#' @param weights possibly a numeric vector with edge weights. If this is NULL and the graph has a weight edge attribute, then the attribute is used. If this is NA then no weights are used (even if the graph has a weight attribute). By default, weights are ignored. See details for more.
#' @details Be careful when using weights. In most cases, the inverse of the edge weights should be used to ensure that the endpoints of an edges with higher weights are closer together (weights=1/E(g)$weight)
#'
#' The layout_igraph_* function should not be used directly. It is only used as an argument for plotting with 'igraph'.
#' 'ggraph' natively supports the layout.
#' @author David Schoch
#' @return matrix of xy coordinates
#' @return matrix of coordinates
#' @references Brandes, U. and Pich, C. (2006). Eigensolver Methods for Progressive Multidimensional Scaling of Large Data. In *International Symposium on Graph Drawing* (pp. 42-53). Springer
#' @examples
#' \dontrun{
Expand All @@ -23,7 +24,7 @@
#' xy <- layout_with_pmds(g,pivots = 100)
#' }
#' @export
layout_with_pmds <- function(g,pivots,weights=NA,D=NULL){
layout_with_pmds <- function(g,pivots,weights=NA,D=NULL,dim = 2){
if (!igraph::is_igraph(g)) {
stop("Not a graph object")
}
Expand All @@ -44,7 +45,7 @@ layout_with_pmds <- function(g,pivots,weights=NA,D=NULL){
Dmat <- D^2-outer(rmean,cmean, function(x,y) x+y)+mean(D^2)
sl2 <- svd(Dmat)

xy <- (Dmat%*%sl2$v[,1:2])
xy <- (Dmat%*%sl2$v[,1:dim])
xy
}

Expand Down
6 changes: 4 additions & 2 deletions man/layout_pmds.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/layout_stress.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// constrained_stress
double constrained_stress(NumericMatrix x, NumericMatrix W, NumericMatrix D);
RcppExport SEXP _graphlayouts_constrained_stress(SEXP xSEXP, SEXP WSEXP, SEXP DSEXP) {
Expand Down

0 comments on commit 1cb9837

Please sign in to comment.