count the number of undirected cycles in a graph -凯发k8网页登录
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
problem recent solvers
suggested problems
-
170 solvers
-
1503 solvers
-
370 solvers
-
390 solvers
-
363 solvers
more from this author
problem tags
community treasure hunt
find the treasures in matlab central and discover how the community can help you!
start hunting!