Skip to content

Implement Khan and Reversed DFS Post Order algorithms#4202

Closed
FiasKr wants to merge 1 commit intoLuckPerms:masterfrom
FiasKr:feature/algorithms
Closed

Implement Khan and Reversed DFS Post Order algorithms#4202
FiasKr wants to merge 1 commit intoLuckPerms:masterfrom
FiasKr:feature/algorithms

Conversation

@FiasKr
Copy link
Copy Markdown

@FiasKr FiasKr commented Jan 1, 2026

This pull request introduces two new algorithms for traversing the inheritance graph: Khan's algorithm and a reversed DFS post-order traversal. Both are topological sort algorithms that can be used to determine the order of inheritance (#3361).

Changes

common/src/main/java/me/lucko/luckperms/common/graph/TraversalAlgorithm.java

  • Added REVERSED_DFS_POST to the TraversalAlgorithm enum. This algorithm provides a topological sort by reversing the result of a depth-first post-order traversal.
  • Added KHAN to the TraversalAlgorithm enum. This is an implementation of Khan's algorithm for topological sorting.

common/src/test/java/me/lucko/luckperms/common/model/InheritanceTest.java

  • Added REVERSED_DFS_POST and KHAN to the parameterized test testInheritanceTree.
  • Added a new standalone test testKhanAlgorithm to specifically test the Khan's algorithm implementation.
  • Added a new standalone test testReversedDfsPostAlgorithm to specifically test the reversed DFS post-order algorithm.

@lucko
Copy link
Copy Markdown
Member

lucko commented Jan 10, 2026

Do you have a use for this? Can you give an example (in context) where this is useful in LuckPerms with groups?

@FiasKr
Copy link
Copy Markdown
Author

FiasKr commented Jan 11, 2026

Do you have a use for this? Can you give an example (in context) where this is useful in LuckPerms with groups?

I was just trying to resolve this fairly old issue: #3361
If it is no longer needed, feel free to close PR and Issue :)

@lucko
Copy link
Copy Markdown
Member

lucko commented Jan 31, 2026

Ok, thank you nonetheless!

@lucko lucko closed this Jan 31, 2026
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