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

    %% Refine Layout Method of Graph
% Create and plot a graph using the |'layered'| layout method.

% Copyright 2015 The MathWorks, Inc.

s = [1 1 1 2 3 3 3 4 4];
t = [2 4 5 6 2 4 7 8 1];
G = digraph(s,t);
h = plot(G,'Layout','layered');

%%
% Use the |layout| function to refine the hierarchical layout by specifying
% source nodes and a horizontal orientation.
layout(h,'layered','Direction','right','Sources',[1 4])