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

    %% Remove Several Named Nodes from Graph
% Create and plot a graph with named nodes.

% Copyright 2015 The MathWorks, Inc.

s = [1 1 1 1 2 2 3 3 3 5 5];
t = [2 3 4 6 1 5 4 5 6 4 6];
names = {'New York' 'Los Angeles' 'Washington D.C.' 'Pittsburgh' ...
    'Denver' 'Austin'};
G = digraph(s,t,[],names);
plot(G)

%%
% Remove the nodes |'New York'| and |'Pittsburgh'| from the graph, then
% replot the result.
G = rmnode(G,{'New York' 'Pittsburgh'});
plot(G,'Layout','force')