Extracts higher-order pathway strings suitable for
cograph::plot_simplicial(). Each pathway represents a
multi-step dependency: source states lead to a target state.
For net_hon: extracts edges where the source node is
higher-order (order > 1), i.e., the transitions that differ from
first-order Markov.
For net_hypa: extracts anomalous paths (over- or
under-represented relative to the hypergeometric null model).
For net_mogen: extracts all transitions at the optimal order
(or a specified order).
Usage
pathways(x, ...)
# S3 method for class 'net_hon'
pathways(x, min_count = 1L, min_prob = 0, top = NULL, order = NULL, ...)
# S3 method for class 'net_hypa'
pathways(x, type = "all", ...)
# S3 method for class 'netobject'
pathways(x, ho_method = c("hon", "hypa"), ...)
# S3 method for class 'net_association_rules'
pathways(x, top = NULL, min_lift = NULL, min_confidence = NULL, ...)
# S3 method for class 'net_link_prediction'
pathways(x, method = NULL, top = 10L, evidence = TRUE, max_evidence = 3L, ...)
# S3 method for class 'net_mogen'
pathways(x, order = NULL, min_count = 1L, min_prob = 0, top = NULL, ...)Arguments
- x
A higher-order network object (
net_hon,net_hypa,net_mogen), anetobject, anet_association_rulesor anet_link_prediction.- ...
Additional arguments passed on to the method.
- min_count
Integer. Minimum transition count to include (default: 1). Filters noise from rare observations. Used by the
net_honandnet_mogenmethods.- min_prob
Numeric. Minimum transition probability to include (default: 0). Useful for filtering weak transitions. Used by the
net_honandnet_mogenmethods.- top
Integer or NULL. Keep only the top N pathways: ranked by count for
net_honandnet_mogen, by lift then confidence fornet_association_rules, and by score fornet_link_prediction. DefaultNULL(all) everywhere exceptnet_link_prediction, whose default is10.- order
Integer or NULL. For
net_hon, keep only pathways whose source is of this order; defaultNULL= every order above 1. Fornet_mogen, the Markov order to extract; defaultNULL= the optimal order from model selection.- type
Character. Which anomalies to include:
"all"(default),"over", or"under".- ho_method
Character. Higher-order method:
"hon"(default) or"hypa".- min_lift
Numeric or NULL. Additional lift filter applied on top of the object's original threshold (default: NULL).
- min_confidence
Numeric or NULL. Additional confidence filter (default: NULL).
- method
Character or NULL. Which prediction method to use. Default: first method in the object.
- evidence
Logical. If TRUE, include common neighbor evidence nodes in each pathway. Default: TRUE.
- max_evidence
Integer. Maximum number of evidence nodes per pathway (default: 3).
Value
A character vector of pathway strings in arrow notation
(e.g. "A B -> C"), suitable for
cograph::plot_simplicial(). Every method returns this shape, and
character(0) when nothing survives its filters.
Methods (by class)
pathways(net_hon): Extract higher-order pathways from HONpathways(net_hypa): Extract anomalous pathways from HYPApathways(netobject): Extract pathways from a netobjectBuilds a Higher-Order Network (HON) from the netobject's sequence data and returns the higher-order pathways. Requires that the netobject was built from sequence data (has
$data).pathways(net_association_rules): Extract pathways from association rulesConverts association rules
{A, B} => {C}into pathway strings"A B -> C"suitable forcograph::plot_simplicial(). Antecedent items become source nodes; consequent items become the target. Rules whose antecedent and consequent share the same item set describe the same simplex, so only the highest-lift rule per item set is returned;topis applied after that de-duplication.pathways(net_link_prediction): Extract pathways from link predictionsConverts predicted links into pathway strings for
cograph::plot_simplicial(). Whenevidence = TRUE(default), each predicted edgeA -> Bis enriched with common neighbors that structurally support the prediction, producing"A cn1 cn2 -> B".pathways(net_mogen): Extract transition pathways from MOGen
Examples
# \donttest{
seqs <- list(c("A","B","C","D"), c("A","B","C","A"))
hon <- build_hon(seqs, max_order = 3)
pw <- pathways(hon)
# }
trans <- list(c("A","B","C"), c("A","B"), c("B","C","D"), c("A","C","D"))
rules <- association_rules(trans, min_support = 0.3, min_confidence = 0.3,
min_lift = 0)
pathways(rules)
#> [1] "D -> C" "A -> B" "A -> C" "B -> C"
seqs <- data.frame(
V1 = sample(LETTERS[1:5], 50, TRUE),
V2 = sample(LETTERS[1:5], 50, TRUE),
V3 = sample(LETTERS[1:5], 50, TRUE)
)
net <- build_network(seqs, method = "relative")
pred <- predict_links(net, methods = "common_neighbors")
pathways(pred)
#> [1] "C A B D -> E"