Program: 41061
Project: 41061
Buggy source:
/** 
 * Initially it walks the graph from sources to sinks (left-to-right). For every visited node, it loads every incoming  arc with the minimum required flow of 1 (if it is still 0) and sets the flows of outgoing edges so that the all the  outgoing edges have at least flow level of 1 and the incoming/outgoing flows through the node is balances  (i.e., equal). This is not always possible (if the incoming nodes are too few to support all the necessary  outgoing flow), so a backward walk may be necessary for certain nodes and will be ran at the end of the  right-ward one (  {@link #initFlowLeft(Node)}.
 * @param node
 * @param reviewNodes this is used to mark the nodes that have to be re-visited in right-ward fashion by {@link #initFlowLeft(Node)}.
 */
private void initFlowRight(Node node,Deque<Node> reviewNodes){
  SortedSet<Node> ins=node.getInputs(), outs=node.getOutputs();
  int nins=ins.size(), nouts=outs.size();
  if (nins == 0 && nouts == 0)   return;
  if (nouts == 0) {
    endNodes.add(node);
    return;
  }
  if (log.isDebugEnabled())   log.trace("String_Node_Str" + node + "String_Node_Str");
  boolean flowChanged=false;
  for (  Node out : outs)   if (flowMgr.getFlow(node,out) == 0) {
    flowMgr.updateFlow(node,out,1);
    flowChanged=true;
  }
  int deficit=flowMgr.getDeficit(node);
  if (log.isDebugEnabled())   log.trace("String_Node_Str" + deficit + "String_Node_Str"+ node+ "String_Node_Str");
  if (!flowChanged && deficit == 0)   return;
  if (deficit > 0 && nins != 0) {
    reviewNodes.push(node);
  }
 else   if (deficit < 0) {
    if (log.isDebugEnabled())     log.trace("String_Node_Str" + node + "String_Node_Str");
    deficit=-deficit;
    int dquota=deficit / nouts, rquota=deficit % nouts;
    for (    Node out : outs) {
      flowMgr.increaseFlow(node,out,dquota);
      if (rquota-- > 0)       flowMgr.increaseFlow(node,out,1);
    }
  }
  for (  Node out : outs)   initFlowRight(out,reviewNodes);
}

Fixed version (ground truth):
/** 
 * Initially it walks the graph from sources to sinks (left-to-right). For every visited node, it loads every incoming  arc with the minimum required flow of 1 (if it is still 0) and sets the flows of outgoing edges so that the all the  outgoing edges have at least flow level of 1 and the incoming/outgoing flows through the node is balances  (i.e., equal). This is not always possible (if the incoming nodes are too few to support all the necessary  outgoing flow), so a backward walk may be necessary for certain nodes and will be ran at the end of the  right-ward one (  {@link #initFlowLeft(Node)}.
 * @param node
 * @param reviewNodes this is used to mark the nodes that have to be re-visited in right-ward fashion by {@link #initFlowLeft(Node)}.
 */
private void initFlowRight(Node node,Deque<Node> reviewNodes){
  SortedSet<Node> ins=node.getInputs(), outs=node.getOutputs();
  int nins=ins.size(), nouts=outs.size();
  if (nouts == 0) {
    endNodes.add(node);
    return;
  }
  if (log.isDebugEnabled())   log.trace("String_Node_Str" + node + "String_Node_Str");
  boolean flowChanged=false;
  for (  Node out : outs)   if (flowMgr.getFlow(node,out) == 0) {
    flowMgr.updateFlow(node,out,1);
    flowChanged=true;
  }
  int deficit=flowMgr.getDeficit(node);
  if (log.isDebugEnabled())   log.trace("String_Node_Str" + deficit + "String_Node_Str"+ node+ "String_Node_Str");
  if (!flowChanged && deficit == 0)   return;
  if (deficit > 0 && nins != 0) {
    reviewNodes.push(node);
  }
 else   if (deficit < 0) {
    if (log.isDebugEnabled())     log.trace("String_Node_Str" + node + "String_Node_Str");
    deficit=-deficit;
    int dquota=deficit / nouts, rquota=deficit % nouts;
    for (    Node out : outs) {
      flowMgr.increaseFlow(node,out,dquota);
      if (rquota-- > 0)       flowMgr.increaseFlow(node,out,1);
    }
  }
  for (  Node out : outs)   initFlowRight(out,reviewNodes);
}