void addEdgeMaxSize(String a, String b, HashMap<String, Integer> protid, int maxSize) {
        if (a == null ? b == null : a.equals(b)) {    // there cannot be an edge to itself
//            System.err.println("Lalalala lololo " + a + " " + b);
            return;
        }      
        
        if (protid.containsKey(a) && protid.containsKey(b)){// && noEdges() < maxSize) {
            Integer id1 = protid.get(a);
            Integer id2 = protid.get(b);

            Node n1 = nodeMap.get(id1);
            if (n1 == null) {
                if (nodes.size() < maxSize) {
                    n1 = new Node(id1, a);
                    nodes.add(n1);
                    nodeMap.put(id1, n1);
                } else {
                    return;
                }
            }

            Node n2 = nodeMap.get(id2);
            if (n2 == null) {
                if (nodes.size() < maxSize) {
                    n2 = new Node(id2, b);
                    nodes.add(n2);
                    nodeMap.put(id2, n2);
                } else {
                    return;
                }
            }

            n1.neighbors.add(n2);
            n2.neighbors.add(n1);

            Edge e1 = new Edge();
            e1.node1 = n1;
            e1.node2 = n2;
            edges.add(e1);

            Edge e2 = new Edge();  //the same edge is added again from the perspective of node2
            e2.node1 = n2;
            e2.node2 = n1;
            edges.add(e2);
        }
    }