Normally sorting is simple: you just need to tell which one of the two elements is larger. However, it’s not always the case – sometimes the items don’t have linear structure, and pairwise comparison is not possible. So let me piggyback on the hot topic of graph search and show you a useful and beautiful trick for sorting items in a SharpShooter report.
Which tasks you may need this for?
Well, think about plugins ecosystem in your app where a plugin could depend on other plugins, so you need to come up with the correct loading order:
Or you might be creating an online learning app and need to list course prerequisites for any given course:
Or consider project management: after finishing a task you can work on either one of its children, so listing all the tasks “properly sorted” in a report wouldn’t be that easy! Say, below is a simplified version of a startup project – if you where to present all tasks in a sorted list, will you place “setup legal entity” before “bugfixing” or after it?
The answer to this and other similar questions is topological sort and in this post we’d see how to implement it in a SharpShooter report. (more…)


