generate_input {diffuStats} | R Documentation

## Generate a random input for graph diffusion

### 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

    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

    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)

[Package diffuStats version 0.104.0 Index]