View source: R/network-summary.R
| network_girth | R Documentation |
Computes the girth of a network - the length of the shortest cycle. Returns Inf for acyclic graphs (trees, DAGs).
network_girth(x, ...)
x |
Network input: matrix, igraph, network, cograph_network, or tna object |
... |
Additional arguments passed to |
Integer: length of shortest cycle, or Inf if no cycles exist
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.