ShortestPath function

Given two nodes, calculates the shortest path and its total weight

Given two nodes, calculates the shortest path and its total weight

Calculates the shortest path between two vertices (based on the minimum amount of edges) and calculates its total weight

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.

Returns

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')
  • Maintainer: Pol Llagostera
  • License: GPL-3
  • Last published: 2023-04-11

Useful links