Modifying Edge Weights in Nearest Neighbor Graph with Custom Distance Function

Dear community,

I am working on a project where I have generated a nearest neighbor graph (nnG). Here is a simplified version of the code:

data = {{7.3, -4.9, 0.2}, {7.5, -3.5, 0.1}, {4.1, -2.8, 0.3}, {0.2, 7.3, 0.1}, {7.2, -4.4, 0.3}, {-0.0, 3.5, 0.4}, {-3.2, -1.6, 0.2}, {-2.0, 4.7, 0.2}, {-7.3, 0.0, 0.3}, {-6.4, 1.6, 0.3}, {-0.4, 3.1, 0.2}, {-4.3, 0.7, 0.5}};

distanceF[u_, v_] := Sqrt[(u[[1]] - v[[1]])^2 + (u[[2]] - v[[2]])^2] + 2 k1/(k2 + (u[[3]] + v[[3]]));

k1 = 0.1;
k2 = 0.001;

nnG = NearestNeighborGraph[data[[All, 1 ;; 2]], 5, DirectedEdges -> False, DistanceFunction -> EuclideanDistance]

Now, I would like to modify the edge weights of the graph based on the distances computed by the custom distance function distanceF, using the 3 columns of the original data, instead of only the first 2 ones. How can I achieve this in Mathematica?

The idea is to keep the nnG previously computed, while only changing the edge weights.

Any guidance would be greatly appreciated.

Thank you!

The provided code does not evaluate successfully. I get

Part::partw: Part 3 of {7.3,-4.9} does not exist.

Sorry, there was a mistake in the previous version of the code. The original network is calculated using euclidean distances, while the function distanceF is the one used to update the original weights.