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

x %*% y

# S3 method for default
%*%(x, y)

# S3 method for diffnet
%*%(x, y)

Arguments

x

Numeric or complex matrices or vectors, or diffnet objects.

y

Numeric or complex matrices or vectors, or diffnet objects.

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 %*%.

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).

See also

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)
#> $`1` #> [1] 800 #> #> $`2` #> [1] 800 #> #> $`3` #> [1] 800 #> #> $`4` #> [1] 800 #>
nlinks(netsim)
#> $`1` #> [1] 510 #> #> $`2` #> [1] 350 #> #> $`3` #> [1] 370 #> #> $`4` #> [1] 404 #>
mapply(`-`, nlinks(net), nlinks(netsim))
#> 1 2 3 4 #> 290 450 430 396