import java.util.ArrayList; import java.util.Random; /** * * @author Ioannis Partalas, Eric Gaussier * * This program creates a random graph */ public class RandomGraph { public RandomGraph() { } /** * * This function print in standard output a graph of the following form * * N % number of web page * 0 4 5 6 7 1 % links of web page 0 to other web pages * 1 3 4 * 2 8 5 * ... * N-1 0 43 12 * * @param N the total number of web page in the random graph */ public void createRandomGraph(int N) { Random rnd = new Random(System.currentTimeMillis()); System.out.println(N); // print the number of the web pages ArrayList page_ints = new ArrayList(); for(int i=0;i0) // print the links for the web page i { int next_link = rnd.nextInt(N); if(next_link!=i) { if(!page_ints.contains(next_link)) page_ints.add(next_link); //System.out.print(" "+next_link); num_links--; } } for(int k=0;k