Topological sort
Topological sort orders nodes in a directed graph that way that for every directed edge uv from node u to node v, u comes before v in the ordering.
An interesting property of this topological sort is that this implementation permits existence of cycles in the graph.
The function is an implementation of an algorithm described in: "A Simple Algorithm for Automatic Layout of BPMN Processes" (http://dx.doi.org/10.1109/CEC.2009.28).
Assumptions:
1) The graph is directed.
2) The graph has at least one node without any incoming link.
3) The edges are not weighted.
Cite As
Jan Motl (2026). Topological sort (https://www.mathworks.com/matlabcentral/fileexchange/55538-topological-sort), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
