protected int recurse_multiple(MDDManager ddmanager, int[] nodes, int leafcount, MDDVariable bestVar) {
		if (bestVar.nbval == 2) {
			int lchild, rchild;
			int[] lnodes = new int[nodes.length], rnodes = new int[nodes.length];
			for (int i=0 ; i<leafcount ; i++) {
				lnodes[i] = rnodes[i] = nodes[i];
			}
			for (int i=leafcount ; i<nodes.length ; i++) {
				int node = nodes[i];
				if (ddmanager.getNodeVariable(node) == bestVar) {
					lnodes[i] = ddmanager.getChild(node, 0);
					rnodes[i] = ddmanager.getChild(node, 1);
				} else {
					lnodes[i] = rnodes[i] = node;
				}
			}
			lchild = combine(ddmanager, lnodes, leafcount);
			rchild = combine(ddmanager, rnodes, leafcount);
			return bestVar.getNodeFree(lchild, rchild);
		} else {
			int[] children = new int[bestVar.nbval];
			int[] nextnodes = new int[nodes.length];
			for (int v=0 ; v<children.length ; v++) {
				System.arraycopy(nodes, 0, nextnodes, 0, leafcount);
				for (int i=leafcount ; i<nodes.length ; i++) {
					int node = nodes[i];
					if (ddmanager.getNodeVariable(node) == bestVar) {
						nextnodes[i] = ddmanager.getChild(node, v);
					} else {
						nextnodes[i] = nodes[i];
					}
				}
				children[v] = combine(ddmanager, nextnodes, leafcount);
			}
			return bestVar.getNodeFree(children);
		}
	}