%% In-degree of Subset of Graph Nodes
% Create and plot a directed graph with named nodes. Then compute the number of edges that have the 'a', 'b', and 'f' nodes as their target.

s = {'a' 'c' 'b' 'b' 'd' 'e' 'a' 'b'};
t = {'b' 'b' 'd' 'e' 'f' 'f' 'f' 'f'};
G = digraph(s,t);
plot(G)

%

nodeID = {'a' 'b' 'f'}';
indeg = indegree(G,nodeID)

% indeg(j) indicates the in-degree of node nodeID(j).
% Copyright 2015 The MathWorks, Inc.