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.

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.

1 participant