% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paths.R
\name{eccentricity}
\alias{eccentricity}
\title{Eccentricity of the vertices in a graph}
\usage{
eccentricity(
  graph,
  vids = V(graph),
  ...,
  weights = NULL,
  mode = c("all", "out", "in", "total")
)
}
\arguments{
\item{graph}{The input graph, it can be directed or undirected.}

\item{vids}{The vertices for which the eccentricity is calculated.}

\item{...}{These dots are for future extensions and must be empty.}

\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{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.}
}
\value{
\code{eccentricity()} returns a numeric vector, containing the
eccentricity score of each given vertex.
}
\description{
The eccentricity of a vertex is its shortest path distance from the farthest
other node in the graph.
}
\details{
The eccentricity of a vertex is calculated by measuring the shortest
distance from (or to) the vertex, to (or from) all vertices in the graph,
and taking the maximum.

This implementation ignores vertex pairs that are in different components.
Isolate vertices have eccentricity zero.
}
\section{Related documentation in the C library}{
\href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_eccentricity_dijkstra}{\code{eccentricity_dijkstra()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}}
}

\examples{
g <- make_star(10, mode = "undirected")
eccentricity(g)
}
\references{
Harary, F. Graph Theory. Reading, MA: Addison-Wesley, p. 35,
1994.
}
\seealso{
\code{\link[=radius]{radius()}} for a related concept,
\code{\link[=distances]{distances()}} for general shortest path calculations.

Other paths: 
\code{\link{all_simple_paths}()},
\code{\link{diameter}()},
\code{\link{distance_table}()},
\code{\link{graph_center}()},
\code{\link{radius}()}
}
\concept{paths}
