Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 71312

Submitted on 5 Apr 2012 by Ben Petschel

Correct

62Size
Leading solution size is 29.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
node_pairs = [8 9; 8 3];
tf = true;
assert(isequal(isConnected(node_pairs),tf))

                    
2
Pass
 
%%
node_pairs = [ 1 2;
               2 3;
               1 4;
               3 4;
               5 6 ];
tf = false;
assert(isequal(isConnected(node_pairs),tf))

                    
3
Pass
 
%%
node_pairs = [ 1 2;
               2 3;
               1 4;
               3 4;
               5 6;
               6 2 ];
tf = true;
assert(isequal(isConnected(node_pairs),tf))

                    
4
Pass
 
%%
node_pairs = [ 1 2; 2 100];
tf = true;
assert(isequal(isConnected(node_pairs),tf))

                    
5
Pass
 
%%
node_pairs = [ 1 2; 50 100];
tf = false;
assert(isequal(isConnected(node_pairs),tf))

                    
6
Pass
 
%%
node_pairs = [ 4 17 ];
tf = true;
assert(isequal(isConnected(node_pairs),tf))