Problem 1170. Count the Number of Undirected Cycles in a Graph
Solution Stats
Problem Comments
-
4 Comments
could you please clarify, in your example, why cycles like '1->2->1', '1->5->1' or '3->5->3' are not counted?
it seems the expected solution only counts cycles that include three or more nodes... is this correct?
That is correct. In a directed graph, the cycle 1 -> 2 -> 1 actually uses two different edges, while in an undirected graph, the edge 1 -> 2 and 2 -> 1 are one and the same. I am only considering cycles valid if each node along the way is visited once and if edges are not used more than one time. I chose this criteria so that the number of cycles counted would match the results for the table provided here: http://mathworld.wolfram.com/GraphCycle.html
got it. Thanks for the clarification!
Solution Comments
-
1 Comment
Can you please send me your code for this??? Really struggling on this for a school assignment clarkieg123@gmail.com
-
1 Comment
Can you please send me your code for this??? Really struggling on this for a school assignment clarkieg123@gmail.com
-
1 Comment
Can you please send me your code for this??? Really struggling on this for a school assignment clarkieg123@gmail.com
Problem Recent Solvers11
Suggested Problems
-
1593 Solvers
-
4252 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
2521 Solvers
-
640 Solvers
-
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
204 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!