Skip to content

Fix Kahn's algorithm - #15074

Open
Dharshini-RS03 wants to merge 1 commit into
TheAlgorithms:masterfrom
Dharshini-RS03:topo-sort
Open

Fix Kahn's algorithm#15074
Dharshini-RS03 wants to merge 1 commit into
TheAlgorithms:masterfrom
Dharshini-RS03:topo-sort

Conversation

@Dharshini-RS03

Copy link
Copy Markdown

Describe your change:

  • Fixed Kahn’s algorithm to support sparse/non-contiguous vertex IDs.

  • Improved queue performance using deque and added doctests for sparse graphs.

  • Add an algorithm?

  • Fix a bug or typo in an existing algorithm?

  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.

  • Documentation change?

Checklist:

@algorithms-keeper algorithms-keeper Bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Aug 23, 2026
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 enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Inefficient pop(0) queue operations and IndexError on sparse vertex IDs in graphs/kahns_algorithm_topo.py

1 participant