generate_input: Generate a random input for graph diffusion

Description Usage Arguments Value Examples

View source: R/generate_input.R

Description

Function generate_input generates a random list of nodes from an igraph object. It also specifies the true solution generating the list. The graph object needs to have some attributes (automatically added through generate_graph)

Usage

1
generate_input(graph, order, length_inputs, return_matrix = TRUE, seed = NULL)

Arguments

graph

an igraph object, typically from generate_input

order

numeric or vector, order of the neighbourhoods that generate the list

length_inputs

numeric, number of nodes in the generated inputs

return_matrix

logical, should inputs be returned as a matrix?

seed

numeric, seed for random number generator

Value

A list whose elements are lists with three slots: pos for the true signal generators, neg for the nodes that did not generate signal and input for the signal itself

Examples

1
2
3
4
5
6
7
8
9
g <- generate_graph(
    fun_gen = igraph::barabasi.game,
    param_gen = list(n = 200, m = 3, directed = FALSE),
    seed = 1)
synth_input <- generate_input(
    g,
    order = 2,
    length_inputs = 3, return_matrix = TRUE)
str(synth_input)

b2slab/diffuStats documentation built on Feb. 26, 2021, 2 p.m.