%% Highlight Minimum Spanning Tree of Graph
% Create and plot a graph. Return a handle to the GraphPlot object, h.

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

%
% Calculate the minimum spanning tree of the graph. Highlight the minimum spanning tree subgraph in the plot by increasing the line width and changing the color of the edges in the tree.

[T,p] = minspantree(G);
highlight(h,T,'EdgeColor','r','LineWidth',1.5)

% Copyright 2015 The MathWorks, Inc.