Learn R Programming

netdiffuseR (version 1.16.2)

diffnet-arithmetic: diffnet Arithmetic Operators

Description

Addition, substraction and network power of diffnet objects

Usage

## S3 method for class 'diffnet':
^(x, y)

graph_power(x, y, valued = getOption("diffnet.valued", FALSE))

## S3 method for class 'diffnet': /(y, x)

Arguments

x
A diffnet class object.
y
Integer scalar. Power of the network
valued
Logical scalar. When FALSE all non-zero entries of the adjacency matrices are set to one.

Value

  • A diffnet class object

Details

Using binary operators, ease data management process with diffnet.

By default the binary operator ^ assumes that the graph is valued, hence the power is computed using a weighted edges. Otherwise, if more control is needed, the user can use graph_power instead.

Examples

Run this code
# Computing two-steps away threshold with the Brazilian farmers data --------
data(brfarmersDiffNet)

expo1 <- threshold(brfarmersDiffNet)
expo2 <- threshold(brfarmersDiffNet^2)

# Computing correlation
cor(expo1,expo2)

# Drawing a qqplot
qqplot(expo1, expo2)

# Working with inverse ------------------------------------------------------
brf2_step <- brfarmersDiffNet^2
brf2_step <- 1/brf2_step

ba <- rdiffnet(10,5, seed.graph="scale-free", rgraph.args=list(m=4))

Run the code above in your browser using DataLab