Skip to content

Conversation

@FiasKr
Copy link

@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
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
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 :)

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