File: get.shortest.paths.Rd

package info (click to toggle)
r-cran-igraph 2.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,044 kB
  • sloc: ansic: 204,981; cpp: 21,711; fortran: 4,090; yacc: 1,229; lex: 519; sh: 52; makefile: 8
file content (82 lines) | stat: -rw-r--r-- 4,003 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{get.shortest.paths}
\alias{get.shortest.paths}
\title{Shortest (directed or undirected) paths between vertices}
\usage{
get.shortest.paths(
  graph,
  from,
  to = V(graph),
  mode = c("out", "all", "in"),
  weights = NULL,
  output = c("vpath", "epath", "both"),
  predecessors = FALSE,
  inbound.edges = FALSE,
  algorithm = c("automatic", "unweighted", "dijkstra", "bellman-ford")
)
}
\arguments{
\item{graph}{The graph to work on.}

\item{from}{Numeric constant, the vertex from or to the shortest paths will
be calculated. Note that right now this is not a vector of vertex ids, but
only a single vertex.}

\item{to}{Numeric vector, the vertices to which the shortest paths will be
calculated. By default it includes all vertices. Note that for
\code{distances()} every vertex must be included here at most once. (This
is not required for \code{shortest_paths()}.}

\item{mode}{Character constant, gives whether the shortest paths to or from
the given vertices should be calculated for directed graphs. If \code{out}
then the shortest paths \emph{from} the vertex, if \verb{in} then \emph{to}
it will be considered. If \code{all}, the default, then the graph is treated
as undirected, i.e. edge directions are not taken into account. This
argument is ignored for undirected graphs.}

\item{weights}{Possibly a numeric vector giving edge weights. If this is
\code{NULL} and the graph has a \code{weight} edge attribute, then the
attribute is used. If this is \code{NA} then no weights are used (even if
the graph has a \code{weight} attribute). In a weighted graph, the length
of a path is the sum of the weights of its constituent edges.}

\item{output}{Character scalar, defines how to report the shortest paths.
\dQuote{vpath} means that the vertices along the paths are reported, this
form was used prior to igraph version 0.6. \dQuote{epath} means that the
edges along the paths are reported. \dQuote{both} means that both forms are
returned, in a named list with components \dQuote{vpath} and \dQuote{epath}.}

\item{predecessors}{Logical scalar, whether to return the predecessor vertex
for each vertex. The predecessor of vertex \code{i} in the tree is the
vertex from which vertex \code{i} was reached. The predecessor of the start
vertex (in the \code{from} argument) is itself by definition. If the
predecessor is zero, it means that the given vertex was not reached from the
source during the search. Note that the search terminates if all the
vertices in \code{to} are reached.}

\item{inbound.edges}{Logical scalar, whether to return the inbound edge for
each vertex. The inbound edge of vertex \code{i} in the tree is the edge via
which vertex \code{i} was reached. The start vertex and vertices that were
not reached during the search will have zero in the corresponding entry of
the vector. Note that the search terminates if all the vertices in \code{to}
are reached.}

\item{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.}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}

\code{get.shortest.paths()} was renamed to \code{shortest_paths()} to create a more
consistent API.
}
\keyword{internal}