public ArrayList<Node> readFromAdjacencyMatrix(String file){
        ArrayList<Node> nodes = new ArrayList<>();
        try
        {
            BufferedReader in = new BufferedReader(new FileReader(file));
            String line;
            String[] parts;
            line = in.readLine();
            parts = line.split(" ");
            String p;
            int s =0;
            for(int i=0;i<parts.length;i++)
            {
                nodes.add(new Node(i));
            }
            int d;
            for(int i=0;i<parts.length; i++)
            {
                p = parts[i];
                d = Integer.parseInt(p);
                if(d == 1)
                {
                    nodes.get(s).addLink(new Link(nodes.get(i)));
                }
            }
            while((line = in.readLine())!= null)
            {
                s++;
                parts = line.split(" ");
                for(int i=0;i<parts.length; i++)
                {
                    p = parts[i];
                    d = Integer.parseInt(p);
                    if(d == 1)
                    {
                        nodes.get(s).addLink(new Link(nodes.get(i)));
                    }
                }
            }
            in.close();
        }
        catch (Exception ex)
        {
            Logger.getLogger(NetworkGenerator.class.getName()).log(Level.SEVERE, null, ex);
        }
        return nodes;
    }