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

    %% Add Edges to Graph
% Add two new edges to an existing graph. Since one of the new edges
% references a node that does not exist, |addedge| automatically adds the
% required fourth node to the graph.

% Copyright 2015 The MathWorks, Inc.

G = graph([1 2],[2 3])

%%
%
G = addedge(G,[2 1],[4 3])