Learn R Programming

cograph (version 1.5.2)

is_directed: Check if Network is Directed

Description

Checks whether a cograph_network is directed.

Usage

is_directed(x)

Value

Logical: TRUE if directed, FALSE if undirected.

Arguments

x

A cograph_network object.

See Also

as_cograph

Examples

Run this code
# Symmetric matrix -> undirected
mat <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), nrow = 3)
net <- as_cograph(mat)
is_directed(net)  # FALSE

# Asymmetric matrix -> directed
mat2 <- matrix(c(0, 1, 0, 0, 0, 1, 0, 0, 0), nrow = 3)
net2 <- as_cograph(mat2)
is_directed(net2)  # TRUE

Run the code above in your browser using DataLab