function [samples, weights] = lw_noC(bnet, num_samples, evidence, obs, max_node)
% LW Likelihood Weighting: generate some random samples (row vectors) by walking down the graph
% [samples, weights] = lw_noC(bnet, num_samples, evidence, obs, max_node)

bs = bnet.blocks(:);
samples = zeros(num_samples, sum(bs(1:max_node)));
weights = zeros(num_samples, 1);
for s=1:num_samples
  bnet.values = evidence; % reset
  w = 1;
  for i=1:max_node
    if obs(i)
      ps = parents(bnet.adj_mat, i);
      w = w * prob_node(bnet, i);
    else
      bnet.values(i) = sample_node(bnet, i);
    end
  end
  samples(s,:) = bnet.values(:)';
  weights(s) = w;
end
