I have a set of pair like the following, and each pair comes with a value attached to it. For isntance the value of a pair (1,2)
will be 2.5
. There are another set of persons. Each person also connected to the subset of pairs. For instance, for p
is connected to [(1, 2), (1, 7), (2, 3)]
.
Pairs = [(1, 2), (1, 7), (2, 3), (2, 5),(3, 4), (3, 5), (4, 1), (4, 5), (5, 2)]
Values = [ 2.5, 4.1, 7.4, 5.6, 2.8, 3.7, 6.9, 0.2, 3.2 ]
Persons = ['p','q']
p_pairs = [ [(1, 2), (1, 7), (2, 3)],
[(1, 2), (2, 3), (2, 5) ,(5, 2)]
]
The question is, how to bulid up a parameter person_values
such that it return the value of the associated pairs?
For instance person_values['p',1, 2] = 2.5
and person_values['p',2, 3] = person_values['q',2, 3] = 7.4
. In other words person_values[ {elements of p1} , { elemnts of pairs} ] = related values