get_middle_nodes {rsemmed} | R Documentation

## Obtain the middle nodes of a path

### Description

For each pair of source and target nodes in `object`, obtain the names of middle nodes on paths.

### Usage

    get_middle_nodes(graph, object, collapse = TRUE)

### Arguments

`graph` | The SemMed graph
`object` | A vertex sequence (`igraph.vs`), a list of vertex sequences, or a list of vertex sequence lists
`collapse` | If `TRUE`, middle node names for different source-target pairs are combined into one character vector.

### Value

A `tbl` where each row corresponds to a source-target pair in `object`. The last column is a list-column containing character vectors of names of middle nodes.

### Examples

    data(g_mini)

    node_cortisol <- find_nodes(g_mini, "Serum cortisol")
    node_stress <- find_nodes(g_mini, "Chronic Stress")
    paths <- find_paths(g_mini, from = node_cortisol, to = node_stress)
    middle <- get_middle_nodes(g_mini, paths)

[Package rsemmed version 1.4.0 Index]