import java.io.*;

class SmallWorldGraph{

	private static BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) );


	public static myGenericListGraph<Integer> createUDG(int n, int d)
	{
		myGenericListGraph<Integer> h = new myGenericListGraph<Integer>();
		Point[] pointArray = new Point[n];	
		
		for(int i = 0; i < n; i++)
		{
			// Genereate a point uniformly in the d by d square
			Point p = new Point(d);
			pointArray[i] = p;
			h.addVertex(i);

			for(int j = 0; j < i; j++)
				if(p.distance(pointArray[j]) <= 1)
					h.addEdge(i, j);

		}

		return h;
	}


	public static void main (String [] args) {
		myGenericListGraph<Integer> g; 
		int n = 0;
                int d = 0;

		try{
			// Prompt the user
            		System.out.println( "Type number of vertices in the graph (should be a positive integer). " );
            		// Read a line of text from the user.
            		String input = stdin.readLine();

			// converts a String into an int value
			n = Integer.parseInt( input ); 

			// Prompt the user
            		System.out.println( "Type dimensions of the square (should be a positive integer). " );
            		// Read a line of text from the user.
            		input = stdin.readLine();

			// converts a String into an int value
			d = Integer.parseInt( input ); 

		}
               	catch(java.io.IOException e)
               	{
               		System.out.println(e);
                }


		// A function that takes n and d and creates a UDG with these
		// parameters in a way that is specified in the Project 1 handout
		g = createUDG(n, d);

		System.out.println("The degree statistics for this graph are");
		System.out.println(g.averageDegree() + " " + g.maximumDegree() + " " +g.minimumDegree());
	
	}
}
