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
|
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{degree}
\alias{degree}
\alias{degree.distribution}
\alias{degree_distribution}
\title{Degree and degree distribution of the vertices}
\usage{
degree(graph, v = V(graph), mode = c("all", "out", "in", "total"),
loops = TRUE, normalized = FALSE)
degree_distribution(graph, cumulative = FALSE, ...)
}
\arguments{
\item{graph}{The graph to analyze.}
\item{v}{The ids of vertices of which the degree will be calculated.}
\item{mode}{Character string, \dQuote{out} for out-degree, \dQuote{in} for
in-degree or \dQuote{total} for the sum of the two. For undirected graphs
this argument is ignored. \dQuote{all} is a synonym of \dQuote{total}.}
\item{loops}{Logical; whether the loop edges are also counted.}
\item{normalized}{Logical scalar, whether to normalize the degree. If
\code{TRUE} then the result is divided by \eqn{n-1}, where \eqn{n} is the
number of vertices in the graph.}
\item{cumulative}{Logical; whether the cumulative degree distribution is to
be calculated.}
\item{\dots}{Additional arguments to pass to \code{degree}, eg. \code{mode}
is useful but also \code{v} and \code{loops} make sense.}
}
\value{
For \code{degree} a numeric vector of the same length as argument
\code{v}.
For \code{degree_distribution} a numeric vector of the same length as the
maximum degree plus one. The first element is the relative frequency zero
degree vertices, the second vertices with degree one, etc.
}
\description{
The degree of a vertex is its most basic structural property, the number of
its adjacent edges.
}
\examples{
g <- make_ring(10)
degree(g)
g2 <- sample_gnp(1000, 10/1000)
degree_distribution(g2)
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\keyword{graphs}
|