outedges

Indices of the edges leaving a node.

Category: Mathematics > Graph and Network Algorithms

Syntax

eid = outedges(D, nodeID)

Returns the indices of the edges that start at nodeID.

[eid, nid] = outedges(D, nodeID)

Also returns the nodes at the other end of those edges.

Description

It is the counterpart of inedges. Use the indices to look up weights: D.Edges.Weight(outedges(D, n)). successors gives only the neighboring nodes, while outedges identifies the edges, which matters for parallel edges.

Input arguments

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

Output arguments

eid
Column vector of edge indices, rows of D.Edges.
nid
Column vector of the target nodes of those edges.

Example

Edges leaving node 3

D = digraph([1 2 3 3], [2 3 1 4], [1 2 3 4]);
[eid, nid] = outedges(D, 3)
D.Edges.Weight(eid)'
Output
eid = 2×1

     3
     4
nid = 2×1

     1
     4
ans = 1×2

     3     4

See also

inedges successors outdegree findedge