Topological Sort Using Decrease Size Of Image Without Losing