A*: Exclude nodes with infinite edge costs.