private void makeColorMapping() throws IOException
    {
       String szLine;

       if (szcolormapping != null)
       {
          BufferedReader brcolor =  Util.getBufferedReader(szcolormapping);

          //Loading in a mapping from state ID to R,G,B color 

          while ((szLine = brcolor.readLine())!=null)
          {
             StringTokenizer st = new StringTokenizer(szLine,"\t");
	     String szID = st.nextToken();
	     String szColor = st.nextToken();
             hmcolor.put(szID, szColor);
	  }
	  brcolor.close();
       }
       else
       {
	   BufferedReader brsegment =  Util.getBufferedReader(szsegmentfile);
	   HashSet hs = new HashSet();
           while ((szLine =brsegment.readLine())!=null)
           {
              String[] szLineA = szLine.split("\\s+");
              hs.add(szLineA[3].substring(1)); //this removes first char giving ordering type
	   }
	   brsegment.close();

	   Iterator itr = hs.iterator();
	   int nmaxval=1;
	   int nminval=1;

           while (itr.hasNext())
	   {
	      int nval = Integer.parseInt((String)itr.next());

	      if (nval < nminval)
	      {
		  nminval = nval;
	      }
	      else if (nval > nmaxval)
	      {
		  nmaxval = nval;
	      }
	   }



	   nmaxval = Math.max(nmaxval, nminval + numstates - 1);
	   String[] szlabels = new String[nmaxval-nminval+1];

	   for (int nindex = nminval; nindex <= nmaxval; nindex++)
	   {
	      szlabels[nindex-nminval] = ""+nindex;
	   }
	   

	   int[][] colortable = getMaxDiverseOrder(szlabels.length);

	   for (int nindex = 0; nindex < szlabels.length; nindex++)
	   {
	       hmcolor.put(szlabels[nindex], colortable[nindex][0]+","+colortable[nindex][1]+","+colortable[nindex][2]);
	   }
       }
    }