Program: 39875
Project: 39875
Buggy source:
@Override public Graph transform(Graph g){
  initIDSpace(g);
  if (graphPlotter != null)   graphPlotter.plotStartGraph(g,idSpace);
  EdgeCrossings ec=new EdgeCrossings();
  int countCrossings;
  this.g=g;
  Node tempNode=null;
  Node currentNode=null;
  Node lastNode=null;
  Node randDst1, randDst2;
  Edge tempEdge;
  String tempEdgeString;
  removalList=new HashMap<String,Edge>();
  HashMap<String,Edge> pairEdges=null;
  removedNodes=new ArrayList<Node>();
  waveCenterNodes=new TreeSet<Node>(new NodeComparator());
  waveFrontNodes=new TreeSet<Node>(new NodeComparator());
  additionalEdges=new HashMap[g.getNodes().length];
  for (int i=0; i < g.getNodes().length; i++) {
    additionalEdges[i]=new HashMap<String,Edge>();
  }
  nodeList=Arrays.asList(g.getNodes().clone());
  Collections.sort(nodeList,new NodeDegreeComparator());
  for (int counter=1; counter < (nodeList.size() - 3); counter++) {
    currentNode=getNode();
    pairEdges=getPairEdges(currentNode);
    for (    Edge singleEdge : pairEdges.values()) {
      removalList.put(getEdgeString(singleEdge),singleEdge);
    }
    HashMap<String,Edge> currentNodeConnections=getEdges(currentNode);
    int currentNodeDegree=currentNodeConnections.size();
    int triangulationEdgesCount=(currentNodeDegree - 1) - pairEdges.size();
    int[] outgoingEdges=filterOutgoingEdges(currentNode,currentNodeConnections);
    int firstCounter=0;
    int secondCounter=1;
    while (triangulationEdgesCount > 0) {
      randDst1=g.getNode(outgoingEdges[firstCounter]);
      randDst2=g.getNode(outgoingEdges[secondCounter]);
      if (randDst1.equals(randDst2))       continue;
      if (removedNodes.contains(randDst1) || removedNodes.contains(randDst2)) {
        continue;
      }
      if (!connected(randDst1,randDst2)) {
        tempEdge=new Edge(Math.min(randDst1.getIndex(),randDst2.getIndex()),Math.max(randDst1.getIndex(),randDst2.getIndex()));
        tempEdgeString=getEdgeString(tempEdge);
        if (randDst1.getIndex() != randDst2.getIndex() && !additionalEdges[randDst1.getIndex()].containsKey(tempEdgeString)) {
          additionalEdges[randDst1.getIndex()].put(tempEdgeString,tempEdge);
          additionalEdges[randDst2.getIndex()].put(tempEdgeString,tempEdge);
          triangulationEdgesCount--;
        }
      }
 else {
      }
      secondCounter++;
      if (secondCounter == (currentNodeDegree - 1)) {
        firstCounter++;
        secondCounter=firstCounter + 1;
      }
      if (firstCounter == (currentNodeDegree - 1))       throw new RuntimeException("String_Node_Str" + currentNode.getIndex());
    }
    waveFrontNodes=new TreeSet<Node>(new NodeComparator());
    for (    Edge i : getEdges(currentNode).values()) {
      int otherEnd;
      if (i.getDst() == currentNode.getIndex()) {
        otherEnd=i.getSrc();
      }
 else {
        otherEnd=i.getDst();
      }
      tempNode=g.getNode(otherEnd);
      if (removedNodes.contains(tempNode)) {
        continue;
      }
      waveFrontNodes.add(tempNode);
      waveCenterNodes.add(tempNode);
    }
    lastNode=currentNode;
    removedNodes.add(currentNode);
  }
  LinkedList<Node> longestPath=longestPath();
  ArrayList<Node> todoList=new ArrayList<Node>();
  todoList.addAll(nodeList);
  todoList.removeAll(longestPath);
  Node neighbor, singleNode;
  int neighborPosition=-1;
  int errors=0;
  int modCounter=0;
  while (!todoList.isEmpty()) {
    singleNode=todoList.get(modCounter % todoList.size());
    for (    int singleNeighbor : singleNode.getOutgoingEdges()) {
      neighbor=g.getNode(singleNeighbor);
      neighborPosition=longestPath.indexOf(neighbor);
      if (neighborPosition > -1) {
        break;
      }
    }
    if (neighborPosition != -1) {
      todoList.remove(singleNode);
      longestPath.add(neighborPosition,singleNode);
    }
 else {
      modCounter=(modCounter + 1) % todoList.size();
      System.err.println("String_Node_Str" + singleNode + "String_Node_Str"+ errors);
      if (errors++ == 50) {
        System.exit(0);
      }
    }
  }
  partitions=new RingPartition[g.getNodes().length];
  idSpace=new RingIdentifierSpace(partitions,this.modulus,this.wrapAround);
  RingIdentifier[] ids=new RingIdentifier[partitions.length];
  double lastPos=0;
  double posDiff=modulus / partitions.length;
  for (int i=0; i < partitions.length; i++) {
    ids[i]=new RingIdentifier(lastPos,idSpace);
    lastPos+=posDiff;
  }
  for (int i=0; i < partitions.length; i++) {
    partitions[i]=new RingPartition(ids[i],ids[(i + 1) % ids.length]);
  }
  writeIDSpace(g);
  if (graphPlotter != null)   graphPlotter.plotFinalGraph(g,idSpace);
  return g;
}

Fixed version (ground truth):
@Override public Graph transform(Graph g){
  initIDSpace(g);
  if (graphPlotter != null)   graphPlotter.plotStartGraph(g,idSpace);
  EdgeCrossings ec=new EdgeCrossings();
  int countCrossings;
  this.g=g;
  Node tempNode=null;
  Node currentNode=null;
  Node lastNode=null;
  Node randDst1, randDst2;
  Edge tempEdge;
  String tempEdgeString;
  removalList=new HashMap<String,Edge>();
  HashMap<String,Edge> pairEdges=null;
  removedNodes=new ArrayList<Node>();
  waveCenterNodes=new TreeSet<Node>(new NodeComparator());
  waveFrontNodes=new TreeSet<Node>(new NodeComparator());
  additionalEdges=new HashMap[g.getNodes().length];
  for (int i=0; i < g.getNodes().length; i++) {
    additionalEdges[i]=new HashMap<String,Edge>();
  }
  nodeList=Arrays.asList(g.getNodes().clone());
  Collections.sort(nodeList,new NodeDegreeComparator());
  for (int counter=1; counter < (nodeList.size() - 3); counter++) {
    currentNode=getNode();
    pairEdges=getPairEdges(currentNode);
    for (    Edge singleEdge : pairEdges.values()) {
      removalList.put(getEdgeString(singleEdge),singleEdge);
    }
    HashMap<String,Edge> currentNodeConnections=getEdges(currentNode);
    int currentNodeDegree=currentNodeConnections.size();
    int triangulationEdgesCount=(currentNodeDegree - 1) - pairEdges.size();
    int[] outgoingEdges=filterOutgoingEdges(currentNode,currentNodeConnections);
    int firstCounter=0;
    int secondCounter=1;
    while (triangulationEdgesCount > 0) {
      randDst1=g.getNode(outgoingEdges[firstCounter]);
      randDst2=g.getNode(outgoingEdges[secondCounter]);
      if (randDst1.equals(randDst2))       continue;
      if (removedNodes.contains(randDst1) || removedNodes.contains(randDst2)) {
        continue;
      }
      if (!connected(randDst1,randDst2)) {
        tempEdge=new Edge(Math.min(randDst1.getIndex(),randDst2.getIndex()),Math.max(randDst1.getIndex(),randDst2.getIndex()));
        tempEdgeString=getEdgeString(tempEdge);
        if (randDst1.getIndex() != randDst2.getIndex() && !additionalEdges[randDst1.getIndex()].containsKey(tempEdgeString)) {
          additionalEdges[randDst1.getIndex()].put(tempEdgeString,tempEdge);
          additionalEdges[randDst2.getIndex()].put(tempEdgeString,tempEdge);
          triangulationEdgesCount--;
        }
      }
 else {
      }
      secondCounter++;
      if (secondCounter == (currentNodeDegree - 1)) {
        firstCounter++;
        secondCounter=firstCounter + 1;
      }
      if (firstCounter == (currentNodeDegree - 1))       throw new RuntimeException("String_Node_Str" + currentNode.getIndex());
    }
    waveFrontNodes=new TreeSet<Node>(new NodeComparator());
    for (    Edge i : getEdges(currentNode).values()) {
      int otherEnd;
      if (i.getDst() == currentNode.getIndex()) {
        otherEnd=i.getSrc();
      }
 else {
        otherEnd=i.getDst();
      }
      tempNode=g.getNode(otherEnd);
      if (removedNodes.contains(tempNode)) {
        continue;
      }
      waveFrontNodes.add(tempNode);
      waveCenterNodes.add(tempNode);
    }
    lastNode=currentNode;
    removedNodes.add(currentNode);
  }
  LinkedList<Node> longestPath=longestPath();
  ArrayList<Node> todoList=new ArrayList<Node>();
  todoList.addAll(nodeList);
  todoList.removeAll(longestPath);
  Node neighbor, singleNode;
  int neighborPosition=-1;
  int errors=0;
  int modCounter=0;
  while (!todoList.isEmpty()) {
    singleNode=todoList.get(modCounter % todoList.size());
    for (    int singleNeighbor : singleNode.getOutgoingEdges()) {
      neighbor=g.getNode(singleNeighbor);
      neighborPosition=longestPath.indexOf(neighbor);
      if (neighborPosition > -1) {
        break;
      }
    }
    if (neighborPosition != -1) {
      todoList.remove(singleNode);
      longestPath.add(neighborPosition,singleNode);
    }
 else {
      modCounter=(modCounter + 1) % todoList.size();
      System.err.println("String_Node_Str" + singleNode + "String_Node_Str"+ errors);
      if (errors++ == 50) {
        System.exit(0);
      }
    }
  }
  partitions=new RingPartition[g.getNodes().length];
  idSpace=new RingIdentifierSpace(partitions,this.modulus,this.wrapAround);
  RingIdentifier[] ids=new RingIdentifier[partitions.length];
  double lastPos=0;
  double posDiff=modulus / partitions.length;
  for (  Node n : longestPath) {
    ids[n.getIndex()]=new RingIdentifier(lastPos,idSpace);
    lastPos+=posDiff;
  }
  for (int i=0; i < partitions.length; i++) {
    partitions[i]=new RingPartition(ids[i],ids[(i + 1) % ids.length]);
  }
  writeIDSpace(g);
  if (graphPlotter != null)   graphPlotter.plotFinalGraph(g,idSpace);
  return g;
}