Given 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 trueThe 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 falseThis graph could be drawn like so:
1--2 5--6 | | 4--3
There are two distinct subgraphs.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers38
Suggested Problems
-
Find state names that end with the letter A
1198 Solvers
-
How to find the position of an element in a vector without using the find function
2822 Solvers
-
Project Euler: Problem 7, Nth prime
1781 Solvers
-
Create a matrix X, where each column is a shifted copy of the vector v
228 Solvers
-
Set the array elements whose value is 13 to 0
1460 Solvers
More from this Author54
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Maybe some tests with more than two distincts subgraphs.
Seems the problem became easier with R2015b.