pathways: Highlight shortest pathways in a network

View source: R/pathways.R

pathwaysR Documentation

Highlight shortest pathways in a network

Description

This function highlights the shortest paths between nodes in a network made by qgraph. Based on Isvoranu et al. (2016).

Usage

pathways(graph, from, to, fading = 0.25, lty = 3)

Arguments

graph

Output from qgraph.

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'.

Author(s)

Sacha Epskamp and Adela M. Isvoranu

References

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.

See Also

qgraph

Examples

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"))


qgraph documentation built on Nov. 3, 2023, 5:07 p.m.

Related to pathways in qgraph...