function f = draw_tree(tree, P)

nodes = values(tree);
for i = 1:length(nodes)
  node = nodes{i};
  for j = 1:length(node.samples)
    sample = node.samples(j);
    for k=1:length(P.cars)      
      if k==1
        linespec = 'b.'; % hero
        nodespec = 'b+';
      else
        linespec = 'm-'; % other
        nodespec = 'm+';
      end
      draw_path(make_trajectory(sample.trace, k), linespec, P);
      hold on
      draw_path(make_trajectory(sample.trace(end), k), nodespec, P);
    end
  end
end
