code: protected void labelEquivRecursive(Node node, boolean up, int dist,
  		boolean enqueue, boolean head)
  	{
  		if(node == null) {
  			LOG.error("labelEquivRecursive: null (Node)");
  			return;
  		}
  		
  		for (Node equiv : up ? node.getUpperEquivalent() : node.getLowerEquivalent())
  		{
  			if (getColor(equiv) == WHITE)
  			{
  				setLabel(equiv, dist);
  
  				if (enqueue)
  				{
  					setColor(equiv, GRAY);
  
  					if (head) queue.addFirst(equiv);
  					else queue.add(equiv);
  				}
  				else
  				{
  					setColor(equiv, BLACK);
  				}
  			}
  
  			labelEquivRecursive(equiv, up, dist, enqueue, head);
  		}
  	}
docs: Labels equivalent nodes recursively.
  @param node Node to label equivalents
  @param up Traversing direction. Up means towards parents, if false then towards children
  @param dist The label
  @param enqueue Whether to enqueue equivalents
  @param head Where to enqueue. Head or tail.