find_all_paths: All paths between two groups of vertices

View source: R/graph.R

find_all_pathsR Documentation

All paths between two groups of vertices

Description

Finds all paths up to length 'maxlen' between specified groups of vertices. This function is needed only becaues igraph's 'all_shortest_paths' finds only the shortest, not any path up to a defined length.

Usage

find_all_paths(
    graph,
    start,
    end,
    attr = NULL,
    mode = 'OUT',
    maxlen = 2,
    progress = TRUE
)

Arguments

graph

An igraph graph object.

start

Integer or character vector with the indices or names of one or more start vertices.

end

Integer or character vector with the indices or names of one or more end vertices.

attr

Character: name of the vertex attribute to identify the vertices by. Necessary if 'start' and 'end' are not igraph vertex ids but for example vertex names or labels.

mode

Character: IN, OUT or ALL. Default is OUT.

maxlen

Integer: maximum length of paths in steps, i.e. if maxlen = 3, then the longest path may consist of 3 edges and 4 nodes.

progress

Logical: show a progress bar.

Value

List of vertex paths, each path is a character or integer vector.

See Also

  • interaction_graph

  • enzsub_graph

  • giant_component

Examples

interactions <- import_omnipath_interactions()
graph <- interaction_graph(interactions)
paths <- find_all_paths(
    graph = graph,
    start = c('EGFR', 'STAT3'),
    end = c('AKT1', 'ULK1'),
    attr = 'name'
)


saezlab/OmnipathR documentation built on Oct. 16, 2024, 11:49 a.m.