private static void dfsGRev(Integer startNode) {

		// mark node i as explored
		nodes[startNode.intValue()] = 1;

		// find edges with start node as tail and another node as head in G-rev
		List<Integer> heads = reverseEdges.get(startNode);
		if(heads != null) {
			Iterator<Integer> headsIterator = heads.iterator();
			while(headsIterator.hasNext()) {

				Integer head = (Integer)headsIterator.next();

				// ignore self loops
				if(head.intValue() == startNode.intValue()) {
					continue;
				}

				if(nodes[head.intValue()] == 0) {
					// node not already explored
					dfsGRev(head);
				}
			}
		}

		finishTime ++;
		nodesSortedByFinishTime[finishTime] = startNode.intValue();
	}