function plothmm(delta)
% delta(i,a,j) = Pr(j | i,a)

N = size(delta, 1);
A = size(delta, 2);

G = zeros(N,N);
arclabel = cell(N,A);
newarc = ones(N,N);
for i=1:N
  for a=1:A
    JS = find(delta(i,a,:) > 0);
    for j=JS(:)'
      G(i,j) = 1;
      if newarc(i,j)
	arclabel{i,j} = sprintf('%d/%4.2f', a, delta(i,a,j));
	newarc(i,j) = 0;
      else
	arclabel{i,j} = sprintf('%s, %d/%4.2f', arclabel{i,j}, a, delta(i,a,j));
      end
    end
  end
end

mkdot(G, 'junk.dot', arclabel);
!dot -Tps junk.dot -o junk.ps
!convert junk.ps junk.jpg 
A = imread('junk.jpg', 'jpg');
imagesc(A);
colormap(gray)
