Cody

Problem 1886. Graceful Double Wheel Graph

Solution 1703671

Submitted on 7 Jan 2019 by William
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.012940 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.034915 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.056702 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.075157 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.096252 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.114743 seconds.

Suggested Problems

More from this Author246

Community Treasure Hunt

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

Start Hunting!