Learn R Programming

cograph (version 2.7.2)

select_k_core: Select the k-Core of a Network

Description

The k-core is the maximal subgraph in which every node has degree at least k, found by repeatedly removing nodes of degree below k.

Usage

select_k_core(x, k, keep_format = FALSE, directed = NULL)

Value

A cograph_network holding the k-core, or the input format when keep_format = TRUE. An empty network when no node reaches coreness k.

Arguments

x

Network input.

k

Integer. The core number.

keep_format

Logical. Return the input format when TRUE.

directed

Logical or NULL. If NULL (default), auto-detect.

References

Seidman, S. B. (1983). Network structure and minimum degree. Social Networks, 5(3), 269--287.

See Also

select_nodes, centrality

Examples

Run this code
adj <- matrix(c(0, 1, 1, 1,
                1, 0, 1, 0,
                1, 1, 0, 0,
                1, 0, 0, 0), 4, 4, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B", "C", "D")

select_k_core(adj, k = 2)

Run the code above in your browser using DataLab