简体   繁体   English

如果图中有周期,我们可以应用维特比算法吗?

[英]Can we apply Viterbi algorithm if there are cycles in a graph?

I am trying to solve a question which can be solved both by BFS and viterbi algorithm. 我正在尝试解决可以通过BFS和viterbi算法解决的问题。 But BFS might fail if there are cycles in the graph. 但是,如果图中存在循环,则BFS可能会失败。 So my question is viterbi algorithm cycle safe? 所以我的问题是维特比算法循环安全吗?

As long as you make sure your graph follows rules of Hidden Markov Model (for example, sum of all outgoing edges from every node sums to 1), then yes - Viterbi Algorithm can handle cyclic graphs. 只要确保您的图遵循隐马尔可夫模型的规则(例如,每个节点的所有出站边的总和为1),那么是的- 维特比算法可以处理循环图。

It is hard to say if it's indeed the right choice or if you can use modified BFS without more context on the question. 很难说这是否确实是正确的选择,还是您可以在没有更多问题上下文的情况下使用经过修改的BFS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM