outdegree

Number of edges leaving each node of a digraph.

Category: Mathematics > Graph and Network Algorithms

Syntax

d = outdegree(D)

Returns the out-degree of every node.

d = outdegree(D, nodeIDs)

Returns the out-degree of the listed nodes only.

Description

A node with out-degree zero is a sink: it points nowhere. indegree(D) + outdegree(D) equals degree(D). The sum of all out-degrees is numedges(D).

Input arguments

D
A digraph.
nodeIDs
Node indices or names.

Output arguments

d
Column vector with the number of edges that start at each node.

Example

Finding sinks

D = digraph([1 1 2 3 4], [2 3 4 4 5]);
outdegree(D)'
find(outdegree(D) == 0)
Output
ans = 1×5

     2     1     1     1     0
ans = 5

See also

indegree degree outedges successors