private void connectNeighbors(UndirectedGraph mdl, Variable v) {
   for (Iterator it1 = neighborsIterator(mdl, v); it1.hasNext(); ) {
     Variable neighbor1 = (Variable) it1.next();
     Iterator it2 = neighborsIterator(mdl, v);
     while (it2.hasNext()) {
       Variable neighbor2 = (Variable) it2.next();
       if (neighbor1 != neighbor2) {
         if (!isAdjacent(mdl, neighbor1, neighbor2)) {
           try {
             mdl.addEdge(neighbor1, neighbor2);
           } catch (Exception e) {
             throw new RuntimeException(e);
           }
         }
       }
     }
   }
 }