public TCost Cost(TKey from, TKey to) { int row = mapper[from]; int col = mapper[to]; return(weightmatrix.Cost(row, col)); }
public CostMatrix(ICostByIndex <TCost> function, int dimension) { Matrix = new TCost[dimension][]; for (int row = 0; row < dimension; row++) { Matrix[row] = new TCost[dimension]; for (int col = 0; col < dimension; col++) { Matrix[row][col] = function.Cost(row, col); } } }