function pi_from_inputs = collect_pi_from_inputs(bnode, bnet)

n = bnode.self;
ninputs = length(bnode.input);
X = bnode.self_size;
pi_from_inputs = zeros(X, ninputs);
for i=1:ninputs
  j = bnet.pearl.parent_index{n}(bnode.input(i)); % the i'th input is my j'th parent
  m = bnet.pearl.msg{n}.pi_from_parent{j};
  pi_from_inputs(:,i) = m;
end
