Degree and degree distribution of the vertices
The degree of a vertex is its most basic structural property, the number of its adjacent edges.
degree(graph, v = V(graph), mode = c("all", "out", "in", "total"), loops = TRUE, normalized = FALSE)
degree_distribution(graph, cumulative = FALSE, ...)
- The graph to analyze.
- The ids of vertices of which the degree will be calculated.
- Character string,
outfor out-degree, infor in-degree or totalfor the sum of the two. For undirected graphs this argument is ignored. allis a synonym of total.
- Logical; whether the loop edges are also counted.
- Logical scalar, whether to normalize the degree. If
TRUEthen the result is divided by $n-1$, where $n$ is the number of vertices in the graph.
- Logical; whether the cumulative degree distribution is to be calculated.
- Additional arguments to pass to
modeis useful but also
degreea numeric vector of the same length as argument
degree_distributiona 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.
g <- make_ring(10) degree(g) g2 <- sample_gnp(1000, 10/1000) degree_distribution(g2)