Skip to content

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 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.

2 participants