ShortestPath {intensitynet} | R Documentation |
Given two nodes, calculates the shortest path and its total weight
Description
Calculates the shortest path between two vertices (based on the minimum amount of edges) and calculates its total weight
Usage
ShortestPath(obj, node_id1, node_id2, weight = NA, mode = "all")
## S3 method for class 'intensitynet'
ShortestPath(obj, node_id1, node_id2, weight = NA, mode = "all")
Arguments
obj |
intensitynet object |
node_id1 |
starting node |
node_id2 |
ending node |
weight |
an string, calculate the shortest path based on this type of weight. If no weight type is provided, the function will calculate the shortest path based on the minimum amount of edges. Default NA. |
mode |
Character 'in', 'out', 'all' (default). Gives whether the shortest paths to or from the given vertices should be calculated for directed graphs. If out then the shortest paths from the vertex, if in then to it will be considered. If all, the default, then the corresponding undirected graph will be used, ie. not directed paths are searched. This argument is ignored for undirected graphs. |
Value
total weight of the shortest path and the path vertices with class igraph.vs
Examples
data("und_intnet_chicago")
ShortestPath(und_intnet_chicago, node_id1 = 'V1', node_id2 = 'V300', weight = 'intensity')