%*% {netdiffuseR}R Documentation

Matrix multiplication

Description

Matrix multiplication methods, including diffnet objects. This function creates a generic method for %*% allowing for multiplying diffnet objects.

Usage

x %*% y

## Default S3 method:
x %*% y

## S3 method for class 'diffnet'
x %*% y

Arguments

x

Numeric or complex matrices or vectors, or diffnet objects.

y

Numeric or complex matrices or vectors, or diffnet objects.

Details

This function can be usefult to generate alternative graphs, for example, users could compute the n-steps graph by doing net %*% net (see examples).

Value

In the case of diffnet objects performs matrix multiplication via mapply using x$graph and y$graph as arguments, returnling a diffnet. Otherwise returns the default according to %*%.

See Also

Other diffnet methods: as.array.diffnet(), c.diffnet(), diffnet-arithmetic, diffnet-class, diffnet_index, plot.diffnet(), summary.diffnet()

Examples

# Finding the Simmelian Ties network ----------------------------------------

# Random diffnet graph
set.seed(773)
net <- rdiffnet(100, 4, seed.graph='small-world', rgraph.args=list(k=8))
netsim <- net

# According to Dekker (2006), Simmelian ties can be computed as follows
netsim <- net * t(net) # Keeping mutal
netsim <- netsim * (netsim %*% netsim)

# Checking out differences (netsim should have less)
nlinks(net)
nlinks(netsim)

mapply(`-`, nlinks(net), nlinks(netsim))


[Package netdiffuseR version 1.22.6 Index]