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

    %% Label Graph Edge Weight
% Create and plot a graph.

% Copyright 2015 The MathWorks, Inc.

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

%%
% Label the edge weights using |labeledge|.
weights = [5 10 15 10 10];
labeledge(h,1:numedges(G),weights)