View source: R/structural.properties.R
shortest.paths | R Documentation |
shortest.paths()
was renamed to distances()
to create a more
consistent API.
shortest.paths(
graph,
v = V(graph),
to = V(graph),
mode = c("all", "out", "in"),
weights = NULL,
algorithm = c("automatic", "unweighted", "dijkstra", "bellman-ford", "johnson")
)
graph |
The graph to work on. |
v |
Numeric vector, the vertices from which the shortest paths will be calculated. |
to |
Numeric vector, the vertices to which the shortest paths will be
calculated. By default it includes all vertices. Note that for
|
mode |
Character constant, gives whether the shortest paths to or from
the given vertices should be calculated for directed graphs. If |
weights |
Possibly a numeric vector giving edge weights. If this is
|
algorithm |
Which algorithm to use for the calculation. By default igraph tries to select the fastest suitable algorithm. If there are no weights, then an unweighted breadth-first search is used, otherwise if all weights are positive, then Dijkstra's algorithm is used. If there are negative weights and we do the calculation for more than 100 sources, then Johnson's algorithm is used. Otherwise the Bellman-Ford algorithm is used. You can override igraph's choice by explicitly giving this parameter. Note that the igraph C core might still override your choice in obvious cases, i.e. if there are no edge weights, then the unweighted algorithm will be used, regardless of this argument. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.