Cody

Problem 1886. Graceful Double Wheel Graph

Solution 1703978

Submitted on 7 Jan 2019 by Binbin Qi
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.021039 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.044230 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.064493 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.084639 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.105960 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.127012 seconds.

Suggested Problems

More from this Author241

Community Treasure Hunt

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

Start Hunting!