1function [G_coarse, A_coarse, map] = coarsen (G, O, A)      %#ok
2%COARSEN coarsen a graph unsafely but quickly.
3%   coarsen(G) computes a matching of vertices in the graph G and then coarsens
4%   the graph by combining all matched vertices into supervertices. It assumes
5%   that the matrix G provided has an all zero diagonal, is symmetric, and has
6%   all positive edge weights. With no option struct specified, the coarsening
7%   is done using a combination of heavy-edge matching and other more
8%   aggressive techniques to avoid stalling. An optional vertex weight vector A
9%   can also be specified.  Note that mongoose_coarsen_mex does NOT check to
10%   see if the supplied matrix is of the correct form, and may provide
11%   erroneous results if used incorrectly.
12%
13%   [G_coarse, A_coarse, map] = coarsen(G) coarsens a graph represented with
14%   sparse adjacency matrix G. G_coarse is the coarsened adjacency matrix,
15%   A_coarse is the coarsened array of vertex weights, and map is a mapping of
16%   original vertices to coarsened vertices.
17%
18%   [G_coarse, A_coarse, map] = coarsen(G, O) uses the option struct O to
19%   specify coarsening options (e.g. matching strategies).
20%
21%   [G_coarse, A_coarse, map] = coarsen(G, O, A) uses the array A as vertex
22%   weights, such that A(i) is the vertex weight of vertex i. If A is not
23%   specified, A is assumed to be an array of all ones (all weights are one).
24%
25%   Example:
26%       Prob = ssget('DNVS/troll'); A = Prob.A;
27%       G = sanitize(A);
28%       G_coarse = coarsen(G);
29%       subplot(1,2,1); spy(G); subplot(1,2,2); spy(G_coarse);
30%
31%   See also SAFE_COARSEN, EDGECUT_OPTIONS.
32
33%   Copyright (c) 2018, N. Yeralan, S. Kolodziej, T. Davis, W. Hager
34
35error ('coarsen mexFunction not found') ;
36