%% Filter Out Dense Columns
% An arrowhead matrix is a sparse matrix that has a few dense columns. Use the 'MaxDegreeThreshold' name-value pair to filter the dense columns to the end of the reordered matrix.
%
% Create an arrowhead sparse matrix and view the sparsity pattern.

A = speye(100) + diag(ones(1,99),1) + diag(ones(1,98),2);
A(1:5,:) = ones(5,100);
A = A + A';
spy(A)

%
% Calculate the nested dissection ordering, and filter out the columns that have more than 10 nonzero elements.

p = dissect(A,'MaxDegreeThreshold',10);

%
% View the sparsity pattern of the reordered matrix. dissect places the dense columns at the end of the reordered matrix.

spy(A(p,p))

% Copyright 2012 The MathWorks, Inc.