function pot = mk_pot_from_mux2(bnode, bnet)

if all(bnet.obs_mask([bnode.rgate bnode.cgate])) & bnet.wait_till_evidence
  % parent will just be the selected input
  bnode.CPT = eye(bnode.self_size);
else
  %ps = parents(bnet.adj_mat, bnode.self);
  %input = setdiff(ps, bnode.gate);
  ps = bnode.parents;
  input = bnode.input;
  [nrows ncols] = size(input);
  rindex = find(bnode.rgate == ps);
  cindex = find(bnode.cgate == ps);
  input_index = find_equiv_posns(bnode.input(:), ps);
  fprintf('mux2 warning: making CPT with %d parents\n', length(ps));
  bnode.CPT = mk_CPT_from_mux2(rindex, cindex, reshape(input_index, [nrows ncols]), bnode.self_size);
end

pot = mk_pot_from_tabular(bnode, bnet);


