network_girth: Network Girth (Shortest Cycle Length)

View source: R/network-summary.R

network_girthR Documentation

Network Girth (Shortest Cycle Length)

Description

Computes the girth of a network - the length of the shortest cycle. Returns Inf for acyclic graphs (trees, DAGs).

Usage

network_girth(x, ...)

Arguments

x

Network input: matrix, igraph, network, cograph_network, or tna object

...

Additional arguments passed to to_igraph

Value

Integer: length of shortest cycle, or Inf if no cycles exist

Examples

# Triangle has girth 3
triangle <- matrix(c(0,1,1, 1,0,1, 1,1,0), 3, 3)
network_girth(triangle)  # 3

# Tree has no cycles (Inf)
tree <- matrix(c(0,1,0, 1,0,1, 0,1,0), 3, 3)
network_girth(tree)  # Inf

cograph documentation built on April 1, 2026, 1:07 a.m.