public int next() { while (!BaseUtils.is_heap_empty(heap_queue)) { var top = BaseUtils.heap_delete_min(heap_queue); var rnode = top.node; if (rnode.x == 0) { for (var n = top; n != null; n = n.next) { result_[n.node.x] = n.node.y; } cost_ = top.gx; return(0); } for (int index = 0; index < rnode.lpathList.Count; index++) { var p = rnode.lpathList[index]; var n = BaseUtils.allc_from_heap(heap_queue); var x_num = (rnode.x) - 1; n.node = p.lnode; n.gx = -p.lnode.cost - p.cost + top.gx; n.fx = -p.lnode.bestCost - p.cost + top.gx; // | h(x) | | g(x) | n.next = top; if (BaseUtils.heap_insert(n, heap_queue) < 0) { return(BaseUtils.RETURN_INSERT_HEAP_FAILED); } } } return(0); }