Program: 38542
Project: 38542
Buggy source:
@Override public Graph transform(Graph g){
  initIDSpace(g);
  if (graphPlotter != null)   graphPlotter.plotStartGraph(g,idSpace);
  EdgeCrossings ec=new EdgeCrossings();
  int countCrossings;
  countCrossings=ec.calculateCrossings(g.generateEdges(),idSpace,true);
  System.out.println("String_Node_Str" + countCrossings);
  this.g=g;
  edges=new Edge[g.getNodes().length][];
  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();
      if (errors++ == 50) {
        throw new RuntimeException("String_Node_Str");
      }
    }
  }
  double lastPos=0;
  double posDiff=modulus / partitions.length;
  RingIdentifier[] ids=new RingIdentifier[g.getNodes().length];
  for (  Node n : longestPath) {
    ids[n.getIndex()]=new RingIdentifier(lastPos,idSpace);
    lastPos+=posDiff;
  }
  lastNode=longestPath.getLast();
  for (  Node n : longestPath) {
    partitions[n.getIndex()]=new RingPartition(ids[lastNode.getIndex()],ids[n.getIndex()]);
    lastNode=n;
  }
  countCrossings=ec.calculateCrossings(g.generateEdges(),idSpace,true);
  System.out.println("String_Node_Str" + countCrossings);
  if (graphPlotter != null)   graphPlotter.plot(g,idSpace,graphPlotter.getBasename() + "String_Node_Str");
  reduceCrossingsBySwapping(g);
  writeIDSpace(g);
  if (graphPlotter != null)   graphPlotter.plotFinalGraph(g,idSpace);
  countCrossings=ec.calculateCrossings(g.generateEdges(),idSpace,true);
  System.out.println("String_Node_Str" + countCrossings);
  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=-1;
  System.out.println("String_Node_Str" + countCrossings);
  this.g=g;
  edges=new Edge[g.getNodes().length][];
  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=0;
    while (triangulationEdgesCount > 0) {
      secondCounter++;
      if (secondCounter == currentNodeDegree) {
        firstCounter++;
        secondCounter=firstCounter;
      }
      if (firstCounter == (currentNodeDegree - 1))       throw new RuntimeException("String_Node_Str" + currentNode.getIndex() + "String_Node_Str"+ currentNodeDegree);
      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 {
      }
    }
    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);
    System.out.println("String_Node_Str" + currentNode.getIndex() + "String_Node_Str");
  }
  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();
      if (errors++ == 50) {
        throw new RuntimeException("String_Node_Str");
      }
    }
  }
  double lastPos=0;
  double posDiff=modulus / partitions.length;
  RingIdentifier[] ids=new RingIdentifier[g.getNodes().length];
  for (  Node n : longestPath) {
    ids[n.getIndex()]=new RingIdentifier(lastPos,idSpace);
    lastPos+=posDiff;
  }
  lastNode=longestPath.getLast();
  for (  Node n : longestPath) {
    partitions[n.getIndex()]=new RingPartition(ids[lastNode.getIndex()],ids[n.getIndex()]);
    lastNode=n;
  }
  System.out.println("String_Node_Str" + countCrossings);
  if (graphPlotter != null)   graphPlotter.plot(g,idSpace,graphPlotter.getBasename() + "String_Node_Str");
  reduceCrossingsBySwapping(g);
  writeIDSpace(g);
  if (graphPlotter != null)   graphPlotter.plotFinalGraph(g,idSpace);
  System.out.println("String_Node_Str" + countCrossings);
  return g;
}