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

Learn moreOpportunities for recent engineering grads.

Apply TodayGiven connectivity information about a graph, your job is to figure out if the graph is fully connected. You are given a list of vertex pairs that specify undirected connectivity (edges) among vertices. Vertex labels are always positive integers.

Example 1:

Input node_pairs = [ 8 9 8 3 ] Output tf is true

The three nodes of this graph are fully connected, since this graph could be drawn like so:

3--8--9

Example 2:

Input node_pairs = [ 1 2 2 3 1 4 3 4 5 6 ] Output tf is false

This graph could be drawn like so:

1--2 5--6 | | 4--3

There are two distinct subgraphs.

35 correct solutions
38 incorrect solutions

Last solution submitted on Feb 29, 2016

3 players like this problem

3 players like this solution

1 Comment

Alfonso Nieto-Castanon
on 11 Mar 2012

very cool (and efficient) solution

2 Comments