--- title: "Finding cliques and communities with tna" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Finding cliques and communities with tna} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, fig.width = 10, fig.height = 6, out.width = "100%", dpi = 300, 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 `engagement`. ```{r} library("tna") data("engagement", package = "tna") ``` We fit the TNA model to the data. ```{r} tna_model <- tna(engagement) 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. ```{r, warning = FALSE} 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. ```{r, figures-side, fig.show="hold", out.width="30%", fig.height=8, fig.width=4} dyads <- cliques(tna_model, size = 2) triads <- cliques(tna_model, size = 3) plot(dyads) plot(triads) ```