www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/NodeSuccessorsExample.m

    %% Node Successors
% Create and plot a directed graph and determine the successor nodes of
% node |'a'|.

% Copyright 2015 The MathWorks, Inc.

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)

%%
%
sucIDs = successors(G,'a')