Highlight shortest pathways in a network
This function highlights the shortest paths between nodes in a network made by qgraph
. Based on Isvoranu et al. (2016).
pathways(graph, from, to, fading = 0.25, lty = 3)
graph |
Output from |
from |
A vector indicating the first set of nodes between which pathways should be highlighted. Can be numeric or characters corresponding to node labels. |
to |
A vector indicating the second set of nodes between which pathways should be highlighted. Can be numeric or characters corresponding to node labels. |
fading |
The fading of the edges that are not part of shortest paths between 'from' and 'to'. |
lty |
The line type of the edges that are not part of shortest paths between 'from' and 'to'. |
Sacha Epskamp \& Adela M. Isvoranu
Isvoranu, A. M., van Borkulo, C. D., Boyette, L. L., Wigman, J. T., Vinkers, C. H., Borsboom, D., & Group Investigators. (2016). A Network Approach to Psychosis: Pathways Between Childhood Trauma and Psychotic Symptoms. Schizophrenia bulletin, sbw055.
library("qgraph") library("psych") data(bfi) # Compute correlations: CorMat <- cor_auto(bfi[,1:25]) # Compute graph with tuning = 0 (BIC): BICgraph <- qgraph(CorMat, graph = "glasso", sampleSize = nrow(bfi), tuning = 0, layout = "spring", title = "BIC", details = TRUE) # All paths between Agreeableness and Neuroticism: pathways(BICgraph, from = c("A1","A2","A3","A4","A5"), to = c("N1","N2","N3","N4","N5"))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.