private void removeGaps(int nodesLevel[]) {
    int temp = m_nodes.size();
    int temp2=graphMatrix[0].length, tempCnt=1;
    
    for(int n=0; n<temp; n++) {
      for(int i=0; i<temp2; i++) {
        int len = graphMatrix.length;
        if(graphMatrix[n][i]>0)
          if(nodesLevel[i]>nodesLevel[n]+1) {
            int tempMatrix[][] =
            new int[graphMatrix.length+(nodesLevel[i]-nodesLevel[n]-1)]
                   [graphMatrix.length+(nodesLevel[i]-nodesLevel[n]-1)];
            int level = nodesLevel[n]+1;
            copyMatrix(graphMatrix, tempMatrix);
            
            String s1 = new String("S"+tempCnt++);
            m_nodes.addElement(new GraphNode(s1, s1, SINGULAR_DUMMY)); //true));
            int temp3 [] = new int[nodeLevels[level].length+1];
            //for(int j=0; j<nodeLevels[level].length; j++)
            //    temp3[j] = nodeLevels[level][j];
            System.arraycopy(nodeLevels[level], 0, temp3, 
                             0, nodeLevels[level].length);
            temp3[temp3.length-1] = m_nodes.size()-1;
            nodeLevels[level] = temp3; level++;
            //nodeLevels[level++].addElement(new Integer(m_nodes.size()-1));
            //System.out.println("len:"+len+","+nodesLevel[i]+","+
            //                   nodesLevel[n]);
            
            int k;
            for(k=len; k<len+nodesLevel[i]-nodesLevel[n]-1-1; k++) {
              String s2 =  new String("S"+tempCnt);
              m_nodes.addElement( new GraphNode(s2, s2, SINGULAR_DUMMY) ); //true) );
              temp3 = new int[nodeLevels[level].length+1];
              //for(int j=0; j<nodeLevels[level].length; j++)
              //	temp3[j] = nodeLevels[level][j];
              System.arraycopy(nodeLevels[level], 0, temp3, 
                               0, nodeLevels[level].length);
              temp3[temp3.length-1] = m_nodes.size()-1;
              nodeLevels[level++] = temp3;
              //nodeLevels[level++].addElement(new Integer(m_nodes.size()-1));
              tempMatrix[k][k+1]=tempMatrix[n][i]; tempCnt++;
              if(k>len)
                tempMatrix[k][k-1]=-1*tempMatrix[n][i];
            }
            
            //temp[lastTempNodeCreated][targetNode]=temp[origNode][targetNode]
            tempMatrix[k][i]=tempMatrix[n][i];
            //System.out.println("k "+((GraphNode)m_nodes.elementAt(k)).ID+
            //		   " i "+((GraphNode)m_nodes.elementAt(i)).ID+
            //		   " n "+((GraphNode)m_nodes.elementAt(n)).ID+
            //		   " len "+((GraphNode)m_nodes.elementAt(len)).ID );
            //temp[origNode][firstTempNodecreated] = temp[origNode][targetNode]
            tempMatrix[n][len] = tempMatrix[n][i]; 
            //temp[firstTempNodeCreated][origNode]  for reverse tracing
            tempMatrix[len][n] = -1*tempMatrix[n][i];
             //temp[targetNode][lastTempNodecreated]  for reverse tracing
            tempMatrix[i][k]   = -1*tempMatrix[n][i]; 
            
            //temp[lastTempNodeCreated][secondlastNode] for reverse tracing
            //but only do this if more than 1 temp nodes are created
            if(k>len)                                  
              tempMatrix[k][k-1] = -1*tempMatrix[n][i];
            
            //temp[origNode][targetNode] = 0 unlinking as they have been
            // linked by a chain of temporary nodes now.
            tempMatrix[n][i]   = 0;                    
            tempMatrix[i][n]   = 0;                    
            
            graphMatrix = tempMatrix;
          }
          else {
            //****Even if there is no gap just add a reference for the
            //****parent to the child for reverse tracing, useful if the
            //****there is a reversed edge from parent to child and therefore
            //****visualizer would know to highlight this edge  when 
            //****highlighting the child.
            graphMatrix[i][n]=-1*graphMatrix[n][i];
          }
      }
    }
    //Interconnection matrices at each level, 1 to n-1 after minimizing edges
    //printMatrices(nodeLevels);
  }