I have the following pandas dataframe:
import pandas as pd
import math
df = pd.DataFrame()
df['x'] = [2, 1, 3]
df['y'] = [2, 5, 6]
df['weight'] = [11, 12, 13]
print(df)
x y weight
0 2 2 11
1 1 5 12
2 3 6 13
Suppose that these 3 nodes are called {a, b, c} respectively. I want to calculate the total Euclidean distances from one node to all other nodes multiplied by its weight, as follows:
Sum = 11(d(a,b)+d(a,c)) + 12(d(b,a)+d(b,c)) + 13(d(c,a)+d(c,b))