%% Edge Line Width Proportional to Edge Weight
% Create a weighted graph.

s = [1 1 1 1 2 2 3 4 4 5 6];
t = [2 3 4 5 3 6 6 5 7 7 7];
weights = [50 10 20 80 90 90 30 20 100 40 60];
G = graph(s,t,weights)

%
% Plot the graph, labeling the edges with their weights, and making the width of the edges proportional to their weights. Use a rescaled version of the edge weights to determine the width of each edge, such that the widest line has a width of 5.

LWidths = 5*G.Edges.Weight/max(G.Edges.Weight);
plot(G,'EdgeLabel',G.Edges.Weight,'LineWidth',LWidths)

% Copyright 2015 The MathWorks, Inc.