Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@punit1009
Copy link

Summary

This fixes issue #2057 .

The detectUndirectedCycle function previously returned a vertex-to-parent mapping which was unintuitive and difficult to consume. This PR changes the function to return an ordered array of vertices forming the cycle (e.g. [A, B, C, A]), with the first and last elements equal to clearly indicate the cycle closure.

Changes

  • Return ordered cycle path array instead of object map.
  • Add early exit (stop traversal once a cycle is found).
  • Ensure function iterates all graph components (handles disconnected graphs).
  • Add unit tests to verify behavior and maintain 100% coverage.

Checklist

  • Code matches repository style
  • npm run lint passes (or auto-fixed)
  • npm test passes
  • 100% test coverage for modified files

Fixes #123

Copy link

@asanpardazzagros-debug asanpardazzagros-debug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@punit1009
Copy link
Author

Could you please confirm whether this workflow will be approved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translate to Spanish

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.