Finding cliques and communities with tna

knitr::opts_chunk$set(
  collapse = TRUE,
  fig.width = 6,
  fig.height = 4,
  out.width = "100%",
  dev = "jpeg",
  dpi = 100,
  comment = "#>"
)

The tna package includes functionalities for finding cliques of the transition network as well as discovering communities. We begin by loading the package and the example data set group_regulation.

library("tna")
data("group_regulation", package = "tna")

We fit the TNA model to the data.

tna_model <- tna(group_regulation)
print(tna_model)
plot(tna_model)

Next, we apply several community finding algorithms to the model (see ?communities for more details), and plot the results for the leading_eigen algorithm.

cd <- communities(tna_model)
plot(cd, method = "leading_eigen")

Cliques can be obtained with the cliques function. Here we look for dyads and triads by setting size = 2 and size = 3, respectively. Finally, we plot the results.

layout(matrix(1:4, ncol = 2, byrow = TRUE))
dyads <- cliques(tna_model, size = 2, threshold = 0.2)
triads <- cliques(tna_model, size = 3, threshold = 0.05)
plot(dyads, ask = FALSE)
plot(triads, ask = FALSE)


Try the tna package in your browser

Any scripts or data that you put into this service are public.

tna documentation built on Aug. 8, 2025, 6:42 p.m.