Learn R Programming

migraph (version 0.6.2)

create: Create networks that conform to particular structures

Description

These functions create a host of different network objects. Despite the common syntax, what distinguishes them from those in other packages is that passing the n argument a vector of two integers will return a two-mode network instead of a one-mode network.

Usage

create_empty(n)

create_complete(n)

create_ring(n, width = 1, directed = FALSE, ...)

create_components(n, components = 2)

Arguments

n

Number of nodes. If a single integer is given, the function will create a one-mode network. If a vector of two integers is given, e.g. n = c(5,10), the function will create a two-mode network.

width

The width or breadth of the ring. This is typically double the degree.

directed

Whether the graph should be directed. By default FALSE.

...

Additional arguments passed on to igraph.

components

Number of components to create.

Value

By default an igraph object will be returned, but this can be coerced into other types of objects using as_matrix() or as_tidygraph().

Details

create_empty() creates an empty graph of the given dimensions.

create_complete() creates a filled graph of the given dimensions.

create_ring() creates a ring or chord graph of the given dimensions that loops around is of a certain width or thickness.

create_components() creates a graph in which the nodes are clustered into separate components.

See Also

as_matrix as_tidygraph as_network

Other creation: sample()

Examples

Run this code
# NOT RUN {
g <- create_empty(c(8,6))
plot(g)
g <- create_complete(c(8,6))
plot(g)
g <- create_ring(c(8,6), width = 2)
plot(g)
plot(create_components(c(10, 12), components = 3))
# }

Run the code above in your browser using DataLab