public void testBuildInitialization() {
    String[][][]	results;
    Instances		inst;
    int			i;
    int			n;
    int			m;
    
    results = new String[2][m_Instances.numInstances()][m_NumNeighbors];
    
    // two runs of determining neighbors
    for (i = 0; i < 2; i++) {
      try {
	m_NearestNeighbourSearch.setInstances(m_Instances);
	
	for (n = 0; n < m_Instances.numInstances(); n++) {
	  for (m = 1; m <= m_NumNeighbors; m++) {
	    inst = m_NearestNeighbourSearch.kNearestNeighbours(
			m_Instances.instance(n), m);
	    results[i][n][m - 1] = inst.toString();
	  }
	}
      }
      catch (Exception e) {
	fail("Build " + (i + 1) + " failed: " + e);
      }
    }
    
    // compare the results
    for (n = 0; n < m_Instances.numInstances(); n++) {
      for (m = 1; m <= m_NumNeighbors; m++) {
	if (!results[0][n][m - 1].equals(results[1][n][m - 1]))
	  fail("Results differ: instance #" + (n+1) + " with " + m + " neighbors");
      }
    }
  }