How to visualize Viterbi path in Latex or Graphviz

早过忘川 提交于 2019-11-28 11:03:52

问题


I'm looking for a way to visualize a Viterbi path in LaTeX or maybe Graphviz, much like in this example:

It doesn't have to be dots, but it could also be actual values between the lines. Much like a table with lines between cells.

I tried searching for ways to do this, but most likely I'm not using the right keywords.


回答1:


Here's one way to achieve this using graphviz with invisible edges:

graph {
  splines=false;
  nodesep=0.5;
  ranksep=0.5;
  node[shape=point, height=0.08];
  { rank=same; a1 -- b1 -- c1 -- d1 -- e1;}
  { rank=same; a2 -- b2; b2 -- c2[style=invis]; c2 -- d2; d2 -- e2[style=invis];}
  { rank=same; a3 -- b3[style=invis]; b3 -- c3; c3 -- d3[style=invis]; d3 -- e3;}
  edge[style=invis];
  a1 -- a2 -- a3;
  b1 -- b2 -- b3;
  c1 -- c2 -- c3;
  d1 -- d2 -- d3;
  e1 -- e2 -- e3;
  edge[style=solid, constraint=false];
  a2 -- b3 -- c2 -- d3 -- e2;
}



来源:https://stackoverflow.com/questions/12573316/how-to-visualize-viterbi-path-in-latex-or-graphviz

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!