private void detectCyclesVisit(BitSet vertices,
			   					   Collection<BitSet> detectedCycles,
            					   Queue<Integer> topologicallySortedVertices,
			                       int[] colors,
			                       Stack<Integer> searchStack)
	{
		int u = searchStack.peek();
		colors[u] = GRAY;
		for(int v = vertices.nextSetBit(0);v >= 0;v = vertices.nextSetBit(v+1))
		{
			if(!hasEdge(u,v)) continue;
			if(colors[v] == WHITE)
			{
				searchStack.push(v);
				detectCyclesVisit(vertices,detectedCycles,topologicallySortedVertices,colors,searchStack);
				searchStack.pop();
			}
			else if(colors[v] == GRAY)
			{
				BitSet cycleMembers = new BitSet(vertexCount);
				cycleMembers.set(v);
				for(int i = searchStack.size() - 1;i >= 0 && searchStack.get(i) != v;i--) cycleMembers.set(i);
				detectedCycles.add(cycleMembers);
			}
		}
		colors[u] = BLACK;
		if(topologicallySortedVertices != null) topologicallySortedVertices.offer(u);
	}