string FormatEdge(ViterbiNode from, ViterbiNode to) { if (BestPathMap.ContainsKey(GetNodeId(from)) && BestPathMap[GetNodeId(from)] == GetNodeId(to)) { return(FormatEdge(from, to, "color=\"#40e050\" fontcolor=\"#40a050\" penwidth=3 fontsize=20 ")); } else { return(FormatEdge(from, to, "")); } }
void InitBestPathMap(List <ViterbiNode> bestPath) { BestPathMap.Clear(); if (bestPath == null) { return; } for (var i = 0; i < bestPath.Count; i++) { var from = bestPath[i]; var to = bestPath[i + 1]; var fromId = GetNodeId(from); var toId = GetNodeId(to); BestPathMap.Add(fromId, toId); } }