Problem 475. Is this group simply connected?
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 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.
Solution Stats
Problem Comments
-
2 Comments
Jean-Marie Sainthillier
on 11 Jul 2013
Maybe some tests with more than two distincts subgraphs.
Jan Orwat
on 29 Feb 2016
Seems the problem became easier with R2015b.
Solution Comments
Show commentsGroup

Computer Games III
- 13 Problems
- 2 Finishers
- I've got the power! (Inspired by Project Euler problem 29)
- Pandigital number n°1 (Inspired by Project Euler 32)
- Pandigital number n°2 (Inspired by Project Euler 32)
- Pandigital number n°3 (Inspired by Project Euler 32)
- Circular Primes (based on Project Euler, problem 35)
- Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
- Lychrel Number Test (Inspired by Project Euler Problem 55)
- Decrypt the cypher using XOR encryption (for beginners)
- Diophantine Equations (Inspired by Project Euler, problem 66)
- High Precision Square Root (Inspired by Project Euler 80)
- Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
Problem Recent Solvers30
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!