find_paths {rsemmed} | R Documentation |
Find all shortest paths between sets of nodes
find_paths(graph, from, to, weights = NULL)
graph |
The SemMed graph |
from |
A set of source nodes. |
to |
A set of destination nodes. |
weights |
A numeric vector of edge weights. If |
find_paths
relies on igraph::all_shortest_paths
to find all
shortest paths between the nodes in from
and to
. This
function searches for undirected paths.
Because the Semantic MEDLINE graph is a multigraph, there may be multiple
paths with the same sequence of nodes. This function collapses these into
a single node sequence. The display functions (text_path
and
plot_path
) take care of showing the multiple edges leading to
repeated paths.
A list of shortest paths. List items correspond to the
node(s) given in from
.
make_edge_weights
to tailor the
shortest path search
data(g_mini) node_cortisol <- find_nodes(g_mini, names = "Serum cortisol") node_stress <- find_nodes(g_mini, names = "Chronic Stress") find_paths(g_mini, from = node_cortisol, to = node_stress)