Cody

Problem 2647. Find the maximal cliques in an undirected graph

Solution 2084243

Submitted on 9 Jan 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
A = 0; assert(isequal(maximalcliques(A),1))

Assertion failed.

2   Fail
for ii=1:10 N = randi(100); A = ones(N)-eye(N); assert(isequal(maximalcliques(A),ones(N,1))) end

Assertion failed.

3   Fail
for ii=1:10 N = randi(100); A = zeros(N); C = maximalcliques(A); assert(isequal(fliplr(sortrows(C')'),eye(N))) end

Assertion failed.

4   Fail
A = [ 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 ]; C = maximalcliques(A); C = fliplr(sortrows(C')'); C_correct = [ 1 0 0 0 1 0 0 0 1 0 1 0 ]; assert(isequal(C,C_correct))

Assertion failed.

5   Fail
A = [ 0 1 0 0 0 1 0 1 1 0 0 1 0 1 0 0 1 1 0 1 0 0 0 1 0 ]; C = maximalcliques(A); C = fliplr(sortrows(C')'); C_correct = [ 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 ]; assert(isequal(C,C_correct))

Assertion failed.

6   Fail
A = [ 0 1 1 0 0 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 0 1 0 ]; C = maximalcliques(A); C = fliplr(sortrows(C')'); C_correct = [ 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 0 0 1 ]; assert(isequal(C,C_correct))

Assertion failed.