%% Reverse Cuthill-McKee Ordering
% The statement

B = bucky;

% uses a function in the demos toolbox to generate the adjacency graph of a truncated icosahedron. This is better known as a soccer ball, a Buckminster Fuller geodesic dome (hence the name bucky), or, more recently, as a 60-atom carbon molecule. There are 60 vertices. The vertices have been ordered by numbering half of them from one hemisphere, pentagon by pentagon; then reflecting into the other hemisphere and gluing the two halves together.
%
% With this numbering, the matrix does not have a particularly narrow bandwidth, as the first spy plot shows:

figure();
subplot(1,2,1),spy(B),title('B')

%
% The reverse Cuthill-McKee ordering is obtained with:

p = symrcm(B);
R = B(p,p);

%
% The spy plot shows a much narrower bandwidth.

subplot(1,2,2),spy(R),title('B(p,p)')

% This example is continued in the reference page for symamd.
%
% The bandwidth can also be computed with:

[i,j] = find(B);
bw = max(i-j) + 1;

% The bandwidths of B and R are 35 and 12, respectively.
% Copyright 2015 The MathWorks, Inc.