Skip to content

Conversation

G26karthik
Copy link

@G26karthik G26karthik commented Oct 5, 2025

Contributes to #9943

Description

This PR includes two contributions:

  1. Hopcroft-Karp Algorithm Implementation: Adds the Hopcroft-Karp algorithm for finding maximum matching in bipartite graphs, a fundamental graph algorithm with O(E√V) time complexity.

  2. Test Coverage Improvement: Adds comprehensive doctests to the manual_accuracy() function in machine_learning/scoring_functions.py.

Changes

New Algorithm

  • Added graphs/hopcroft_karp.py with full implementation
  • Includes detailed docstring and usage examples
  • Comprehensive doctests covering various graph scenarios

Enhanced Test Coverage

  • Added docstring with detailed function description for manual_accuracy()
  • Added 4 doctest examples covering:
    • High accuracy (80% correct predictions)
    • Perfect accuracy (100% correct)
    • Zero accuracy (completely wrong predictions)
    • Complete inverse predictions (0% accuracy)

Testing

  • All doctests pass successfully for both contributions
  • Hopcroft-Karp: Multiple test cases for bipartite matching
  • manual_accuracy: 12 doctest lines (4 examples) all passing
  • Existing tests for mae, mse, rmse, rmsle, mbd remain passing

@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 6, 2025
@G26karthik G26karthik changed the title feat(graphs): Add Hopcroft-Karp maximum bipartite matching algorithm Add Hopcroft-Karp algorithm and doctests for manual_accuracy function Oct 6, 2025
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Oct 6, 2025
@Tarannum9623
Copy link

Tarannum9623 commented Oct 6, 2025

Hi! Can you help me by telling why my build test is failing, I want to contribute search_in_a_rotated_sorted_array in search directory and my build test failed.
PR: Search in rotated sorted array #13245

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants