successors

Nodes that a given node of a digraph points to.

Category: Mathematics > Graph and Network Algorithms

Syntax

nodes = successors(D, nodeID)

Returns the nodes at the end of the edges leaving nodeID.

Description

In a dependency graph the successors of a task are those that depend on it. successors and predecessors are the two halves of neighbors for a digraph. Use outedges if you also need the edge indices.

Input arguments

D
A digraph.
nodeID
A single node, as index or name.

Output arguments

nodes
Column vector of node indices (a cell array of names for a named graph), in increasing order.

Example

Who node 1 points at

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

     2     3
ans = 1×0 empty double row vector

See also

predecessors outedges neighbors outdegree