Learn R Programming

migraph (version 0.9.2)

generate: Create networks from particular probabilities

Description

These functions are similar to the create_* functions, but include some random element. They are particularly useful for creating a distribution of networks for exploring or testing network properties.

Usage

generate_random(n, p, m, directed = FALSE)

generate_smallworld(n, p = 0.05)

generate_scalefree(n, p = 1)

generate_permutation(object, with_attr = TRUE)

Arguments

n

Given:

  • A single integer, e.g. n = 10, a one-mode network will be created.

  • A vector of two integers, e.g. n = c(5,10), a two-mode network will be created.

  • A migraph-compatible object, a network of the same dimensions will be created.

p

Number of edges in the network over the number of edges possible

m

Number of edges in the network

directed

Whether to generate network as directed. By default FALSE.

object

a migraph-consistent object

with_attr

Logical. Whether any attributes of the object should be retained. By default TRUE.

Functions

  • generate_random: Generates a random network with a particular probability.

  • generate_smallworld: Generates a small-world structure following the lattice rewiring model.

  • generate_scalefree: Generates a scale-free structure following the preferential attachment model.

  • generate_permutation: Generates a permutation of the original network using a Fisher-Yates shuffle on both the rows and columns (for a one-mode network) or on each of the rows and columns (for a two-mode network).

See Also

Other creation: create

Examples

Run this code
# NOT RUN {
autographr(generate_random(12, 0.4)) +
autographr(generate_random(c(6, 6), 0.4))
autographr(generate_smallworld(12, 0.025)) +
autographr(generate_smallworld(12, 0.25))
autographr(generate_scalefree(12, 0.25)) +
autographr(generate_scalefree(12, 1.25))
autographr(mpn_elite_usa_advice) +
autographr(generate_permutation(mpn_elite_usa_advice))
# }

Run the code above in your browser using DataLab