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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{degree}
\alias{degree}
\alias{max_degree}
\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
)
max_degree(
graph,
...,
v = V(graph),
mode = c("all", "out", "in", "total"),
loops = TRUE
)
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{...}{These dots are for future extensions and must be empty.}
\item{cumulative}{Logical; whether the cumulative degree distribution is to
be calculated.}
}
\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.
For \code{max_degree()}, the largest degree in the graph. When no vertices are
selected, or when the input is the null graph, zero is returned as this
is the smallest possible degree.
}
\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)
max_degree(g2)
degree_distribution(g2)
}
\seealso{
Other structural.properties:
\code{\link{bfs}()},
\code{\link{component_distribution}()},
\code{\link{connect}()},
\code{\link{constraint}()},
\code{\link{coreness}()},
\code{\link{dfs}()},
\code{\link{distance_table}()},
\code{\link{edge_density}()},
\code{\link{feedback_arc_set}()},
\code{\link{girth}()},
\code{\link{is_acyclic}()},
\code{\link{is_dag}()},
\code{\link{is_matching}()},
\code{\link{k_shortest_paths}()},
\code{\link{knn}()},
\code{\link{reciprocity}()},
\code{\link{subcomponent}()},
\code{\link{subgraph}()},
\code{\link{topo_sort}()},
\code{\link{transitivity}()},
\code{\link{unfold_tree}()},
\code{\link{which_multiple}()},
\code{\link{which_mutual}()}
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\concept{structural.properties}
\keyword{graphs}
\section{Related documentation in the C library}{\href{https://igraph.org/c/html/latest/igraph-Structural.html#igraph_maxdegree}{\code{igraph_maxdegree()}}.}
|