Skip to content

feat: Implement Levenshtein distance and BFS #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 17, 2025
Merged

Conversation

monkey0722
Copy link
Owner

This pull request introduces implementations and corresponding test cases for two algorithms: Levenshtein Distance (edit distance) and Breadth-First Search (BFS). The changes include the addition of well-documented algorithm implementations and comprehensive test coverage to ensure correctness and handle edge cases.

Levenshtein Distance Algorithm:

Breadth-First Search (BFS) Algorithm:

  • algorithms/search/bfs/bfs.ts: Implemented the BFS algorithm to calculate the shortest path distances and predecessors for path reconstruction. Also added a helper function reconstructPath to reconstruct the shortest path from a source vertex to a target vertex using the BFS results.
  • algorithms/search/bfs/bfs.test.ts: Added test cases for the BFS algorithm, covering scenarios such as simple graphs, disconnected graphs, invalid start vertices, single-vertex graphs, tree structures, cyclic graphs, and performance on large graphs. Also included tests for the reconstructPath function to validate correct path reconstruction and handling of unreachable vertices.

@monkey0722 monkey0722 requested a review from Copilot April 17, 2025 13:52
@monkey0722 monkey0722 self-assigned this Apr 17, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

@monkey0722 monkey0722 merged commit 8512404 into main Apr 17, 2025
1 check passed
@monkey0722 monkey0722 deleted the new/algorithms branch April 17, 2025 13:53
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.

1 participant