fastest way to search through this data object? (python)
- by victor
I have a data object that looks like this:
{
'node-16': {
'tags': ['cuda'],
'localNodes': [
{
'name': 'nC',
'consumesFrom': ['nA', 'nB'],
'classType': 'VectorAdder.VectorAdder'
},
{
'name': 'nB',
'consumesFrom': None,
'classType': 'RandomVector'
}
]
},
'node-17': {
'tags': ['boring'],
'localNodes': [
{
'name': 'nA',
'consumesFrom': None,
'classType': 'RandomVector'
}
]
}
}
Notice that node nA is a producer for nC. What's the fastest way to find out if a given localNode is a producer for another localnode in the data structure (and not within the same list)?
For example, I would like to know that nA (node-17) produces for nC (exists on node-16). But I don't need to know that nB produces for nC, since they exist in the same localNodes list.