Cody

Problem 1169. Count the Number of Directed Cycles in a Graph

Solution 2639320

Submitted on 1 Jul 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 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0]; nCycles = 7; assert(isequal(count_directed_cycles(A),nCycles))

Error in solution: Line: 5 Column: 16 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

2   Fail
A = [ 0 1 0 1 0 1 0 0 0 0 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 0 0 0 1 1 1 1 1]; nCycles = 197; assert(isequal(count_directed_cycles(A),nCycles))

Error in solution: Line: 5 Column: 16 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

3   Fail
A = [ 1 0 1 0 0 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 1 1 1 0 0 0 0 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 1 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0]; nCycles = 744; assert(isequal(count_directed_cycles(A),nCycles))

Error in solution: Line: 5 Column: 16 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

4   Fail
A = [ 0 0 0 0 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 1 0 1 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 0 1 0 0 1 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 0 0]; nCycles = 4961; assert(isequal(count_directed_cycles(A),nCycles)) A = [ 0 1 1 0 0 0 1 0 1 0 0 0 1 1 1 1 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 0 1 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 1 1 0 1 0 0]; nCycles = 116; assert(isequal(count_directed_cycles(A),nCycles)) A = [ 0 1 0 1 1 1 0 0 1 0 1 0 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 0 1 0 1 0 0 0 0 1 1 0 0 1 0 1 1 0 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 1 1 1 1 0 1 0 0 1 1 1 0 1 0 1 0]; nCycles = 5888; assert(isequal(count_directed_cycles(A),nCycles)) A = [ 0 0 0 1 1 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 0 1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 1 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0 1 1 1 1 1 0 1 0 1 0 1 0 0 1 0 1 0 0 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 0 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1]; nCycles = 50093; assert(isequal(count_directed_cycles(A),nCycles))

Error in solution: Line: 5 Column: 16 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.