public bool Step() { int node = heap.Pop(); if (node == n) { return(true); // accept has popped up } // get outbound arcs Intarray inputs = new Intarray(); Intarray targets = new Intarray(); Intarray outputs = new Intarray(); Floatarray costs = new Floatarray(); fst.Arcs(inputs, targets, outputs, costs, node); for (int i = 0; i < targets.Length(); i++) { int t = targets[i]; if (came_from[t] == -1 || g[node] + costs[i] < g[t]) { // relax the edge came_from[t] = node; g[t] = g[node] + costs[i]; heap.Push(t, g[t] + Convert.ToSingle(Heuristic(t))); } } if (accepted_from == -1 || g[node] + fst.GetAcceptCost(node) < g_accept) { // relax the accept edge accepted_from = node; g_accept = g[node] + fst.GetAcceptCost(node); heap.Push(n, g_accept); } return(false); }