Data structures used to implement Kosaraju 's Algorithm. Please refer http:www.geeksforgeeks.org/strongly-connected-components/
@ SuppressWarnings ( " unchecked " ) static List < List < Integer > > adj = new ArrayList ( ) ; @ SuppressWarnings ( " unchecked " ) static List < List < Integer > > adjInv = new ArrayList ( ) ; static boolean [ ] visited = new boolean [ MAX ] ; static boolean [ ] visitedInv = new boolean [ MAX ] ; static Stack < Integer > s = new Stack < Integer > ( ) ;