import java.applet.Applet;
import java.awt.*;
import Point;
public class demo extends Applet 
  {
    static final int N = 1000;

    static void clear(Graphics page, Color c)
      { 
        int h = page.getClipRect().height;
        int w = page.getClipRect().width;
        page.setColor(c);
        page.fillRect(0, 0, w, h);
      }
    public void paint(Graphics page)
      {
        int alg = Integer.parseInt(getParameter("algorithm"));
        int N = Integer.parseInt(getParameter("N"));
        int delay = Integer.parseInt(getParameter("delay"));
        Graph G = new Graph(N, .08);
        for (int i = 0; i < 4; i++, delay /= 2)
          {
            clear(page, Color.lightGray);
            G.paint(page);
            if (alg == 1) G.dfs(delay);
            if (alg == 2) G.bfs(delay);
          }
      }	    
  }

