%% Node Predecessors
% Create and plot a directed graph and determine the predecessor nodes of node 'e'.

s = [1 1 1 2 2 3 3 7 8];
t = [2 3 4 5 6 7 8 5 5];
names = {'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h'};
G = digraph(s,t,[],names);
plot(G)

%

preIDs = predecessors(G,'e')

% Copyright 2015 The MathWorks, Inc.