fixed usage of connectedEdges in cost calculation

connectedEdges was a list of nodes is now only a list of IDs of nodes.