code: public boolean isSafe(Node node, Edge edge)
  	{
  		initMaps();
  
  		setColor(node, BLACK);
  		setLabel(node, 0);
  		setLabel(edge, 0);
  
  		labelEquivRecursive(node, UPWARD, 0, false, false);
  		labelEquivRecursive(node, DOWNWARD, 0, false, false);
  
  		// Initialize dist and color of source set
  
  		Node neigh = edge.getTargetNode();
  
  		if (getColor(neigh) != WHITE) return false;
  
  		setColor(neigh, GRAY);
  		setLabel(neigh, 0);
  
  		queue.add(neigh);
  
  		labelEquivRecursive(neigh, UPWARD, 0, true, false);
  		labelEquivRecursive(neigh, DOWNWARD, 0, true, false);
  
  		// Process the queue
  
  		while (!queue.isEmpty())
  		{
  			Node current = queue.remove(0);
  
  			if (ST.contains(current)) return true;
  			
  			boolean safe = processNode2(current);
  
  			if (safe) return true;
  
  			// Current node is processed
  			setColor(current, BLACK);
  		}
  
  		return false;
  	}
docs: Checks whether an edge is on an unwanted cycle.
  @param node Node that the edge is bound
  @param edge The edge to check
  @return True if no cycle is detected, false otherwise