Skip to contents

This function generates 2-dimensional plots of samples of networks via multi-dimensional scaling using all representations and distances included in the package.

Usage

# S3 method for nvd
autoplot(object, memberships = rep(1, length(object)), method = "mds", ...)

# S3 method for nvd
plot(x, method = "mds", ...)

Arguments

object, x

A list containing two samples of network-valued data stored as objects of class nvd.

memberships

An integer vector specifying the membership of each network to a specific sample. Defaults to rep(1, length(nvd)) which assumes that all networks in the input nvd object belong to a single group.

method

A string specifying which dimensionality reduction method to use for projecting the samples into the cartesian plane. Choices are "mds", "tsne" or "umap". Defaults to "mds".

...

Extra arguments to be passed to the plot function.

Value

Invisibly returns a ggplot object. In particular, the data set computed to generate the plot can be retrieved via $data. This is a tibble containing the following variables:

  • V1: the x-coordinate of each observation in the plane,

  • V2: the y-coordinate of each observation in the plane,

  • Label: the sample membership of each observation,

  • Representation: the type of matrix representation used to manipulate each observation,

  • Distance: the distance used to measure how far each observation is from the others.

Examples

gnp_params <- list(p = 1/3)
k_regular_params <- list(k = 8L)
x <- nvd(model = "gnp", n = 10L, model_params = gnp_params)
y <- nvd(model = "k_regular", n = 10L, model_params = k_regular_params)
mb <- c(rep(1, length(x)), rep(2, length(y)))
z <- as_nvd(c(x, y))
ggplot2::autoplot(z, memberships = mb)

plot(z, memberships = mb)