Cody

# Problem 1886. Graceful Double Wheel Graph

Solution 321953

Submitted on 22 Sep 2013 by Alfonso Nieto-Castanon
• Size: 203
• This is the leading solution.
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   Pass
%% tic n=11; m=double_wheel(n); ms=circshift(m,[0 -1]); dm=m-ms; d=unique([m(:) abs(dm(:))]); assert(all(diff(d)==1)) assert(length(d)==2*(n-1)) assert(max(d)==2*(n-1)) toc

Elapsed time is 0.019961 seconds.

2   Pass
%% n=13; m=double_wheel(n); ms=circshift(m,[0 -1]); dm=m-ms; d=unique([m(:) abs(dm(:))]); assert(all(diff(d)==1)) assert(length(d)==2*(n-1)) assert(max(d)==2*(n-1)) toc

Elapsed time is 0.023047 seconds.

3   Pass
%% n=17; m=double_wheel(n); ms=circshift(m,[0 -1]); dm=m-ms; d=unique([m(:) abs(dm(:))]); assert(all(diff(d)==1)) assert(length(d)==2*(n-1)) assert(max(d)==2*(n-1)) toc

Elapsed time is 0.024518 seconds.

4   Pass
%% n=19; m=double_wheel(n); ms=circshift(m,[0 -1]); dm=m-ms; d=unique([m(:) abs(dm(:))]); assert(all(diff(d)==1)) assert(length(d)==2*(n-1)) assert(max(d)==2*(n-1)) toc

Elapsed time is 0.025989 seconds.

5   Pass
%% n=71; m=double_wheel(n); ms=circshift(m,[0 -1]); dm=m-ms; d=unique([m(:) abs(dm(:))]); assert(all(diff(d)==1)) assert(length(d)==2*(n-1)) assert(max(d)==2*(n-1)) toc

Elapsed time is 0.027488 seconds.

6   Pass
%% n=97; m=double_wheel(n); ms=circshift(m,[0 -1]); dm=m-ms; d=unique([m(:) abs(dm(:))]); assert(all(diff(d)==1)) assert(length(d)==2*(n-1)) assert(max(d)==2*(n-1)) toc

Elapsed time is 0.028967 seconds.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!