Difference between revisions of "TADM2E 5.17"
From Algorithm Wiki
Rahul Biswas (talk | contribs) (Created page with "use dfs to find cycle of lenght 3. we maintain an array parent[i]. while processing any backedge u-v we check whether gradparent of u is equal to v .if true we found a cycle...") |
Rahul Biswas (talk | contribs) (Replaced content with "use dfs to find cycle of lenght 3. we maintain an array parent[i]. while processing any backedge u-v we check whether gradparent of u is equal to v .if true we found a c...") |
||
Line 4: | Line 4: | ||
while processing any backedge u-v we check whether gradparent of u is equal to v .if true we found a cycle of lenght 3. | while processing any backedge u-v we check whether gradparent of u is equal to v .if true we found a cycle of lenght 3. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | i,e parent[parent[u]] == v,then found cycle of lenght 3 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 05:48, 31 January 2016
use dfs to find cycle of lenght 3.
we maintain an array parent[i].
while processing any backedge u-v we check whether gradparent of u is equal to v .if true we found a cycle of lenght 3.
i,e parent[parent[u]] == v,then found cycle of lenght 3