Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. edge_index_cpu = edge_index.cpu()
  2. for edge_idx in edge_argsort.tolist():
  3. source = edge_index_cpu[0, edge_idx].item()
  4. if source not in nodes_remaining:
  5. continue
  6.  
  7. target = edge_index_cpu[1, edge_idx].item()
  8. if target not in nodes_remaining:
  9. continue
  10.  
  11. new_edge_indices.append(edge_idx)
  12.  
  13. cluster[source] = i
  14. nodes_remaining.remove(source)
  15.  
  16. if source != target:
  17. cluster[target] = i
  18. nodes_remaining.remove(target)
  19.  
  20. i += 1
  21.  
  22. # The remaining nodes are simply kept.
  23. for node_idx in nodes_remaining:
  24. cluster[node_idx] = i
  25. i += 1
  26. cluster = cluster.to(x.device)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement