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

    %% Graph Layout Based on Structure
% Create and plot a graph using the |'force'| layout.

% Copyright 2015 The MathWorks, Inc.

s = [1 1 1 1 1 6 6 6 6 6];
t = [2 3 4 5 6 7 8 9 10 11];
G = graph(s,t);
h = plot(G,'Layout','force');

%%
% Change the layout to be the default that |plot| determines based on the
% structure and properties of the graph. The result is the same as using
% |plot(G)|.
layout(h)