Skip to content

Fix Kahn's algorithm - #15074

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

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
Contributor

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

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add a benchmark that proves that the proposed changes could save significant runtime.

@algorithms-keeper algorithms-keeper Bot added awaiting changes A maintainer has requested changes to this PR and removed awaiting reviews This PR is ready to be reviewed labels Sep 6, 2026
@algorithms-keeper algorithms-keeper Bot removed the awaiting changes A maintainer has requested changes to this PR label Sep 12, 2026
@cclauss

cclauss commented Sep 12, 2026

Copy link
Copy Markdown
Member

Git conflicts. Please rebase.

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

Labels

enhancement This PR modified some existing files git merge conflict

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

2 participants