public ArrayList<Node> readFromAdjacencyList(String file){
        ArrayList<Node> network = new ArrayList<Node>();
        boolean start = false;
        try 
        {
            BufferedReader in = new BufferedReader(new FileReader(file));
            String line;
            int s;
            int d;
            String[] parts;
            while((line = in.readLine())!= null)
            {
                if(start)
                {
                    parts = line.split(" ");
                    s = Integer.parseInt(parts[0]);
                    d = Integer.parseInt(parts[1]);
                    network.get(s).addLink(new Link(network.get(d)));
                    network.get(d).addLink(new Link(network.get(s)));
                    continue;
                }
                if(line.contains("#Number of nodes"))
                {
                    int n = Integer.parseInt(in.readLine());
                    for(int i=0;i<n;i++)
                    {
                        network.add(new Node(i));
                    }
                }
                if(line.contains("#Links"))
                {
                    start = true;
                }
            }
        } 
        catch (Exception ex) 
        {
            Logger.getLogger(NetworkGenerator.class.getName()).log(Level.SEVERE, null, ex);
        }
        return network;
    }