File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 696696
697697@inline newsym (:: Type{T} ) where T = Sym {T} (gensym (" cse" ))
698698
699+ """
700+ $(SIGNATURES)
701+
702+ Perform a topological sort on a symbolic expression represented as a Directed Acyclic
703+ Graph (DAG).
704+
705+ This function takes a symbolic expression `graph` (potentially containing shared common
706+ sub-expressions) and returns an array of `Assignment` objects. Each `Assignment`
707+ represents a node in the sorted order, assigning a fresh symbol to its corresponding
708+ expression. The order ensures that all dependencies of a node appear before the node itself
709+ in the array.
710+
711+ Hash consing is assumed, meaning that structurally identical expressions are represented by
712+ the same object in memory. This allows for efficient equality checks using `IdDict`.
713+ """
699714function topological_sort (graph)
700715 sorted_nodes = Assignment[]
701716 visited = IdDict ()
You can’t perform that action at this time.
0 commit comments