Skip to content

Commit

Permalink
Update Javadoc for topoSortStates method after #12286 (#12292)
Browse files Browse the repository at this point in the history
  • Loading branch information
tang-hi authored May 15, 2023
1 parent 5d203f8 commit 0e172b0
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,14 @@ static Automaton totalize(Automaton a) {
* non-recursive, so it will not exhaust the java stack for automaton matching long strings. If
* there are dead states in the automaton, they will be removed from the returned array.
*
* <p>Note: This method uses a deque to iterative the states, which could potentially consume a
* lot of heap space for some automatons. Specifically, automatons with a deep level of states
* (i.e., a large number of transitions from the initial state to the final state) may
* particularly contribute to high memory usage. The memory consumption of this method can be
* considered as O(N), where N is the depth of the automaton (the maximum number of transitions
* from the initial state to any state). However, as this method detects cycles, it will never
* attempt to use infinite RAM.
*
* @param a the Automaton to be sorted
* @return the topologically sorted array of state ids
*/
Expand Down

0 comments on commit 0e172b0

Please sign in to comment.