| extract_edges | R Documentation |
Extract an edge list from a TNA model, representing the network as a data frame of from-to-weight tuples.
extract_edges(model, threshold = 0, include_self = FALSE, sort_by = "weight")
model |
A TNA model object or a matrix of weights. |
threshold |
Numeric. Minimum weight to include an edge. Default: 0. |
include_self |
Logical. Whether to include self-loops. Default: FALSE. |
sort_by |
Character. Column to sort by: "weight" (descending), "from", "to", or NULL for no sorting. Default: "weight". |
This function converts the transition matrix into an edge list format, which is useful for visualization, analysis with igraph, or export to other network tools.
A data frame with columns:
Source state name.
Target state name.
Edge weight (transition probability).
extract_transition_matrix for the full matrix,
build_network for network estimation.
seqs <- data.frame(V1 = c("A","B","A"), V2 = c("B","A","C"), V3 = c("A","C","B"))
net <- build_network(seqs, method = "relative")
edges <- extract_edges(net, threshold = 0.05)
head(edges)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.