Learn R Programming

netgen (version 1.3.2)

rescaleNetwork: Rescale network

Description

Normalize network coordinates to the unit cube while maintaining its geography.

Usage

rescaleNetwork(x, method = "global2")

Arguments

x

[Network] Network.

method

[character(1)] Rescaling method which actually modifies the coordinates. Currently there are three methods available:

by.dimension

Scaling is performed for each dimension independently.

global

Here we shift all the points toward the origin by the minimum of both x and y coordiantes and devide by the range of global maximim and minimum.

global2

Here wer shift - analogously to the by.dimension strategy - dimension wise and devide by the maximum of the ranges in x respectivly y direction.

Default is global2, which leads to the most “natural” rescaling.

Value

[Network]

Examples

Run this code
# NOT RUN {
library(gridExtra)
x = generateClusteredNetwork(n.points = 100L, n.cluster = 4L, name = "Rescaling Demo")

# here we "stretch" the instance x direction to visualize the differences of
# the rescaling mehtods
x$coordinates[, 1] = x$coordinates[, 1] * 10L
x$upper = x$upper * 10L
pls = list(
  autoplot(x) + ggtitle("Original"),
  autoplot(rescaleNetwork(x, method = "by.dimension")) + ggtitle("By dimension"),
  autoplot(rescaleNetwork(x, method = "global")) + ggtitle("Global"),
  autoplot(rescaleNetwork(x, method = "global2")) + ggtitle("Global2")
)
pls$nrow = 1L
do.call(grid.arrange, pls)
# }

Run the code above in your browser using DataLab