%% Perform Breadth-First Graph Search
% Create and plot a graph.

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

%
% Perform a breadth-first search of the graph starting at node 2. The result indicates the order of node discovery.

v = bfsearch(G,2)

% Copyright 2015 The MathWorks, Inc.