make_stochastic {manynet} | R Documentation |
Making networks with a stochastic element
Description
These functions are similar to the create_*
functions,
but include some element of randomisation.
They are particularly useful for creating a distribution of networks
for exploring or testing network properties.
-
generate_smallworld()
generates a small-world structure via ring rewiring at some probability. -
generate_scalefree()
generates a scale-free structure via preferential attachment at some probability. -
generate_fire()
generates a forest fire model. -
generate_islands()
generates an islands model. -
generate_citations()
generates a citations model.
These functions can create either one-mode or two-mode networks.
To create a one-mode network, pass the main argument n
a single integer,
indicating the number of nodes in the network.
To create a two-mode network, pass n
a vector of two integers,
where the first integer indicates the number of nodes in the first mode,
and the second integer indicates the number of nodes in the second mode.
As an alternative, an existing network can be provided to n
and the number of modes, nodes, and directedness will be inferred.
Usage
generate_smallworld(n, p = 0.05, directed = FALSE, width = 2)
generate_scalefree(n, p = 1, directed = FALSE)
generate_fire(n, contacts = 1, their_out = 0, their_in = 1, directed = FALSE)
generate_islands(n, islands = 2, p = 0.5, bridges = 1, directed = FALSE)
generate_citations(
n,
ties = sample(1:4, 1),
agebins = max(1, n/10),
directed = FALSE
)
Arguments
n |
Given:
|
p |
Power of the preferential attachment, default is 1. |
directed |
Whether to generate network as directed. By default FALSE. |
width |
Integer specifying the width of the ring, breadth of the branches, or maximum extent of the neighbourbood. |
contacts |
Number of contacts or ambassadors chosen from among existing
nodes in the network.
By default 1.
See |
their_out |
Probability of tieing to a contact's outgoing ties. By default 0. |
their_in |
Probability of tieing to a contact's incoming ties. By default 1. |
islands |
Number of islands or communities to create.
By default 2.
See |
bridges |
Number of bridges between islands/communities. By default 1. |
ties |
Number of ties to add per new node. By default a uniform random sample from 1 to 4 new ties. |
agebins |
Number of aging bins.
By default either |
Value
By default a tbl_graph
object is returned,
but this can be coerced into other types of objects
using as_edgelist()
, as_matrix()
,
as_tidygraph()
, or as_network()
.
By default, all networks are created as undirected.
This can be overruled with the argument directed = TRUE
.
This will return a directed network in which the arcs are
out-facing or equivalent.
This direction can be swapped using to_redirected()
.
In two-mode networks, the directed argument is ignored.
References
On small-world networks
Watts, Duncan J., and Steven H. Strogatz. 1998. “Collective Dynamics of ‘Small-World’ Networks.” Nature 393(6684):440–42. doi:10.1038/30918.
On scale-free networks
Barabasi, Albert-Laszlo, and Reka Albert. 1999. “Emergence of Scaling in Random Networks.” Science 286(5439):509–12. doi:10.1126/science.286.5439.509.
On the forest-fire model
Leskovec, Jure, Jon Kleinberg, and Christos Faloutsos. 2007. "Graph evolution: Densification and shrinking diameters". ACM transactions on Knowledge Discovery from Data, 1(1): 2-es.
See Also
Other makes:
make_cran
,
make_create
,
make_ego
,
make_explicit
,
make_learning
,
make_motifs
,
make_play
,
make_random
,
make_read
,
make_write
Examples
graphr(generate_smallworld(12, 0.025))
graphr(generate_smallworld(12, 0.25))
graphr(generate_scalefree(12, 0.25))
graphr(generate_scalefree(12, 1.25))
generate_fire(10)
generate_islands(10)
generate_citations(10)