***** Topologicalsorter class *****
-provides functionality to topologically sort a group of Hashable nodes.
Topological sorting when Graph is initialised:
If the optional graph argument is provided it must be a dictionary representing a directed cyclic graph where the keys are nodes and the values are iterables of all predecessors of that node in the graph.
TOPOLOGICAL SORTING WHEN GRAPH IS unINITIALISED:
To add a new node to the graph use
The particular order that is returned may depend on the specific order in which the items were inserted in the graph.
Here, 0 and 2 are at the same level