1function test00
2%TEST00 test GB_mex_mis
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7fprintf ('\ntest00: MIS\n') ;
8rng ('default') ;
9
10for n = 1:10
11    for d = 0:.1:1
12        for k = 1:100
13            % A must be symmetric, with no diagonal
14            A = sprand (n, n, d) ;
15            A = A+A' ;
16            A = tril (A, -1) ;
17            A = A+A' ;
18            % find a maximal independent set
19            s = GB_mex_mis (A) ;
20            p = find (s == 1) ;
21            S = A (p,p) ;
22            % make sure it's independent
23            assert (nnz (S) == 0)
24        end
25    end
26end
27
28fprintf ('\ntest00: all tests passed\n') ;
29
30