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

    %% Remove Node from Graph
% Create and plot a graph.

% Copyright 2015 The MathWorks, Inc.

s = [1 1 1 2 2 3];
t = [2 3 4 3 4 4];
G = graph(s,t);
plot(G)

%%
% Remove node 1 from the graph and plot the result. The nodes in the new
% graph are automatically renumbered.
G = rmnode(G,1);
plot(G)