R/RcppExports.R

Defines functions fa2_distance fa2_getids fa2_degree fa2_degree_index fa2_get_center fa2_forcei fa2_force

Documented in fa2_degree fa2_degree_index fa2_distance fa2_force fa2_forcei fa2_get_center fa2_getids

# This file was generated by Rcpp::compileAttributes
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' n-norm distance
#' @param n1 Numeric vector of coordinates.
#' @param n2 Numeric vector of coordinates.
#' @param norm Order of the norm.
#' @return Scalar. Distance between two vectors (norm).
fa2_distance <- function(n1, n2, norm = 2.0) {
    .Call('RforceAtlas2_fa2_distance', PACKAGE = 'RforceAtlas2', n1, n2, norm)
}

#' Retrives vertices' ids
#' @param G Two column matrix with vertex ids.
#' @return Integer vector with vertices ids.
fa2_getids <- function(G) {
    .Call('RforceAtlas2_fa2_getids', PACKAGE = 'RforceAtlas2', G)
}

#' Degree of each node
#' @param G Two column matrix with vertex ids.
#' @return A two column matrix. Column one has vertices ids and 
#' column two has its degrees.
fa2_degree <- function(G) {
    .Call('RforceAtlas2_fa2_degree', PACKAGE = 'RforceAtlas2', G)
}

#' Returns only the degree index
#' @describeIn fa2_degree Returns an integer vector with the degree
#' of each vertex.
fa2_degree_index <- function(G) {
    .Call('RforceAtlas2_fa2_degree_index', PACKAGE = 'RforceAtlas2', G)
}

#' Geometric centre of a graph
#' @param pos K column matrix with vertex positions.
#' @return K length numeric vector pointing to the centre of the
#' graph.
fa2_get_center <- function(pos) {
    .Call('RforceAtlas2_fa2_get_center', PACKAGE = 'RforceAtlas2', pos)
}

#' Attracction and repulsion forces between two nodes
#' @param n1 Position of node 1
#' @param n2 Position of node 2
#' @param d1 Degree of node 1
#' @param d2 Degree of node 2
#' @param s1 Size of node 1
#' @param s2 Size of node 2
#' @param kr Repulsion constant 
#' @param kr2 
#' @param ka Attraction constant
fa2_forcei <- function(n1, n2, d1, d2, s1 = 1.0, s2 = 1.0, kr = 1.0, kr2 = 100.0, ka = 1.0, nooverlap = FALSE) {
    .Call('RforceAtlas2_fa2_forcei', PACKAGE = 'RforceAtlas2', n1, n2, d1, d2, s1, s2, kr, kr2, ka, nooverlap)
}

#' Estimates the force of a system
#' @param pos A k-column matrix with vertices' positions.
#' @param G Two column matrix with vertex ids.
#' @param size Numeric vector with vertices' sizes.
#' @param kr Repulsion constant 
#' @param kr2 
#' @param ka Attraction constant
fa2_force <- function(pos, G, size, kr = 1.0, kr2 = 100.0, ka = 1.0, nooverlap = FALSE) {
    .Call('RforceAtlas2_fa2_force', PACKAGE = 'RforceAtlas2', pos, G, size, kr, kr2, ka, nooverlap)
}
gvegayon/RforceAtlas2 documentation built on May 17, 2019, 9:30 a.m.