Added array to keep track of each entity's min cost to each node.