function [determined, val] = determine_value_mux2(bnode, bnet)
% DETERMINE_VALUE_MUX2 Determine the value of a mux2 node, if possible
% [determined, val] = determine_value_mux2(bnode, bnet)

if all(bnet.obs_mask(bnode.parents))
  determined = 1;
  rg = bnet.values(bnode.rgate);
  cg = bnet.values(bnode.cgate);
  [nrows ncols] = size(bnode.input);
  vals = reshape(bnet.values(bnode.input), [nrows ncols]);
  val = vals(rg, cg);
else
  determined = 0;
  val = [];
end
