Topological Sort

Topological Sort

Source Code:
Github: TopologicalSort.java


Output:

Graph:
{V(2),  []
V(3),  [Edge (source=3, destination=8, weight=1.0), Edge (source=3, destination=10, weight=1.0)]
V(5),  [Edge (source=5, destination=11, weight=1.0)]
V(7),  [Edge (source=7, destination=11, weight=1.0), Edge (source=7, destination=8, weight=1.0)]
V(8),  [Edge (source=8, destination=9, weight=1.0)]
V(9),  []
V(10),  []
V(11),  [Edge (source=11, destination=2, weight=1.0), Edge (source=11, destination=9, weight=1.0), Edge (source=11, destination=10, weight=1.0)]}


Non-Sort: [7, 5, 11, 2, 3, 10, 8, 9]


Recursive Sort: [3, 5, 7, 11, 2, 10, 8, 9]      

Author: Hrishikesh Mishra