If i have a weight on each edge, how do i implement a weighted norm for each node with edata[‘weight’] as input in a fast way. Now i implement a very slow version:
time_norm = torch.ones(g.number_of_nodes())
for node in node_id:
u, v, eid = g.in_edges(node.squeeze(), form='all')
in_deg = torch.sum(g.edata['weight'][eid])
if in_deg.cpu().item():
time_norm[node.squeeze()] = 1.0 / in_deg