code: function(cells, ascending)
  	{
  		ascending = (ascending != null) ? ascending : true;
  		var lookup = new mxDictionary();
  		cells.sort(function(o1, o2)
  		{
  			var p1 = lookup.get(o1);
  			
  			if (p1 == null)
  			{
  				p1 = mxCellPath.create(o1).split(mxCellPath.PATH_SEPARATOR);
  				lookup.put(o1, p1);
  			}
  			
  			var p2 = lookup.get(o2);
  			
  			if (p2 == null)
  			{
  				p2 = mxCellPath.create(o2).split(mxCellPath.PATH_SEPARATOR);
  				lookup.put(o2, p2);
  			}
  			
  			var comp = mxCellPath.compare(p1, p2);
  			
  			return (comp == 0) ? 0 : (((comp > 0) == ascending) ? 1 : -1);
  		});
  		
  		return cells;
  	}
docs: Function: sortCells
  
  Sorts the given cells according to the order in the cell hierarchy.
  Ascending is optional and defaults to true.