These functions create networks with particular structural properties.
create_empty() creates an empty network without any ties.
create_filled() creates a filled network with every possible tie realised.
create_ring() creates a ring or chord network where each nodes'
neighbours form a clique.
create_star() creates a network with a maximally central node.
create_tree() creates a network with successive branches.
create_lattice() creates a network that forms a regular tiling.
create_components() creates a network that clusters nodes into separate components.
create_core() creates a network in which a certain proportion of 'core' nodes
are densely tied to each other, and the rest peripheral, tied only to the core.
create_degree() creates a network with a given (out/in)degree sequence,
which can also be used to create k-regular networks.
create_cycle() creates a network in which all the nodes form
a single closed chain.
create_wheel() creates a network in which a single dominant node
is tied to all the nodes in a cycle.
create_windmill() creates a network in which several cliques,
or blades, share a single hub node.
Unless a blade width is given, the number of blades is balanced
against their size.
Some of these structures are constrained in two-mode networks.
Since ties in two-mode networks can only run between the modes,
a two-mode cycle must alternate between them, and so can only be as long
as twice the number of nodes in the smaller mode.
Similarly, the rim of a two-mode wheel alternates between the modes,
and its hub, drawn from the first mode, can only be tied to the
second mode's rim nodes.
The hub of a two-mode windmill is also drawn from the first mode,
and is tied to every blade node in the second mode,
while each other first-mode node is tied to its own blade.
Where n is larger than such a structure can accommodate,
the largest such structure is created and the surplus nodes are
added as isolates, with a message.
This is also the case for windmills whose blades cannot be equally sized.
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.
create_empty(n, directed = FALSE)
create_filled(n, directed = FALSE)
create_ring(n, directed = FALSE, width = 1, ...)
create_star(n, directed = FALSE)
create_tree(n, directed = FALSE, width = 2)
create_lattice(n, directed = FALSE, width = 8)
create_components(n, directed = FALSE, membership = NULL)
create_degree(n, outdegree = NULL, indegree = NULL)
create_core(n, directed = FALSE, mark = NULL)
create_windmill(n, directed = FALSE, width = NULL)
create_cycle(n, directed = FALSE)
create_wheel(n, directed = FALSE)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 manynet-compatible object, a network of the same dimensions will be created.
Logical whether the network should be directed.
By default directed = FALSE,
but for the functions that the usage above shows another default for.
A network given as n sets the direction instead.
If the opposite direction is desired,
use to_redirected() on the output of these functions.
In two-mode networks, the directed argument is ignored.
Integer specifying the width of the ring, breadth of the branches, number of nodes in each blade of a windmill, maximum extent of the neighbourbood, or number of ties that bridge each pair of islands.
Additional arguments passed on to igraph::make_ring().
A vector of partition membership as integers.
If left as NULL (the default), nodes in each mode will be
assigned to two, equally sized partitions.
Numeric scalar or vector indicating the
desired outdegree distribution.
Note that a scalar (single number) will result in a k-regular graph.
By default NULL.
If n is an existing network object and the outdegree is not specified,
then the outdegree distribution will be inferred from that of the network.
If only the indegree is specified, then in one-mode networks the outdegree
will mirror it, and in two-mode networks the same number of ties will be
spread as evenly as possible across the nodes in the first mode.
If neither is specified, the sparsest connected structure is created:
a cycle in one-mode networks, and in two-mode networks one in which the
larger mode is 1-regular.
Numeric vector indicating the desired indegree distribution.
By default NULL but not required unless a directed network is desired.
If n is an existing directed network object and the indegree is not specified,
then the indegree distribution will be inferred from that of the network.
Otherwise it is filled in from the outdegree as described above.
A logical vector the length of the nodes in the network,
with TRUE for a node of the core.
This can be created by, among other things, any node_is_*() function.
Where mark is not logical, the core is the first of its two groups.
A stocnet object is returned,
which can be coerced into other types of objects
using as_edgelist(), as_matrix(),
as_tidygraph(), as_igraph(), or as_network().
create_ring(), create_lattice(),
generate_random(), generate_smallworld(), and
generate_scalefree() return a tbl_graph or igraph object for now,
since the released versions of the packages built on this one expect
one from them.
By default, most 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.
create_lattice() creates two-dimensional lattices
with as even dimensions as possible.
The width parameter sets the maximum (in or out) degree of any node:
width = 4 creates a square grid lattice.
Such a network is bipartite, that is partitionable into two types that are
not adjacent to any of their own type.
width = 6 creates a triangular grid lattice,
a square grid with one diagonal across each square.
width = 8 creates a King's move lattice,
a square grid with both diagonals across each square.
width = 12 creates a lattice where each node is tied to every node
within two steps on the square grid.
If the number of nodes is a prime number, it will only return a chain (a single dimensional lattice).
When n is a vector of two equal integers, create_lattice() creates
a two-mode honeycomb (hexagonal) lattice,
in which each node is tied to at most three nodes of the other mode.
Where the number of nodes allows, no node hangs from a single tie.
as
Other makes:
make_collect,
make_ego,
make_emails,
make_explicit,
make_groups,
make_growth,
make_learning,
make_play,
make_random,
make_read,
make_write
create_empty(10)
#>
#> ── # Empty network ─────────────────────────────────────────────────────────────
#> # A undirected network of 10 nodes and 0 ties
#>
#> ── Ties
#> # A tibble: 0 × 2
#> # ℹ 2 variables: from <int>, to <int>
#>
create_filled(10)
#> ── # Filled network ────────────────────────────────────────────────────────────
#> # A undirected network of 10 nodes and 45 ties
#>
#> ── Ties
#> # A tibble: 45 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 1 3
#> 3 1 4
#> 4 1 5
#> 5 1 6
#> 6 1 7
#> # ℹ 39 more rows
#>
create_ring(8, width = 2)
#> ── # Ring network ──────────────────────────────────────────────────────────────
#> # A undirected network of 8 nodes and 16 ties
#>
#> ── Ties
#> # A tibble: 16 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 1 3
#> 3 1 7
#> 4 1 8
#> 5 2 3
#> 6 2 4
#> # ℹ 10 more rows
#>
create_star(12)
#> ── # Star network ──────────────────────────────────────────────────────────────
#> # A undirected network of 12 nodes and 11 ties
#>
#> ── Ties
#> # A tibble: 11 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 1 3
#> 3 1 4
#> 4 1 5
#> 5 1 6
#> 6 1 7
#> # ℹ 5 more rows
#>
create_tree(c(7,8))
#> ── # Tree network ──────────────────────────────────────────────────────────────
#> # A two-mode network of 7 FALSEs and 8 TRUEs and 14 ties
#>
#> ── Nodes
#> # A tibble: 15 × 1
#> mode
#> <chr>
#> 1 FALSE
#> 2 FALSE
#> 3 FALSE
#> 4 FALSE
#> 5 FALSE
#> 6 FALSE
#> # ℹ 9 more rows
#>
#> ── Ties
#> # A tibble: 14 × 2
#> from to
#> <int> <int>
#> 1 1 8
#> 2 1 9
#> 3 1 10
#> 4 2 8
#> 5 2 11
#> 6 2 12
#> # ℹ 8 more rows
#>
create_lattice(12, width = 4)
#> ── # Lattice network ───────────────────────────────────────────────────────────
#> # A undirected network of 12 nodes and 17 ties
#>
#> ── Ties
#> # A tibble: 17 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 1 4
#> 3 2 3
#> 4 2 5
#> 5 3 6
#> 6 4 5
#> # ℹ 11 more rows
#>
create_lattice(12, width = 6)
#> ── # Lattice network ───────────────────────────────────────────────────────────
#> # A undirected network of 12 nodes and 23 ties
#>
#> ── Ties
#> # A tibble: 23 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 2 3
#> 3 4 5
#> 4 5 6
#> 5 7 8
#> 6 8 9
#> # ℹ 17 more rows
#>
create_lattice(c(6,6))
#> ── # Lattice network ───────────────────────────────────────────────────────────
#> # A two-mode network of 6 nodes and 6 nodes and 13 ties
#>
#> ── Nodes
#> # A tibble: 12 × 1
#> type
#> <lgl>
#> 1 FALSE
#> 2 FALSE
#> 3 FALSE
#> 4 FALSE
#> 5 FALSE
#> 6 FALSE
#> # ℹ 6 more rows
#>
#> ── Ties
#> # A tibble: 13 × 2
#> from to
#> <int> <int>
#> 1 1 7
#> 2 1 8
#> 3 2 7
#> 4 2 9
#> 5 3 8
#> 6 3 9
#> # ℹ 7 more rows
#>
create_components(10, membership = c(1,1,1,2,2,2,3,3,3,3))
#> ── # Components network ────────────────────────────────────────────────────────
#> # A undirected network of 10 nodes and 12 ties
#>
#> ── Ties
#> # A tibble: 12 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 1 3
#> 3 2 3
#> 4 4 5
#> 5 4 6
#> 6 5 6
#> # ℹ 6 more rows
#>
create_degree(10, outdegree = rep(1:5, 2))
#> ── # Degree sequence network ───────────────────────────────────────────────────
#> # A undirected network of 10 nodes and 15 ties
#>
#> ── Ties
#> # A tibble: 15 × 2
#> from to
#> <int> <int>
#> 1 6 10
#> 2 1 5
#> 3 5 7
#> 4 7 10
#> 5 2 9
#> 6 2 4
#> # ℹ 9 more rows
#>
create_degree(10)
#> ── # Degree sequence network ───────────────────────────────────────────────────
#> # A undirected network of 10 nodes and 10 ties
#>
#> ── Ties
#> # A tibble: 10 × 2
#> from to
#> <int> <int>
#> 1 9 10
#> 2 8 10
#> 3 7 8
#> 4 6 7
#> 5 5 6
#> 6 4 5
#> # ℹ 4 more rows
#>
create_degree(c(6,4))
#> ── # Degree sequence network ───────────────────────────────────────────────────
#> # A two-mode network of 6 FALSEs and 4 TRUEs and 6 ties
#>
#> ── Nodes
#> # A tibble: 10 × 1
#> mode
#> <chr>
#> 1 FALSE
#> 2 FALSE
#> 3 FALSE
#> 4 FALSE
#> 5 FALSE
#> 6 FALSE
#> # ℹ 4 more rows
#>
#> ── Ties
#> # A tibble: 6 × 2
#> from to
#> <int> <int>
#> 1 6 7
#> 2 5 8
#> 3 4 8
#> 4 3 7
#> 5 2 9
#> 6 1 10
#>
create_core(6)
#> ── # Core-periphery network ────────────────────────────────────────────────────
#> # A undirected network of 6 nodes and 12 ties
#>
#> ── Ties
#> # A tibble: 12 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 1 3
#> 3 1 4
#> 4 1 5
#> 5 1 6
#> 6 2 3
#> # ℹ 6 more rows
#>
create_windmill(7)
#> ── # Windmill network ──────────────────────────────────────────────────────────
#> # A undirected network of 7 nodes and 9 ties
#>
#> ── Ties
#> # A tibble: 9 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 1 3
#> 3 1 4
#> 4 1 5
#> 5 1 6
#> 6 1 7
#> # ℹ 3 more rows
#>
create_windmill(7, width = 2)
#> ── # Windmill network ──────────────────────────────────────────────────────────
#> # A undirected network of 7 nodes and 9 ties
#>
#> ── Ties
#> # A tibble: 9 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 1 3
#> 3 1 4
#> 4 1 5
#> 5 1 6
#> 6 1 7
#> # ℹ 3 more rows
#>
create_windmill(c(4,6))
#> ── # Windmill network ──────────────────────────────────────────────────────────
#> # A two-mode network of 4 FALSEs and 6 TRUEs and 12 ties
#>
#> ── Nodes
#> # A tibble: 10 × 1
#> mode
#> <chr>
#> 1 FALSE
#> 2 FALSE
#> 3 FALSE
#> 4 FALSE
#> 5 TRUE
#> 6 TRUE
#> # ℹ 4 more rows
#>
#> ── Ties
#> # A tibble: 12 × 2
#> from to
#> <int> <int>
#> 1 1 5
#> 2 2 5
#> 3 1 6
#> 4 2 6
#> 5 1 7
#> 6 3 7
#> # ℹ 6 more rows
#>
create_cycle(6)
#> ── # Cycle network ─────────────────────────────────────────────────────────────
#> # A undirected network of 6 nodes and 6 ties
#>
#> ── Ties
#> # A tibble: 6 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 2 3
#> 3 3 4
#> 4 4 5
#> 5 1 6
#> 6 5 6
#>
create_cycle(c(4,6))
#> ── # Cycle network ─────────────────────────────────────────────────────────────
#> # A two-mode network of 4 FALSEs and 6 TRUEs and 8 ties
#>
#> ── Nodes
#> # A tibble: 10 × 1
#> mode
#> <chr>
#> 1 FALSE
#> 2 FALSE
#> 3 FALSE
#> 4 FALSE
#> 5 TRUE
#> 6 TRUE
#> # ℹ 4 more rows
#>
#> ── Ties
#> # A tibble: 8 × 2
#> from to
#> <int> <int>
#> 1 1 5
#> 2 2 5
#> 3 2 6
#> 4 3 6
#> 5 3 7
#> 6 4 7
#> # ℹ 2 more rows
#>
create_wheel(6)
#> ── # Wheel network ─────────────────────────────────────────────────────────────
#> # A undirected network of 6 nodes and 10 ties
#>
#> ── Ties
#> # A tibble: 10 × 2
#> from to
#> <int> <int>
#> 1 2 3
#> 2 3 4
#> 3 4 5
#> 4 5 6
#> 5 2 6
#> 6 1 2
#> # ℹ 4 more rows
#>
create_wheel(c(4,6))
#> ── # Wheel network ─────────────────────────────────────────────────────────────
#> # A two-mode network of 4 FALSEs and 6 TRUEs and 9 ties
#>
#> ── Nodes
#> # A tibble: 10 × 1
#> mode
#> <chr>
#> 1 FALSE
#> 2 FALSE
#> 3 FALSE
#> 4 FALSE
#> 5 TRUE
#> 6 TRUE
#> # ℹ 4 more rows
#>
#> ── Ties
#> # A tibble: 9 × 2
#> from to
#> <int> <int>
#> 1 2 5
#> 2 3 5
#> 3 3 6
#> 4 4 6
#> 5 4 7
#> 6 2 7
#> # ℹ 3 more rows
#>