Precompute the cost of assigning each template edge to each world edge and store these things efficiently so we don't ever have to recompute them.
Precompute the cost of assigning each template edge to each world edge and store these things efficiently so we don't ever have to recompute them.