// This sample demonstrates how to
  // apply grid layout to a graph

  // Create the layout object
  GridLayout layout = new GridLayout();

  // Adjust the layout attributes 
  layout.setIterations(1000);
  layout.setGridSize(80);

  // Perform the actual arrangement
  layout.arrange(diagram);