private void expandBackwardFrontier(Node current, ref Neighbor[] neighbors) { current.setClosedB(); var count = GetNeighbors(current, ref neighbors); for (var i = 0; i < count; i++) { var neighbor = neighbors[i].node; if (neighbor.isClosedB()) { continue; } var tentativeScore = current.costB + neighbors[i].cost; if (!neighbor.isOpenB()) { neighbor.setOpenB(); neighbor.costB = tentativeScore; neighbor.parentB = current; openB.Add(neighbor, tentativeScore); updateBackwardFrontier(neighbor, tentativeScore); } else if (neighbor.costB > tentativeScore) { neighbor.costB = tentativeScore; neighbor.parentB = current; openB.Update(neighbor, tentativeScore); updateBackwardFrontier(neighbor, tentativeScore); } } }