degree {igraph}R Documentation

Degree and degree distribution of the vertices

Description

The degree of a vertex is its most basic structural property, the number of its adjacent edges.

Usage

degree(
  graph,
  v = V(graph),
  mode = c("all", "out", "in", "total"),
  loops = TRUE,
  normalized = FALSE
)

degree_distribution(graph, cumulative = FALSE, ...)

Arguments

graph

The graph to analyze.

v

The ids of vertices of which the degree will be calculated.

mode

Character string, “out” for out-degree, “in” for in-degree or “total” for the sum of the two. For undirected graphs this argument is ignored. “all” is a synonym of “total”.

loops

Logical; whether the loop edges are also counted.

normalized

Logical scalar, whether to normalize the degree. If TRUE then the result is divided by n-1, where n is the number of vertices in the graph.

cumulative

Logical; whether the cumulative degree distribution is to be calculated.

...

Additional arguments to pass to degree(), e.g. mode is useful but also v and loops make sense.

Value

For degree() a numeric vector of the same length as argument v.

For 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.

Author(s)

Gabor Csardi csardi.gabor@gmail.com

See Also

Other structural.properties: bfs(), component_distribution(), connect(), constraint(), coreness(), dfs(), distance_table(), edge_density(), feedback_arc_set(), girth(), is_acyclic(), is_dag(), is_matching(), k_shortest_paths(), knn(), reciprocity(), subcomponent(), subgraph(), topo_sort(), transitivity(), unfold_tree(), which_multiple(), which_mutual()

Examples


g <- make_ring(10)
degree(g)
g2 <- sample_gnp(1000, 10 / 1000)
degree_distribution(g2)


[Package igraph version 2.0.3 Index]