File: closeness.Rd

package info (click to toggle)
r-cran-igraph 1.0.1-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,232 kB
  • sloc: ansic: 173,538; cpp: 19,365; fortran: 4,550; yacc: 1,164; tcl: 931; lex: 484; makefile: 149; sh: 9
file content (80 lines) | stat: -rw-r--r-- 2,703 bytes parent folder | download | duplicates (2)
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
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{closeness}
\alias{closeness}
\alias{closeness.estimate}
\alias{estimate_closeness}
\title{Closeness centrality of vertices}
\usage{
closeness(graph, vids = V(graph), mode = c("out", "in", "all", "total"),
  weights = NULL, normalized = FALSE)

estimate_closeness(graph, vids = V(graph), mode = c("out", "in", "all",
  "total"), cutoff, weights = NULL, normalized = FALSE)
}
\arguments{
\item{graph}{The graph to analyze.}

\item{vids}{The vertices for which closeness will be calculated.}

\item{mode}{Character string, defined the types of the paths used for
measuring the distance in directed graphs. \dQuote{in} measures the paths
\emph{to} a vertex, \dQuote{out} measures paths \emph{from} a vertex,
\emph{all} uses undirected paths. This argument is ignored for undirected
graphs.}

\item{weights}{Optional positive weight vector for calculating weighted
closeness. If the graph has a \code{weight} edge attribute, then this is
used by default.}

\item{normalized}{Logical scalar, whether to calculate the normalized
closeness. Normalization is performed by multiplying the raw closeness by
\eqn{n-1}, where \eqn{n} is the number of vertices in the graph.}

\item{cutoff}{The maximum path length to consider when calculating the
betweenness. If zero or negative then there is no such limit.}
}
\value{
Numeric vector with the closeness values of all the vertices in
\code{v}.
}
\description{
Cloness centrality measures how many steps is required to access every other
vertex from a given vertex.
}
\details{
The closeness centrality of a vertex is defined by the inverse of the
average length of the shortest paths to/from all the other vertices in the
graph:

\deqn{\frac{1}{\sum_{i\ne v} d_vi}}{1/sum( d(v,i), i != v)}

If there is no (directed) path between vertex \eqn{v}{\code{v}} and
\eqn{i}{\code{i}} then the total number of vertices is used in the formula
instead of the path length.

\code{estimate_closeness} only considers paths of length \code{cutoff} or
smaller, this can be run for larger graphs, as the running time is not
quadratic (if \code{cutoff} is small). If \code{cutoff} is zero or negative
then the function calculates the exact closeness scores.
}
\examples{
g <- make_ring(10)
g2 <- make_star(10)
closeness(g)
closeness(g2, mode="in")
closeness(g2, mode="out")
closeness(g2, mode="all")
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\references{
Freeman, L.C. (1979). Centrality in Social Networks I:
Conceptual Clarification. \emph{Social Networks}, 1, 215-239.
}
\seealso{
\code{\link{betweenness}}, \code{\link{degree}}
}
\keyword{graphs}