import java.applet.Applet; import java.awt.*; import Point; public class demo extends Applet { 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 V = Integer.parseInt(getParameter("V")); int delay = Integer.parseInt(getParameter("delay")); double d = Math.sqrt(4.0/V); Graph G = new Graph(V, d); clear(page, Color.lightGray); G.paint(page); if (alg == 1) G.dfs(delay); if (alg == 2) G.bfs(delay); } }